Page 1 of 1

Coin flip

Posted: Wed Jun 02, 2010 10:36 am
by floogle11
Hey in this one game im making for fun theres a coin flip in the begging but its not working. I coded it like this.

Code:
input "Heads or tails?(H or T)"; horts$
randomize timer
num = int(rnd * 2) + 1
if horts$ = "H" or horts$ = "h" then
d = 1
b = 0
end if
if horts$ = "t" or horts$ ="T" then
b = 1
d = 0
end if
if num = 1 then d = d + 1
if num = 2 then b = b + 1
if b = d then goto Himfirst
if d > b then goto youfirst
'then the actual game.

Posted: Thu Jun 03, 2010 6:31 am
by Anonymous
I tested your code and it seemed to work fine for me. Though I'm wondering why you are bothering to figure out which side the player pick it will still have the same probability. Something like this

Code: Select all

DO
INPUT "Heads or tails?(H or T)"; horts$
LOOP UNTIL (LCASE$(horts$) = "h" OR LCASE$(horts$) = "t")

RANDOMIZE TIMER
num = INT(RND * 2) + 1
IF num = 1 THEN GOTO Himfirst
IF num = 2 THEN GOTO youfirst
END

Himfirst:
PRINT "HIM"
END
youfirst:
PRINT "You"

Posted: Thu Jun 10, 2010 12:57 pm
by floogle11
hmm thats weird after i tested and it worked fine thanks anyway though