MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / A1ToXy

Function A1ToXy

src/gamesbyexample/barca.py:324–330  ·  view source on GitHub ↗

Convert user-friendly coordinates (like A1 or B5) to (x, y) coordinates (like 0,0 or 1,4).

(space)

Source from the content-addressed store, hash-verified

322
323
324def A1ToXy(space):
325 """Convert user-friendly coordinates (like A1 or B5) to (x, y)
326 coordinates (like 0,0 or 1,4)."""
327 column = space[0]
328 row = space[1:]
329 # The ASCII value of 'A' is 65:
330 return (ord(column) - 65, int(row) - 1)
331
332
333def isWinner(player, board):

Callers 1

doPlayerMoveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected