This repository has been archived by the owner on Jul 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hand-calculating-refactoring'
- Loading branch information
Showing
65 changed files
with
520 additions
and
4,995 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
class InterfaceAI(object): | ||
""" | ||
Public interface of the bot AI | ||
""" | ||
version = 'none' | ||
|
||
player = None | ||
table = None | ||
|
||
def __init__(self, player): | ||
self.player = player | ||
self.table = player.table | ||
|
||
def discard_tile(self, discard_tile): | ||
""" | ||
AI should decide what tile had to be discarded from the hand on bot turn | ||
:param discard_tile: 136 tile format. Sometimes we want to discard specific tile | ||
:return: 136 tile format | ||
""" | ||
raise NotImplemented() | ||
|
||
def init_hand(self): | ||
""" | ||
Method will be called after bot hand initialization (when tiles will be set to the player) | ||
:return: | ||
""" | ||
|
||
def erase_state(self): | ||
""" | ||
Method will be called in the start of new round. | ||
You can null here AI attributes that depends on round data | ||
:return: | ||
""" | ||
|
||
def draw_tile(self, tile): | ||
""" | ||
:param tile: 136 tile format | ||
:return: | ||
""" | ||
|
||
def should_call_win(self, tile, enemy_seat): | ||
""" | ||
When we can call win by other player discard this method will be called | ||
:return: boolean | ||
""" | ||
return True | ||
|
||
def should_call_riichi(self): | ||
""" | ||
When bot can call riichi this method will be called. | ||
You can check additional params here to decide should be riichi called or not | ||
:return: boolean | ||
""" | ||
return False | ||
|
||
def should_call_kan(self, tile, is_open_kan): | ||
""" | ||
When bot can call kan or chankan this method will be called | ||
:param tile: 136 tile format | ||
:param is_open_kan: boolean | ||
:return: kan type (Meld.KAN, Meld.CHANKAN) or None | ||
""" | ||
return False | ||
|
||
def try_to_call_meld(self, tile, is_kamicha_discard): | ||
""" | ||
When bot can open hand with a set (chi or pon/kan) this method will be called | ||
:param tile: 136 format tile | ||
:param is_kamicha_discard: boolean | ||
:return: Meld and DiscardOption objects or None, None | ||
""" | ||
return None, None | ||
|
||
def enemy_called_riichi(self, enemy_seat): | ||
""" | ||
Will be called after other player riichi | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...ect/mahjong/ai/defence/impossible_wait.py → .../first_version/defence/impossible_wait.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
project/mahjong/ai/defence/kabe.py → ...ect/game/ai/first_version/defence/kabe.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.