Skip to content

Commit

Permalink
revert unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zyzhang1130 committed May 22, 2024
1 parent 56933fe commit cc568fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/game_gomoku/code/board_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
EMPTY_PIECE = "0"


def board2img(board: np.ndarray, output_dir: str) -> str:
def board2img(board: np.ndarray, save_path: str) -> str:
"""Convert the board to an image and save it to the specified path."""

size = board.shape[0]
Expand Down Expand Up @@ -63,9 +63,9 @@ def board2img(board: np.ndarray, output_dir: str) -> str:
ax.set_xticklabels(range(size))
ax.set_yticklabels(range(size))
ax.invert_yaxis()
plt.savefig(output_dir, bbox_inches="tight", pad_inches=0.1)
plt.savefig(save_path, bbox_inches="tight", pad_inches=0.1)
plt.close(fig) # Close the figure to free memory
return output_dir
return save_path


class BoardAgent(AgentBase):
Expand Down
6 changes: 3 additions & 3 deletions examples/game_gomoku/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"import matplotlib.pyplot as plt\n",
"import matplotlib.patches as patches\n",
"\n",
"def board2img(board: np.ndarray, output_dir: str)->str:\n",
"def board2img(board: np.ndarray, save_path: str)->str:\n",
" size = board.shape[0]\n",
" fig, ax = plt.subplots(figsize=(10, 10))\n",
" ax.set_xlim(0, size - 1)\n",
Expand Down Expand Up @@ -100,9 +100,9 @@
" ax.set_xticklabels(range(size))\n",
" ax.set_yticklabels(range(size))\n",
" ax.invert_yaxis()\n",
" plt.savefig(output_dir, bbox_inches='tight', pad_inches=0.1)\n",
" plt.savefig(save_path, bbox_inches='tight', pad_inches=0.1)\n",
" plt.close(fig) # Close the figure to free memory\n",
" return output_dir"
" return save_path"
],
"metadata": {
"collapsed": false,
Expand Down

0 comments on commit cc568fe

Please sign in to comment.