On February 16, 2023, I became the first human being to play a complete game of shogi (Japanese chess) against ChatGPT. I listed all the legal moves on each ChatGPT's turn and let them choose their move. I uploaded the game (kifu) to Lishogi https://lishogi.org/pma1myEC and Shogi Playground https://kifu.co/Zw7L (also included at the end of this paper).
How I played against ChatGPT
----------------------------
My MacOS had the `python3` command installed. I installed the python-shogi library and used the Python shell to input and generate moves:
% pip3 install python-shogi
% python3
First I loaded the library and generated the 30 possible first moves in random order:
Let's play shogi. For each of your turns, I will list all the legal moves you can play in random order, in Universal Shogi Interface (USI) format. Choose one of them. Say only the move you want to play. Don't say anything else. No handicap, even game. You are black (sente, the player who moves first).
After some thought, I decided to respond with 3c3d. I entered their move and mine into python-shogi, displayed the resulting position, and generated the next possible moves for ChatGPT in random order:
>>> board.push_usi("2g2f"); board.push_usi("3c3d"); print(board); moves = list(map(str, board.legal_moves)); shuffle(moves); print(*moves, sep=", ")
Move.from_usi('2g2f')
Move.from_usi('3c3d')
l n s g k g s n l
. r . . . . . b .
p p p p p p . p p
. . . . . . p . .
. . . . . . . . .
. . . . . . . P .
P P P P P P P . P
. B . . . . . R .
L N S G K G S N L
5i5h, 2h2g, 3i3h, 7i6h, 2h7h, 8g8f, 2h6h, 6i6h, 2h5h, 1g1f, 3i4h, 7g7f, 5i6h, 6i7h, 9g9f, 2h1h, 2h3h, 4i5h, 2f2e, 3g3f, 6g6f, 6i5h, 9i9h, 4i4h, 4i3h, 5g5f, 4g4f, 5i4h, 2h4h, 1i1h, 7i7h
It's your turn. Don't list moves. That's what I do. Say only the move you want to play. Don't say anything else. Choose one of them.
every time. (Sometimes they started listing moves or responded as if I was consulting them about moves.) I created a shared link to the chat https://chat.openai.com/share/f406a004-ca2c-449d-b2ca-869f722dd458 and also uploaded the log to Pastebin https://pastebin.com/7qirN6mp. [^1]
The game
--------
I uploaded the game to Lishogi etc. as linked at the beginning. Below can be read by GNU XShogi.
To install XShogi on MacOS Monterey, install Homebrew and run `brew install xshogi`. However, when I run `xshogi`, I got "Error: Can't open display: ". I have to install XQuartz with `brew install --cask xquartz`, launch it from Launchpad, go to Applications > Customize... to open the X11 Application Menu, press Add Item, add the `xshogi` command with the name "XShogi" (or whatever), and go to Applications > XShogi to launch it.
Notes
-----
[^1]: It was generated by running the following JavaScript code in the Brave (i.e., Chromium) console on the chat page. As of ChatGPT Feb 13 version it renders the conversation into div elements with the `whitespace-pre-wrap` class. (This may not work in the future.)