Akavall / GoGamesProject

Trying to make some simple games using golang.
1 stars 1 forks source link

For AI, shot count is being lost #62

Closed Akavall closed 6 years ago

Akavall commented 6 years ago
2018/03/05 02:31:22 Grabbed game state with id: 108f54eb-5e16-4fcb-49f7-36b1670a28dd
2018/03/05 02:31:22 Size of deck : 11
2018/03/05 02:31:22 ^[[034mshot: 2,brains: 0, walks: 1^[[0m
2018/03/05 02:31:22 AI Player rolled: red, walk
2018/03/05 02:31:22 AI Player rolled: red, shot
2018/03/05 02:31:22 AI Player rolled: yellow, shot
2018/03/05 02:31:22 ^[[0;32mPlayer: You, Score: 13^[[0m
2018/03/05 02:31:22 ^[[0;32mPlayer: AI Player, Score: 11^[[0m
2018/03/05 02:31:22 ^[[32mMax score: 13^[[0m
2018/03/05 02:31:24 PLAYERS NAME : AI Player
2018/03/05 02:31:24 continue_turn_0 : true
2018/03/05 02:31:24 uuid : 108f54eb-5e16-4fcb-49f7-36b1670a28dd
2018/03/05 02:31:24 Grabbed game state with id: 108f54eb-5e16-4fcb-49f7-36b1670a28dd
2018/03/05 02:31:24 Size of deck : 11
2018/03/05 02:31:24 ^[[034mshot: 2,brains: 0, walks: 1^[[0m
2018/03/05 02:31:25 AI Player rolled: red, shot
2018/03/05 02:31:25 AI Player rolled: red, shot
2018/03/05 02:31:25 AI Player rolled: yellow, shot
2018/03/05 02:31:25 ^[[0;32mPlayer: You, Score: 13^[[0m
2018/03/05 02:31:25 ^[[0;32mPlayer: AI Player, Score: 11^[[0m
2018/03/05 02:31:25 ^[[32mMax score: 13^[[0m
2018/03/05 02:31:26 PLAYERS NAME : AI Player
2018/03/05 02:31:26 continue_turn_0 : true
2018/03/05 02:31:26 uuid : 108f54eb-5e16-4fcb-49f7-36b1670a28dd
2018/03/05 02:31:26 Grabbed game state with id: 108f54eb-5e16-4fcb-49f7-36b1670a28dd
2018/03/05 02:31:26 Size of deck : 11
2018/03/05 02:31:26 ^[[034mshot: 2,brains: 0, walks: 1^[[0m
2018/03/05 02:31:26 AI Player rolled: red, brain 
2018/03/05 02:31:26 AI Player rolled: red, brain 
2018/03/05 02:31:26 AI Player rolled: yellow, brain 
Akavall commented 6 years ago

I think it is a race condition that results from clicking too quickly, but need to look more into it.

Akavall commented 6 years ago

I think I see what is happening: clicking "AI turn" calls "take_turn" function, which grabs the game state from DynamoDB, since simulationist takes some time to process will make new calls to "take_turn", which can override (if completes later) the result of the previous call toll to "take_turn", since at the end function "takes_turn" saves the updated state to DynamoDB.

Akavall commented 6 years ago

I don't think this issue resolved. I am still running into this. It only happens at the end of the game. If human player is winning (13 or more points), the game does not stop after AI is shot three or more times, it seems like AI gets another chance.

Akavall commented 6 years ago

64