-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (24 loc) · 815 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from game import STARTING_BOARD
from game import Player, GameOver
from game import do_move
from player_interfaces import print_board, get_move_from_stdin
def main():
board = STARTING_BOARD
active_player = Player.RED
print()
print("Welcome to checkers!")
print()
print("X = Red's pieces")
print("O = Black's pieces")
print("The rules have been simplified for your convenience! Good luck!")
try:
while True:
print_board(board)
print("{}'s turn".format(active_player))
piece_loc, player, move = get_move_from_stdin(active_player, board)
board = do_move(move, piece_loc, player, board)
active_player = active_player.enemy
except GameOver:
print("Game Over!")
if __name__ == '__main__':
main()