Skip to content

fix bug on winning patterns, token colors, and human move timer.

Compare
Choose a tag to compare
@warrenca warrenca released this 24 Mar 01:54
· 13 commits to master since this release
56549c4

Originally I was just testing the probability of AI-vs-AI but then it expanded to a lot of things.

  1. Added more tests for winning patterns because of the bug I found in horizontal winning pattern. It's not checking for the winner on column 4-7.
  2. Add colors to the players tokens to make it easier to see. Though, this might spoil the game as it's more exciting when it is monochrome.
  3. I put a 15 second timer for humans to make a move, it can still be tweaked as it's only a constant the the HumanPlayer::TIME_PER_MOVE_IN_SECONDS. I made this because I was playing with my colleague and he made his move very long and it's kinda spoiling up the game again. With a timer, the human players will be pressured to make a move, otherwise a random move will be made for them by the computer. This timer will also reinforce the token colors I've made in point #2. Another thing to note when I was working on this was it's very difficult to make a timer and wait for a users input at the same time. This is because PHP is a blocking language. I have to check for solutions online that offers linux shell command, so this won't probably work in Windows.