-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Quantum Chinese Chess] Improve chess board printing #176
Conversation
madcpf
commented
Jan 31, 2024
•
edited
Loading
edited
- Print the board with sampled probabilities.
- For proper print, different treatment is made for English vs Chinese and Sublime terminus vs mac/gLinux terminal.
Not sure why some other files fail Lint check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool improvement, but let's make sure its portable!
@@ -28,6 +28,20 @@ | |||
# The default initial state of the game. | |||
_INITIAL_FEN = "RHEAKAEHR/9/1C5C1/P1P1P1P1P/9/9/p1p1p1p1p/1c5c1/9/rheakaehr w---1" | |||
|
|||
# Constants for printing board | |||
_RESET = "\033[0m" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does all this work in colab? I'm not sure how portable all these unix terminal codes are. If it works in colab though, that's probably good enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Doug, yes I just checked that it works in cola, with https://colab.research.google.com/drive/1B-7LmTN_gL4T1akVqUtoYO5dwzK_3IVK?usp=sharing, but replaced the files with this PR.
print_probabilities=True, | ||
peek_result: List[int] = None, | ||
sublime_terminus: bool = True, | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add docstring for the arguments. It particular, I am not sure what sublime_terminus is? Is it a specific terminal app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Doug. It's added. Sublime Text is a handy editor, while Sublime Terminus is its integrated terminal.
probabilities: List[float] = None, | ||
print_probabilities=True, | ||
peek_result: List[int] = None, | ||
sublime_terminus: bool = True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider making this an enum rather than a bool, and add a plain option, such as:
class TerminalType(enum.Enum):
PLAIN_ASCII = 0
MAC_AND_LINUX = 1
SUBLIME_TERMINUS = 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Doug. I just added MAC_OR_LINUX and SUBLIME_TERMINUS_OR_COLAB (since it turns out that colab handles full width chars in a similar way as sublime terminus). What do you mean about plain ascii?