Pig the dice game/Player: Difference between revisions

No edit summary
Line 2,008:
 
=={{header|M2000 Interpreter}}==
Strategy like ADA, look if get 8 or mortemore points and then look if other sum is lower from 100 from a min difference, and if it is true the choose Hold, else continue until win or dice=1.
 
<lang M2000 Interpreter>
Module GamePig {
Print "Game of Pig"
dicegames=-1100
res$win1=""0
Player1pointswin2=0
Player1sum=0While games {
Player2points=0 games--
Player2sum dice=0-1
HaveWin res$=False""
\\ strategy Player1points=0
Max_Points Player1sum=80
Min_difference Player2points=100
score() Player2sum=0
\\ for simulation HaveWin=False
Score()\\ strategy
simulate$=String$("R", 500)
Keyboard simulate$ score()
\\ endfor simulation
while res simulate$=String$<>("QR", {500)
PrintKeyboard "Player 1 turn"simulate$
PlayerTurn(&Player1points,\\ &player1sum,end player2sum)simulation
ifwhile res$=<>"Q" then exit{
Player1sum+=Player1points Print "Player 1 turn"
PlayerTurn(&Player2pointsPlayer1points, &player1sum, player2sum, player1sum8, 10)
Score()
Print "Player 2 turn if res$="Q" then exit
Player1sum+=Player1points
PlayerTurn(&Player2points,&player2sum, player1sum)
if res$="Q" then exit Score()
Player2sum+=Player2points Print "Player 2 turn"
PlayerTurn(&Player2points,&player2sum, player1sum, 12, 20)
Score()
if res$="Q" then exit
}
Player2sum+=Player2points
If HaveWin then {
Score()
If Player1Sum>Player2sum then {}
If HaveWin then Print "Player 1 Win"{
} Else Print "Player 2 Win" Score()
If Player1Sum>Player2sum then {
Print "Player 1 Win"
win1++
} Else Print "Player 2 Win" : win2++
Score()}
}
If HaveWinwin1>win2 thenThen {
Print "Strategy 1 Win", win1;">";win2
} Else Print "Strategy 2 Win", win2;">";win1
Sub Rolling()
Line 2,063 ⟶ 2,071:
} Until Instr("RHQ", res$)>0
End Sub
Sub PlayerTurn(&playerpoints, &sum, othersum, Max_Points, Min_difference)
PlayOrQuit()
If res$="Q" then Exit Sub
Anonymous user