Quote: "First problem: When prompted for a number of coins to remove, the program wont accept any coins other than the maximum number, even though my code specifically states:"
The problem is the last part of the UNTIL loop... you tell it that remove has to be between 0 and coinmax and equal to coinmax. Get rid of the "remove = INT(coinmax)" and it'll be fine.
The INT() command makes sure numbers are whole but a normal variable is already an integer so in this case there's no need for the INT() command at all (anywhere in your code).
Quote: "Secondly, my AI chooses a random number of coins to remove, but the number of coins doesnt actually decrease..."
You've got one too many n's in coinnum. "coinnnum = coinnum-remove"
The other things I noticed is that you need a RANDOMIZE TIMER() at the top of your code. Any program that picks random numbers needs to have that at least once at the top of the code to make sure that the program doesn't pick the same random numbers every time.
Also when getting text input like the Heads/Tails it's best to change that input to higher case or lower case letters because if the user types "heads" and you check for "Heads" it's not the same thing... but if it converts it to higher case with the UPPER$() command any way the user types in "heaDS" will convert to "HEADS" to detect the right word.
Oh and it's really pointless to have "GOTO coinflip" when the label is right under the GOTO.
Here's your code modified (I had to change "random" to "Flip" because it conflicted with IanMs Matrix 1 Utilities Plugin):
` Make random number picking more random
randomize timer()
PRINT "Pick a number of coins between 10 and 50"
REPEAT
INPUT coinnum
IF coinnum < 10 or coinnum > 50 then PRINT "Out of range."
until coinnum >= 10 and coinnum <= 50
PRINT "Pick the maximum number of coins you can take out at one time between 3 and 10."
REPEAT
INPUT coinmax
IF coinmax < 3 or coinmax > 10 then PRINT "Out of range."
until coinmax >= 3 and coinmax <= 10
Flip = rnd(1)
PRINT "Heads or Tails?"
REPEAT
INPUT coin$
` Make user input higher case
coin$=upper$(coin$)
IF coin$ = "HEADS" then coin = 1
IF coin$ = "TAILS" then coin = 2
until coin>0
WAIT 500
IF coin = Flip+1
PRINT "Well done, you can go first!"
` Set variable for player to go first
CPlayer=0
else
PRINT "Sorry, I go first."
` Set variable for computer to go first
CPlayer=1
endif
WAIT 2000
CLS
do
` Players turn
if CPlayer=0
PRINT "Pick a number of coins."
REPEAT
INPUT remove
until remove >= 0 and remove =< coinmax
` Decrease coinnum by remove
dec coinnum,remove
PRINT "The number of coins left is " ;coinnum
WAIT 1000
` Check for the end of the game and EXIT the DO/LOOP
if coinnum<=0 then exit
` Switch to computer for next turn
CPlayer=1
else
` Computers turn
remove = rnd(coinmax)
WAIT 500
PRINT "The AI chooses " ;remove; " coins."
` Decrease coinnum by remove
dec coinnum,remove
WAIT 500
PRINT "The number of coins left is " ;coinnum
WAIT 1000
` Check for the end of the game and EXIT the DO/LOOP
if coinnum<=0 then exit
` Switch to player for next turn
CPlayer=0
endif
loop
` Announce winner
if CPlayer=0
PRINT "You win!"
else
PRINT "Sorry you lose."
endif
WAIT 2000