Are you doing something like this:
d=0 e=0 g="" repeat cls() ?d/e*200 ?g flip() a=btnp(4)b=btnp(5) c=rnd() if a or b then f="-" if (a and c<.5) d+=1 f="*" if (b and c>=.5) d+=1 f="*" g=g..f if (e%32==31) g=g.."\n" e+=1 end until forever
My take on this cart.
Where "*" means you guessed the same as the computer. Number is score. Over 75 is good.
i actually simplified a couple randomness tests and used the results from those to calculate a simple score in the range of 0-1.
had fun learning about all the different ways to test randomness, but what i went with was simplified entropy (which for coin flips is essentially the distance between 0.5 and the ratio of 0's to 1's), and maximum run test (which says for a certain number of trials, the maximum run is expected to be a certain length, so i subtracted the distance from that from the score). and lastly, i just punished the player for holding down both keys and typing 10101010..., because doing that gave a pretty good score :)
Ah I hadn't considered both buttons.
I can fix that though ... Smaller code:
d=0 e=0g=""h=btnp repeat cls() ?d/e*200 ?g flip()a=h(4)b=h(5)c=rnd() if(a or b)and not(a and b)then f="-" if((a and c<.5)or(b and c>=.5))f="*"d+=1 g=g..f if(e%32==31)g=g.."\n" e+=1end until z
[Please log in to post a comment]