The English chekers game simulation package
Project description
The package realizes English chekers game simulation.
Basic usage
Let’s create a game with RandomAI:
from checkers.game import Game, GameState, Color
from checkers.move import Move
from checkers.ai.random_ai import RandomAI
def main():
size = 8
game = Game(size)
ai_color = Color.WHITE
ai = RandomAI(size, ai_color)
if ai_color == Color.BLACK:
move = None
while game.state == GameState.UNFINISHED:
print(game.board)
print('b:', game.black_count, 'w:', game.white_count)
print(game.turn)
if game.turn == ai_color:
move = ai.make_move(move)
else:
moves = game.get_all_moves()
for i, move in enumerate(moves):
print(i + 1, ':', move)
print('Input number of the move for move:')
try:
move_number = int(input().strip())
except ValueError:
print('Wrong input. Number of the move must be int')
try:
move = moves[move_number - 1]
except IndexError:
print('Wrong move')
continue
game.make_move(move)
else:
print(game.board)
print(game.state)
if __name__ == '__main__':
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
english_checkers-0.0.2.tar.gz
(14.7 kB
view hashes)
Built Distribution
Close
Hashes for english_checkers-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 412b58e9f50b2f7a893a62db8b10e1c24c16a5393f98affdda871e9e0ce6a01f |
|
MD5 | b45a8fdbbb4351e337613864a8921b74 |
|
BLAKE2b-256 | b824429c2800ed408d51d75ea7be9e15f4028236c53e258669571d3fc0bd36dd |