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

Function xyToA1

src/gamesbyexample/barca.py:318–321  ·  view source on GitHub ↗

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

(x, y)

Source from the content-addressed store, hash-verified

316
317
318def xyToA1(x, y):
319 """Convert (x, y) coordinates (like 0,0 or 1,4) to user-friendly
320 coordinates (like A1 or B5)."""
321 return chr(x + 65) + str(y + 1) # The ASCII value of 'A' is 65.
322
323
324def A1ToXy(space):

Callers 1

doPlayerMoveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected