hi
i tried to do a recreation of the classic rock, paper, scissors game in pd. attached is the easy part :-) i got stuck in the interesting part, the one where the results from each chain ("hand", if you will) must be compared, to see who wins. before building a super complex and rube golberg-like chain of gates, moses and selects, i wanted to check for advice here. im quite sure i overlooked some brilliant and effective way of doing this.
thanks p
#N canvas 0 22 511 410 10; #X obj 108 33 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 108 117 sel 0 1 2; #X msg 125 245 set paper; #X obj 108 89 random 3; #X symbolatom 108 310 10 0 0 0 - - -; #X obj 308 117 sel 0 1 2; #X msg 325 244 set paper; #X obj 308 78 random 3; #X symbolatom 308 310 10 0 0 0 - - -; #X obj 108 61 metro 2000; #X msg 108 221 set rock; #X msg 142 269 set scissors; #X msg 308 221 set rock; #X msg 342 269 set scissors; #X connect 0 0 9 0; #X connect 1 0 10 0; #X connect 1 1 2 0; #X connect 1 2 11 0; #X connect 2 0 4 0; #X connect 3 0 1 0; #X connect 5 0 12 0; #X connect 5 1 6 0; #X connect 5 2 13 0; #X connect 6 0 8 0; #X connect 7 0 5 0; #X connect 9 0 3 0; #X connect 9 0 7 0; #X connect 10 0 4 0; #X connect 11 0 4 0; #X connect 12 0 8 0; #X connect 13 0 8 0;
Hi,
You are already treating the "hand"s as random integers.
iL = hand (value) of left player iR = hand (value) of right player
Get the value of (iL - iR). Send above value to [sel -2 -1 0 1 2]
-2 .. Right player wins -1 .. Left player wins 0 .. Even 1 .. Right player wins 2 .. Left players wins
There may be a smarter looking way without using [sel] but I think this is as few as you can get with number of objects used.
-- David Shimamoto
hi
i tried to do a recreation of the classic rock, paper, scissors game in pd. attached is the easy part :-) i got stuck in the interesting part, the one where the results from each chain ("hand", if you will) must be compared, to see who wins. before building a super complex and rube golberg-like chain of gates, moses and selects, i wanted to check for advice here. im quite sure i overlooked some brilliant and effective way of doing this.
thanks p
#N canvas 0 22 511 410 10; #X obj 108 33 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 108 117 sel 0 1 2; #X msg 125 245 set paper; #X obj 108 89 random 3; #X symbolatom 108 310 10 0 0 0 - - -; #X obj 308 117 sel 0 1 2; #X msg 325 244 set paper; #X obj 308 78 random 3; #X symbolatom 308 310 10 0 0 0 - - -; #X obj 108 61 metro 2000; #X msg 108 221 set rock; #X msg 142 269 set scissors; #X msg 308 221 set rock; #X msg 342 269 set scissors; #X connect 0 0 9 0; #X connect 1 0 10 0; #X connect 1 1 2 0; #X connect 1 2 11 0; #X connect 2 0 4 0; #X connect 3 0 1 0; #X connect 5 0 12 0; #X connect 5 1 6 0; #X connect 5 2 13 0; #X connect 6 0 8 0; #X connect 7 0 5 0; #X connect 9 0 3 0; #X connect 9 0 7 0; #X connect 10 0 4 0; #X connect 11 0 4 0; #X connect 12 0 8 0; #X connect 13 0 8 0;
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
thanks! that makes sense. although i think your results table was not accurate - i reckon it should be:
0 - 0 = 0 even 0 - 1 = -1 right 0 - 2 = -2 left 1 - 0 = 1 left 1 - 1 = 0 even 1 - 2 = -1 right 2 - 0 = 2 right 2 - 1 = 1 left 2 - 2 = 0 even
so:
#N canvas 0 22 523 526 10; #X obj 58 15 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1 ; #X obj 58 179 sel 0 1 2; #X msg 75 247 set paper; #X obj 58 71 random 3; #X symbolatom 58 382 10 0 0 0 - - -; #X obj 354 180 sel 0 1 2; #X msg 371 257 set paper; #X obj 354 91 random 3; #X symbolatom 354 383 10 0 0 0 - - -; #X msg 58 223 set rock; #X msg 92 271 set scissors; #X msg 354 234 set rock; #X msg 388 282 set scissors; #X obj 194 262 sel -2 -1 0 1 2; #X obj 263 422 bng 15 1500 250 0 empty empty empty 17 7 0 10 -262144 -13381 -1; #X obj 194 422 bng 15 1500 250 0 empty empty empty 17 7 0 10 -262144 -258113 -1; #X obj 228 461 bng 15 1500 250 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 58 43 metro 5000; #X obj 194 208 -; #X text 221 477 even; #X floatatom 371 123 5 0 0 0 - - -; #X text 132 420 left wins; #X text 282 420 right wins; #X floatatom 194 236 5 0 0 0 - - -; #X connect 0 0 17 0; #X connect 1 0 9 0; #X connect 1 1 2 0; #X connect 1 2 10 0; #X connect 2 0 4 0; #X connect 3 0 1 0; #X connect 3 0 18 0; #X connect 5 0 11 0; #X connect 5 1 6 0; #X connect 5 2 12 0; #X connect 6 0 8 0; #X connect 7 0 5 0; #X connect 7 0 20 0; #X connect 7 0 18 1; #X connect 9 0 4 0; #X connect 10 0 4 0; #X connect 11 0 8 0; #X connect 12 0 8 0; #X connect 13 0 15 0; #X connect 13 1 14 0; #X connect 13 2 16 0; #X connect 13 3 15 0; #X connect 13 4 14 0; #X connect 17 0 7 0; #X connect 17 0 3 0; #X connect 18 0 23 0; #X connect 23 0 13 0;
thanks! that makes sense. although i think your results table was not accurate - i reckon it should be:
Ooops, Yeah, I may have had my lefts and rights reversed. :) Must have lost it somewhere down the translation. "Paper, etc..." is a very big game in my region also but with different terminology.
-- David Shimamoto