@@ -47,29 +47,35 @@ Notable game rules:
4747
4848## How to play
4949
50- To start a game between two human players, you can easily just run the package
51- on the command line:
50+ ### Command Line
51+
52+ To start a game between two human players, you can run the package on the
53+ command line:
5254
5355``` bash
5456$ python -m alicechess
5557```
5658
5759A window will come up where the game can be played.
5860
59- ## Playing against bots
61+ You can also change the players you want to play with by specifying any two of
62+ the builtin players (` HumanPlayer ` or any of the bots defined in ` bots.py ` ):
63+
64+ ``` bash
65+ $ python -m alicechess HumanPlayer RandomPlayer
66+ ```
6067
61- To play a game against a bot or between bots, you must write your own script.
62- You should initialize a ` Game ` object with the appropriate players, then call
63- either the ` start() ` or ` start_window() ` method. To write your own bot, see the
64- [ Writing a bot] ( #writing-a-bot ) section.
68+ See ` python -m alicechess --help ` for a list of the possible players.
69+
70+ ### Script
71+
72+ You can also use a script to run a game. You must initialize a ` Game ` object
73+ with the appropriate players, then call the ` start_window() ` or ` start() `
74+ method.
6575
6676Here is an example:
6777
6878``` python
69- """
70- Plays a game between a human and a bot that plays randomly.
71- """
72-
7379from alicechess import Game, HumanPlayer
7480from alicechess.bots import RandomPlayer
7581
@@ -82,14 +88,17 @@ Note that the class names (not instances) are passed to the `Game` constructor.
8288The ` start_window() ` method will, as implied, start an interactive window where
8389the game can be played. However, you can also opt to use the ` start() ` method
8490instead, which will return the first ` GameState ` of the game, and then use
85- another way to ask the user for input and play the game; for instance, you could
86- make the game entirely textual with user input provided with the keyboard. See
87- the [ API Documentation] [ docs ] for more information.
91+ another way to ask the user(s) for input and play the game; for instance, you
92+ could make the game entirely textual with user input provided with the keyboard.
93+ See the [ API Documentation] [ docs ] for more information on ` GameState ` objects,
94+ and check out [ ` window.py ` ] [ ] for how the windowed game is handled.
8895
8996In the interactive window, there is a 3 second delay for non-human player moves,
9097to simulate realism. This can be changed by passing a value for
9198` non_human_player_delay ` to the ` start_window() ` method.
9299
100+ To play against your own bot, see the [ Writing a bot] ( #writing-a-bot ) section.
101+
93102It is also possible for two bots to play against each other.
94103
95104### Writing a bot
@@ -103,13 +112,9 @@ then be passed into the `Game` constructor to start a game. See the
103112Here is an example:
104113
105114``` python
106- """
107- Plays a game between a human and a bot (that I wrote).
108- """
109-
110115from alicechess import Game, HumanPlayer, Player, PromoteType
111116
112- class Bot (Player ):
117+ class MyBot (Player ):
113118 """ A very good bot that I wrote."""
114119
115120 def make_move (self , game_state ):
@@ -121,13 +126,14 @@ class Bot(Player):
121126 return PromoteType.QUEEN
122127
123128if __name__ == " __main__" :
124- Game(white = HumanPlayer, black = Bot ).start_window()
129+ Game(white = HumanPlayer, black = MyBot ).start_window()
125130```
126131
127- [ docs ] : https://github.com/josephlou5/alicechess/blob/main/Documentation.md
128-
129132## Credit
130133
131134Thank you to Artyom Lisitsyn for inspiring me to pursue this project and to
132135Trung Phan for being my chess consultant and answering all my questions on rules
133136and technicalities.
137+
138+ [ docs ] : https://github.com/josephlou5/alicechess/blob/main/Documentation.md
139+ [ `window.py` ] : https://github.com/josephlou5/alicechess/blob/main/src/alicechess/window.py
0 commit comments