Skip to main content

simple bot for tic tac toe

Project description

[GitHub:] (https://github.com/ruslan-ilesik/tic-tac-toe-bot-pip-package) Usage Example

import tic_tac_toe

map = tic_tac_toe.Field(clear_place_sign= '',player_sign='x',bot_sign='o',turn= 'player') #default values (turn is randomed if defaut, posible ['bot','player'])
bot = tic_tac_toe.Bot(map,level=100) #
print(map.is_payer_turn()) #>> True
print(map.get_map()) #>> [['', '', ''], ['', '', ''], ['', '', '']]
print(map.make_move(position = [0,0],skip_check=False,place_anyway=False)) #position = [0-2,0-2],skip_check - if True, skips check for turn, place_anyway - skip check if place free
#>> False # it prints if someone won after that (could be "bot","player","draw" (when no places free and anyone win),False)
print(map.get_map())#>>[['x', '', ''], ['', '', ''], ['', '', '']]
print(map.is_payer_turn())# >> False
print(bot.make_move())# >> False
print(map.get_map())#>> [['x', 'o', ''], ['', '', ''], ['', '', '']]
print(map.is_payer_turn())# >> True
print(map.make_move(position = [0,1],skip_check=False,place_anyway=True)) # False
print(map.get_map())#>> [['x', 'x, ''], ['', '', ''], ['', '', '']]
print(map.is_payer_turn())# >> False
print(map.make_move(position = [0,2],skip_check=True,place_anyway=False)) # player
```python

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tic_tac_toe_api_bot-0.2.2.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file tic_tac_toe_api_bot-0.2.2.tar.gz.

File metadata

  • Download URL: tic_tac_toe_api_bot-0.2.2.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5

File hashes

Hashes for tic_tac_toe_api_bot-0.2.2.tar.gz
Algorithm Hash digest
SHA256 61bae81a216249c9f0a28e81f804bf7128a49971be0fc0aedf4b2e05da6abb18
MD5 154d86c9972a89a5d006d7edc13f4ff2
BLAKE2b-256 0b3f2c055d1f80763fa63f824cd38e084d9599b0eefc773e356bb0353500654c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page