
from pyogi.board import Board
from pyogi.plot import plot_board


if __name__ == '__main__':

    board = Board()
    board.set_initial_state()

    board.players = ['先手', '後手']

    board.move('+7776FU')
    board.move('-3334FU')
    board.move('+2868HI')
    board.move('-2288UM')
    board.move('+7988GI')

    # Plot by materials
    plot_board(board, savepath='example_pic.png', mode='pic')

    # Plot using matplotlib
    board.plot_state_mpl(figsize=(8, 9))


import os
from pyogi.board import Board
from pyogi.plot import plot_board


if __name__ == '__main__':

    board = Board()
    board.set_initial_state()

    board.players = ['先手', '後手']

    board.move('+7776FU')
    board.move('-3334FU')
    board.move('+2868HI')
    board.move('-2288UM')
    board.move('+7988GI')

    # Plot by materials
    savepath = 'example_pic.png'
    if os.path.exists(savepath):
        savepath = None

    plot_board(board, savepath=savepath, mode='pic')

    # Plot using matplotlib
    board.plot_state_mpl(figsize=(8, 9))

Disable output example_pic.png if exists
Disable output example_pic.png if exists

  
+ import os
  from pyogi.board import Board
  from pyogi.plot import plot_board
  
  
  if __name__ == '__main__':
  
      board = Board()
      board.set_initial_state()
  
      board.players = ['先手', '後手']
  
      board.move('+7776FU')
      board.move('-3334FU')
      board.move('+2868HI')
      board.move('-2288UM')
      board.move('+7988GI')
  
      # Plot by materials
+     savepath = 'example_pic.png'
+     if os.path.exists(savepath):
+         savepath = None
+ 
-     plot_board(board, savepath='example_pic.png', mode='pic')
+     plot_board(board, savepath=savepath, mode='pic')
  
      # Plot using matplotlib
      board.plot_state_mpl(figsize=(8, 9))
  
Disable output example_pic.png if exists
## Code Before:

from pyogi.board import Board
from pyogi.plot import plot_board


if __name__ == '__main__':

    board = Board()
    board.set_initial_state()

    board.players = ['先手', '後手']

    board.move('+7776FU')
    board.move('-3334FU')
    board.move('+2868HI')
    board.move('-2288UM')
    board.move('+7988GI')

    # Plot by materials
    plot_board(board, savepath='example_pic.png', mode='pic')

    # Plot using matplotlib
    board.plot_state_mpl(figsize=(8, 9))

## Instruction:
Disable output example_pic.png if exists
## Code After:

import os
from pyogi.board import Board
from pyogi.plot import plot_board


if __name__ == '__main__':

    board = Board()
    board.set_initial_state()

    board.players = ['先手', '後手']

    board.move('+7776FU')
    board.move('-3334FU')
    board.move('+2868HI')
    board.move('-2288UM')
    board.move('+7988GI')

    # Plot by materials
    savepath = 'example_pic.png'
    if os.path.exists(savepath):
        savepath = None

    plot_board(board, savepath=savepath, mode='pic')

    # Plot using matplotlib
    board.plot_state_mpl(figsize=(8, 9))
