Uno (Card Game)/Julia: Difference between revisions
Content added Content deleted
mNo edit summary |
|||
Line 97: | Line 97: | ||
hands = [deck[i:i+6] for i in 1:7:27] |
hands = [deck[i:i+6] for i in 1:7:27] |
||
game = UnoCardGameState(drawpile, discardpile, [UnoCardGamePlayer(playernames[i], 0, |
game = UnoCardGameState(drawpile, discardpile, [UnoCardGamePlayer(playernames[i], 0, |
||
startswith(playernames[i], "Bot") |
startswith(playernames[i], "Bot"), hands[i]) |
||
for i in 1:length(playernames)], 1, "Wild", "Wild", true, true) |
for i in 1:length(playernames)], 1, "Wild", "Wild", true, true) |
||
dealer = rand(1:length(playernames)) |
dealer = rand(1:length(playernames)) |
||
Line 152: | Line 152: | ||
# bot will challenge half the time, player must challenge in 5 seconds. |
# bot will challenge half the time, player must challenge in 5 seconds. |
||
if game.players[game.pnow].isabot && rand() < 0.5 || |
if game.players[game.pnow].isabot && rand() < 0.5 || |
||
(!game.players[game.pnow].isabot && challenge[begin] |
(!game.players[game.pnow].isabot && challenge[begin]) |
||
challenge[begin] = false |
challenge[begin] = false |
||
logline("$(game.players[game.pnow].name) challenged Draw Four!") |
logline("$(game.players[game.pnow].name) challenged Draw Four!") |