Obsession with Randomness!

I have recently had a obsession with random. Why you ask? Well it all started with the simplicity of Ruby and its ability to generate random numbers so easily. I first used it with a HTF map i created for climbing to a goal. I have been doing more and more experiments with Ruby and *.bzw. My recent delve into ruby is not playable at all, but I was bored and looking something interesting to do.

It started with a idea of a tapering climb of boxes and one simple line of code.

x=rand(800)-400 


This generates a random number between -400 and 400, which happens to be a world size of bzflag maps. It also worked with a case statement. Basically without displaying 100 lines of code, if within a range of x it would change the z level. The closer to 0 the higher the z.


I then discovered that to taper it would have to taper just up one axis. So we changed to direction of the x axis with these two lines.

x=rand(400)
y=rand(800)-400


Screenshot of the current code:


Yes I know its not playable, but thats not the goal. Looking at this, it would seem it needs a little color. So I used to cnt from the while loop to change its color a bit.

if cnt % 2 == 0

tex="texture blue_basewall"

else

tex="texture red_basewall"

end


Which gives this look:



I realize this may not be exciting, but its just to demonstrate the ability of Ruby to do things much simpler. 

 Take a look at this code here: http://pastebin.com/3HEk33qb

ahs3





Comments