Notation (model.misc.notation)¶
model.misc.notation
¶
Algebraic coordinate conversion helpers for translating between (row, col) and chess notation.
algebraic_to_pos(algebraic)
¶
Convert an algebraic notation coordinate string to a 0-indexed (row, col) tuple.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algebraic
|
str
|
Coordinate string (e.g. 'e4', 'a1'). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[int, int]
|
Tuple of (row, col) 0-indexed coordinates. |
Source code in src/model/misc/notation.py
pos_to_algebraic(position)
¶
Convert a (row, col) coordinate tuple to standard algebraic notation (e.g. (0, 4) -> 'e1').
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
Tuple[int, int]
|
Tuple of (row, col) 0-indexed coordinates. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Algebraic string notation (e.g. 'e4'). |