generated from mwc/lab_tic_tac_toe
combinations in the tic tac toe game, then completed the existing method for checking the winner. I outlined my strategy a little in the notes section as well, but like a lof of my code, I plan on paper. It remainded me of the same thing I tell my students when they are writing an essay. Even if it seems obvious, you have to tell the reader (or in theis case the computer) what you mean. Or it will fill in the gaps based on what you already said, and that is how things get misconstrude. I started by writing the ways that the game can end. 1. The board can be full and there is no winner. 2. X can will by getting three in a row; row, column, and diagonal. 3. 0 can win by getting three in a row; row, column, and diagonal. The I elimated the options that are alread accounted for. We have a solution for when the board is completely full, so there needs to be options to end the game when a winner actually wins. So, I listed the ways that you can win, the integer combos that are options for a win. I listed them in order by the direction of the win. Row then column, then diagonal. Finally, I listed the steps that I would need to add this to the code. 1. I needed to adjust the def_winner method to return something other than just false. 2. To make it able to tell True from False, I needed to tell it what was true; so I also would have to list the combos that would win. 3. I need a new method that will check the board against the index provided in the def_winner method. |
||
---|---|---|
nim | ||
strategy | ||
ttt | ||
.commit_template | ||
.gitignore | ||
notes.md | ||
play_nim.py | ||
play_ttt.py | ||
poetry.lock | ||
pyproject.toml |