fishfred
0a0f9e9d21
bots: Fix tictactoe, connect_four emoji
2020-03-30 12:02:32 -04:00
Tarun Kumar
b8d4f0b869
Enforce 'rules' command in existing games.
...
Add 'rules' command in connect_four.py.
Add 'rules' command in tictactoe.py.
Add 'rules' command in game_handler_bot.py.
2018-03-25 12:53:15 -04:00
Dhruv Thakker
9fe64b85d0
tic_tac_toe : Add shorthand moves.
2018-03-10 06:33:43 -05:00
fredfishgames
3cbb16722d
zulip_bots: Migrate tictactoe bot to new game_handler.
2018-01-22 11:30:31 -05:00
neiljp (Neil Pilgrim)
ced3a97b3f
TicTacToe: Extract sanitized_move from TicTacToeGame as coords_from_command.
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
c6e9beb2a1
TicTacToe: Rename & simplify some functions.
...
Rename:
* win_conditions -> contains_winning_move
* check_validity -> is_valid_move
* sanitize_move -> sanitized_move
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
a72764d7b8
TicTacToe: Improve encapsulation of board data in TicTacToeGame.
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
aadf639e5e
TicTacToe: Remove python2 compatibility imports
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
cff3e30734
TicTacToe: Coalesce & refactor response messages.
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
a7f7994302
TicTacToe: Use game objects instead of calling TicTacToeGame with self.
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
b1dba0bd30
TicTacToe: Move tictactoe() text from game-logic to handle_message.
...
Also remove early debugging logic.
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
6d4b205595
TicTacToe: Use simple comparison instead of overly-complex first_time().
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
d10601b554
TicTacToe: Refactor new-game handling into existing section.
...
Also extend storage-update section; all related storage.put calls
are now together.
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
33e8517b87
TicTacToe: Decouple TicTacToeGame.tictactoe() string from move result.
...
This allows the storage update to be refactored into one block before
sending the result text.
2017-12-12 17:11:29 -06:00
neiljp (Neil Pilgrim)
5843801d13
TicTacToe: Simplify superfluous initial command logic.
2017-12-12 17:11:29 -06:00
Steve Howell
f69d71c3b1
bots: Remove unneeded __future__ imports.
2017-12-12 07:32:14 -06:00
Robert Hönig
ea6ddb2312
zulip_bots: Only cache storage.get(). Don't cache put().
2017-11-24 10:44:34 -08:00
derAnfaenger
2a74ad11c5
zulip_bots: Make StateHandler optional.
...
This has the convenient side-effect of making
the bot_handler.storage attribute read-only.
2017-11-18 08:58:47 -08:00
derAnfaenger
daad7f24e4
bots: Set JSON as default serializer for StateHandler.
...
With this change, StateHandler.put() does only accept JSON-able
objects by default. The incrementor test tried to store the return
value of send_reply(), a non-JSON-able MockObject, in the state.
Therefore, this commits also sets functional default test return
values for send_message() and send_reply().
Finally, it fixes the tictactoe bot which relied on directly
modifying the state_ attribute.
2017-11-18 08:58:47 -08:00
derAnfaenger
59f81845dd
zulip_bots: Update StateHandler API to behave dict-like.
...
This matches the external StateHandler API with the embedded
StateHandler API.
2017-10-24 13:15:51 +02:00
derAnfaenger
32df4e097d
tictactoe bot: Store game state in JSON-able format.
2017-10-24 13:03:41 +02:00
derAnfaenger
e331426c64
zulip_bots: Rename state_handler to storage.
2017-10-23 12:24:41 +02:00
derAnfaenger
eb6982e670
zulip_bots: Make state_handler property of bot_handler.
2017-10-23 12:17:46 +02:00
neiljp (Neil Pilgrim)
45527c4cf4
bots: Switch TicTacToe to use state_handler.state() contextmanager.
2017-07-24 17:22:17 -07:00
Eeshan Garg
879f44ab3a
bots: Move all bots and the bots API to separate package.
2017-07-18 02:20:27 -02:30