-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pengfei Chen
committed
Oct 3, 2023
1 parent
fc5653e
commit aaab410
Showing
2 changed files
with
65 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,46 @@ | ||
|
||
def print_board(): | ||
num_rows = 10 | ||
board_string = ""; | ||
board_string += " "; | ||
for col in 'abcdefghi': | ||
board_string += " %c"%col | ||
board_string += "\n"; | ||
board_string = "" | ||
board_string += " " | ||
for col in "abcdefghi": | ||
board_string += " %c" % col | ||
board_string += "\n" | ||
for row in range(num_rows): | ||
board_string += "%d "%row; | ||
for col in 'abcdefghi': | ||
# board_string += "车" | ||
# board_string += ". " | ||
board_string += "R " | ||
# board_string += PieceAt(col, row).symbol() | ||
# Piece p = pieceAt(col, row); | ||
# if p == null: | ||
# board_string += " ."; | ||
# else: | ||
# switch (p.rank) { | ||
# case ROOK: board_string += p.isRed ? " R" : " r"; break; | ||
# case KNIGHT: board_string += p.isRed ? " N" : " n"; break; | ||
# case BISHOP: board_string += p.isRed ? " B" : " b"; break; | ||
# case GUARD: board_string += p.isRed ? " G" : " g"; break; | ||
# case KING: board_string += p.isRed ? " K" : " k"; break; | ||
# case CANNON: board_string += p.isRed ? " C" : " c"; break; | ||
# case PAWN: board_string += p.isRed ? " P" : " p"; break; | ||
# } | ||
board_string += " %d\n"%row | ||
board_string += "%d " % row | ||
for col in "abcdefghi": | ||
# board_string += "车" | ||
# board_string += ". " | ||
board_string += "R " | ||
# board_string += PieceAt(col, row).symbol() | ||
# Piece p = pieceAt(col, row); | ||
# if p == null: | ||
# board_string += " ."; | ||
# else: | ||
# switch (p.rank) { | ||
# case ROOK: board_string += p.isRed ? " R" : " r"; break; | ||
# case KNIGHT: board_string += p.isRed ? " N" : " n"; break; | ||
# case BISHOP: board_string += p.isRed ? " B" : " b"; break; | ||
# case GUARD: board_string += p.isRed ? " G" : " g"; break; | ||
# case KING: board_string += p.isRed ? " K" : " k"; break; | ||
# case CANNON: board_string += p.isRed ? " C" : " c"; break; | ||
# case PAWN: board_string += p.isRed ? " P" : " p"; break; | ||
# } | ||
board_string += " %d\n" % row | ||
board_string += " " | ||
for col in 'abcdefghi': | ||
board_string += " %c"%col | ||
for col in "abcdefghi": | ||
board_string += " %c" % col | ||
print(board_string) | ||
|
||
|
||
print_board() | ||
|
||
from colorama import Fore, Back, Style | ||
print(Fore.RED + 'some red text') | ||
|
||
print(Fore.RED + "some red text") | ||
from colorama import Fore, Back, Style | ||
print(Fore.RED + 'some red text') | ||
print(Back.GREEN + 'and with a green background') | ||
print(Style.DIM + 'and in dim text') | ||
|
||
print(Fore.RED + "some red text") | ||
print(Back.GREEN + "and with a green background") | ||
print(Style.DIM + "and in dim text") | ||
print(Style.RESET_ALL) | ||
print('back to normal now') | ||
print("back to normal now") |