Posts

Part 1 - Computer Tic Tac Toe Basics

Part 1 - Computer Tic Tac Toe Basics Basic Tic Tac Toe support classes and game logic ¶ In the first part of this series, we will introduce the basic framework and helper classes that we will use throughout. We will also create the first computer player. Let's get started: ¶ We will use the following classes which are defined in Board.py : Board : Contains all the Tic Tac Toe board state management plus some utility methods GameResult : Enum of all the possible game states. A game can be either NOT_FINISHED , DRAW , CROSS_WIN , or NAUGT_WIN CROSS , NAUGHT : Will tell our players what side they play, as well as inidcate what pieces are on each square of the board - which can also be EMPTY . We also define a utility method print_board that prints a board state pretty in HTML: In [1]: from IPython.display import HTML , display from tic_tac_toe.Board import Board , GameResult , CROSS , NAUGHT
Recent posts