Answers.Body: <p>I don't know how you would do that in gnuchess, but you could do little programming yourself in Python. This <a href="https://pypi.python.org/pypi/python-chess" rel="nofollow noreferrer">Python package</a> would do that for you. It's main page has what you want:</p>
  
  <pre><code>&gt;&gt;&gt; board.push_san("e4")
  Move.from_uci('e2e4')
  &gt;&gt;&gt; board.push_san("e5")
  Move.from_uci('e7e5')
  </code></pre>
  
  <p>You have the move string and chess board. It shouldn't be hard for you.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-09T23:35:03.900Z
Answers.LastActivityDate: 2018-04-09T23:35:03.900Z
Answers.UserDisplayName: SmallChess
Answers.Body: <p>The simplest I can think of is to generate all moves that would end on the destination square then scan the board to find the piece that moved there.  The difference is that pawn moves would have to be programmed to correct for the direction, ep, and double move.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-10T02:04:11.820Z
Answers.LastActivityDate: 2018-04-10T02:04:11.820Z
Answers.UserDisplayName: Fred Knight
Body: <p>I'm using gnuchess to decide which move a program should make, and I'm using its output to control a robot arm (to execute the move on a real board).</p>
  
  <p>However, gnuchess outputs SAN (Standard Algebraic Notation), such as "Nf3". To control the robot arm, it would be much more helpful to have a coordinate-based notation, such as "g1-f3".</p>
  
  <p>My question is:</p>
  
  <ol>
  <li>Is there a way to get gnuchess to output coordinate-based notation? I know it can accept such notation as input (human-supplied move).</li>
  </ol>
  
  <p>-or-</p>
  
  <ol start="2">
  <li>Is there existing software (or detailed algorithm) that takes
   (a) a SAN move
   (b) a .eps board
  and produces:
   (c) a coordinate-based move?</li>
  </ol>
  
  <p>I use Linux, and here is how I get gnuchess to make its (SAN) move recommendation:</p>
  
  <p>Use gnuchess to decide on next move.</p>
  
  <ol>
  <li>reads current position from file named $1 (.epd format)</li>
  <li>decides what move to make (as white), using gnuchess</li>
  <li>prints out move</li>
  <li><p>also stores resulting board in dgt.chess.nextpos (.epd format)</p>
  
  <pre><code>rm -f dgt.chess.nextpos
  
  printf "solveepd $1\nepdsave dgt.chess.nextpos\nquit\n" |\
  gnuchess |\
  grep -a 'My move is' |\
  sed 's/My move is : //'
  </code></pre></li>
  </ol>
  
Tags: <programming><notation>
Title: Coordinate-style move output from chess engine, to control robot
ThreadText: # Coordinate-style move output from chess engine, to control robot
  
  (Asked by: username_0 on 2018-04-09)
  
  I'm using gnuchess to decide which move a program should make, and I'm using its output to control a robot arm (to execute the move on a real board).
  
  However, gnuchess outputs SAN (Standard Algebraic Notation), such as "Nf3". To control the robot arm, it would be much more helpful to have a coordinate-based notation, such as "g1-f3".
  
  My question is:
  
  1. Is there a way to get gnuchess to output coordinate-based notation? I know it can accept such notation as input (human-supplied move).
  
  -or-
  
  2. Is there existing software (or detailed algorithm) that takes
     (a) a SAN move
     (b) a .eps board
     and produces:
     (c) a coordinate-based move?
  
  I use Linux, and here is how I get gnuchess to make its (SAN) move recommendation:
  
  Use gnuchess to decide on next move.
  
  1. reads current position from file named $1 (.epd format)
  2. decides what move to make (as white), using gnuchess
  3. prints out move
  4. also stores resulting board in dgt.chess.nextpos (.epd format)
  
     ```
     rm -f dgt.chess.nextpos
  
     printf "solveepd $1\nepdsave dgt.chess.nextpos\nquit\n" |\
     gnuchess |\
     grep -a 'My move is' |\
     sed 's/My move is : //'
  
     ```
  
  **Tags:** programming, notation
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-04-09. Score: 1 | Accepted answer
  
  I don't know how you would do that in gnuchess, but you could do little programming yourself in Python. This [Python package](https://pypi.python.org/pypi/python-chess) would do that for you. It's main page has what you want:
  
  ```
  >>> board.push_san("e4")
  Move.from_uci('e2e4')
  >>> board.push_san("e5")
  Move.from_uci('e7e5')
  
  ```
  
  You have the move string and chess board. It shouldn't be hard for you.
  
  
  ---
  
  ### Answer by username_2 on 2018-04-10. Score: 0
  
  The simplest I can think of is to generate all moves that would end on the destination square then scan the board to find the piece that moved there. The difference is that pawn moves would have to be programmed to correct for the direction, ep, and double move.
  
  
  ---
  
  