HIDIHO!

giving something back to the Flash community

Rock Paper Scissors

Tags: , , , , , , ,

cover


I read an article about thi sgame lately and felt it would be nice to give it a graphic output.

the Rock Paper Scissors’ (RPS) game is played worldwide with many variations.
Basically, you have 3 entities. Each of which can beat and be beaten by one of the other two.

  • Rock breaks the scissors and is being wrapped up by the paper
  • Paper wraps up the rock and is being cut by the scissors
  • Scissors cuts the paper and is being broken by the rock

twice the symbol gives an ex-aequo result.

here’s a basic example :

you can set the amount of dots per team with numeric stepper.
the recursive checkbox will search the next non-null match and the random checkbox will pick any other dot in the circle instead of the next in the list.

in real life, a game would correspond to 1 in the numeric stepper and random set to true.
it’s a good way to choose randomly between 3 values.

hereunder are some graphic stuff done by piling up the resulting color of each round and tweaking the transform matrix a bit:
http://www.barradeau.com/nicoptere/AS3/pierrepapierciseaux/pfc/img/1000.png
above: a 1000 rounds with nine dots

http://www.barradeau.com/nicoptere/AS3/pierrepapierciseaux/pfc/img/4500.png
above: a 4500 rounds with three dots

http://www.barradeau.com/nicoptere/AS3/pierrepapierciseaux/pfc/img/tweak_0.png
above: keeping track of the last round

http://www.barradeau.com/nicoptere/AS3/pierrepapierciseaux/pfc/img/tweak_1.png
above: variation of last track stuff

http://www.barradeau.com/nicoptere/AS3/pierrepapierciseaux/pfc/img/250000.png
above: a 250.000 rounds with three dots (took 3 hours to compute ^^)

this last one reminded me of the seed based noise generator stuff I tried some time ago.

an interseting thing to do is to set up say, 10 dots + the random + recursive modes for a while then uncheck the randomness.
first it will run crazy, creating a random sequence mixing up the colors and then it will color-sort the dots again.
not especially spectucular yet it gave me an idea: why not using it as an ‘organic’ noise generator.
we can even create a N dimension RPS (there are various versions available like RPS-15 or RPS-25 ).
the rule I chose is quite easy: each type can eat

int( totalTypes / 2 )+( ( totalTypes%2==0 )?0:1 );

other types and they don’t kill the enemy but convert it to their color.
here’s an illustration of the combinations obtained fro various totalTypes.

and here’s an illustration of an ‘organic’ random pattern( CPU INTENSIVE )
click once anywhere to spawn the simulation
click on the noise or the swatches to respawn with different colors
click outside the central square to start/stop


if you wait for some seconds, you’ll obtain a nice little organic noise pattern with no way to reproduce it ^^
I did a basic brownian motion it’s enough to create interesting patterns.

the way I did it is far too expensive CPU wise but I’m sure it could be used on very small maps for faking caustics or randomizing clouds or whatever.
the basic version is also great to get random figures. say you put 3 dots in each team and get the time it took a team to win.
this cannot be predicted for it can be infinite.
well that’s not the greatest article ever yet, just like the hysteresis, I found this principle interesting and wanted to share :)

Tags: , , , , , , ,

© 2009 HIDIHO!. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.