tests, small comments and modifications, and start of new strategy#1
tests, small comments and modifications, and start of new strategy#1
Conversation
mayaekd
commented
Jun 20, 2020
- Created test_C4Game.py to test some things in C4Game.py. Currently passes all tests.
- Added comments
- Added (player) names to parameters for creating a C4Game
- Fixed some small typos
- Idea for new strategy is started in C4Game.allPossibleWins.
- allPossibleWins is not yet implemented but there is a large comment describing what it should do and some pseudocode
- The idea comes from the observation that there really aren't that many distinct lines of 4 (or however many) that you can complete to win. The idea is to keep a set of all the possible lines of 4 (or however many) that could be made, and every time during play that one of those possibilities is lost, remove it from the set. Trying to win can be based on trying to move toward completing the lines still in the set.
- Created test_C4Game.py to test some things in C4Game.py. Currently passes all tests.
- Added comments
- Added (player) names to parameters for creating a C4Game
- Fixed some small typos
- Idea for new strategy is started in C4Game.allPossibleWins.
- allPossibleWins is not yet implemented but there is a large comment describing what it should do and some pseudocode
- The idea comes from the observation that there really aren't that many distinct lines of 4 (or however many) that you can complete to win. The idea is to keep a set of all the possible lines of 4 (or however many) that could be made, and every time during play that one of those possibilities is lost, remove it from the set. Trying to win can be based on trying to move toward completing the lines still in the set.
| self.assertEqual(game.turn, 0) | ||
| self.assertEqual(len(game.playerArray), game.players) | ||
| # Tests that playerArray comes out as expected | ||
| player0Exp = Player(0, "Maya") |
There was a problem hiding this comment.
The Exp on the end of this variable name seems confusing, also would be better to Hard code the test values instead of running them through a Player constructor, just incase the error is int he Player constructor
There was a problem hiding this comment.
ah I see, but the Color comes from the Game, so maybe something like this makes more sense.
testP0Name = "maya"
testP1Name = "joey"
player0Exp = Player(0, testP1Name)
...
and then reuse the testPXNames at the top too.
But not a big deal :P
There was a problem hiding this comment.
Can you explain to me why naming the strings like that is better? :)
Exp stood for expected in my mind. What did it evoke for you?
joenelsong
left a comment
There was a problem hiding this comment.
Nice job with the test cases! I left a comment or two.
Also C4Game.py no longer runs but we can fix that later anyway, it should probably take command line arguments to start it anyway.