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 details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file english_checkers-0.0.2.tar.gz.
File metadata
- Download URL: english_checkers-0.0.2.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
406a5dc2eb25871066944defd1aaad03db8476b2a33706c5399854e6738c633b
|
|
| MD5 |
81d61c04aa7ed379535646f9403f0947
|
|
| BLAKE2b-256 |
19f2902a7673adaf5fbca64799ae7bda663becba23647374334b9947effccfea
|
File details
Details for the file english_checkers-0.0.2-py3-none-any.whl.
File metadata
- Download URL: english_checkers-0.0.2-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
412b58e9f50b2f7a893a62db8b10e1c24c16a5393f98affdda871e9e0ce6a01f
|
|
| MD5 |
b45a8fdbbb4351e337613864a8921b74
|
|
| BLAKE2b-256 |
b824429c2800ed408d51d75ea7be9e15f4028236c53e258669571d3fc0bd36dd
|