Answers.Body: <p>You can do this easily in python using the <a href="https://pypi.org/project/python-chess/" rel="noreferrer">python-chess</a> module and using the <a href="https://python-chess.readthedocs.io/en/latest/core.html#chess.Board.parse_san" rel="noreferrer"><code>parse_san</code> function of <code>chess.Move.</code></a></p>
  
  <p>Let's call the script <code>algebTocoord.py</code>:</p>
  
  <pre><code>import chess
  
  testfen = 'rnbqkb1r/pppppppp/5n2/8/3P4/8/PPP1PPPP/RNBQKBNR w KQkq - 1 2'
  board = chess.Board(testfen)
  algmove = 'Nf3'
  coordmove = str(board.parse_san(algmove))
  print coordmove
  </code></pre>
  
  <p>the printed output is:</p>
  
  <pre><code>'g1f3'
  </code></pre>
  
  <p>This was tested using Python version <code>2.7.16</code> and the <code>0.22.1</code> version of python-chess.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-02T10:08:01.960Z
Answers.LastActivityDate: 2019-07-02T10:08:01.960Z
Answers.UserDisplayName: Ellie
Body: <p>I saw this thread: <a href="https://chess.stackexchange.com/questions/9470/converting-square-notation-to-algebraic-notation-programmatically">Converting square notation to algebraic notation programmatically</a></p>
  
  <p>Unfortunately, it's the reverse of what I need to do.</p>
  
  <p>Given a FEN and an Algebraic move, I need to generate the coordinate notation of said move.</p>
  
  <p>I realize that you need the position (FEN) in order to reverse engineer the starting position of the pawn/piece being moved.</p>
  
  <p>I'm hoping there is some utility or library/function that does this. If not, a description/outline of the basic algorithm would be great too.</p>
  
Tags: <programming><notation>
Title: Converting from Algebraic notation to Coordinate notation
ThreadText: # Converting from Algebraic notation to Coordinate notation
  
  (Asked by: username_0 on 2019-07-02)
  
  I saw this thread: [Converting square notation to algebraic notation programmatically](https://chess.stackexchange.com/questions/9470/converting-square-notation-to-algebraic-notation-programmatically)
  
  Unfortunately, it's the reverse of what I need to do.
  
  Given a FEN and an Algebraic move, I need to generate the coordinate notation of said move.
  
  I realize that you need the position (FEN) in order to reverse engineer the starting position of the pawn/piece being moved.
  
  I'm hoping there is some utility or library/function that does this. If not, a description/outline of the basic algorithm would be great too.
  
  **Tags:** programming, notation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-07-02. Score: 6 | Accepted answer
  
  You can do this easily in python using the [python-chess](https://pypi.org/project/python-chess/) module and using the [`parse_san` function of `chess.Move.`](https://python-chess.readthedocs.io/en/latest/core.html#chess.Board.parse_san)
  
  Let's call the script `algebTocoord.py`:
  
  ```
  import chess
  
  testfen = 'rnbqkb1r/pppppppp/5n2/8/3P4/8/PPP1PPPP/RNBQKBNR w KQkq - 1 2'
  board = chess.Board(testfen)
  algmove = 'Nf3'
  coordmove = str(board.parse_san(algmove))
  print coordmove
  
  ```
  
  the printed output is:
  
  ```
  'g1f3'
  
  ```
  
  This was tested using Python version `2.7.16` and the `0.22.1` version of python-chess.
  
  
  ---
  
  