1
0
mirror of https://github.com/maaslalani/gambit.git synced 2024-12-26 20:54:07 +02:00

doc: add note about flipped flipped

This commit is contained in:
Maas Lalani 2022-01-31 11:19:37 -05:00
parent 630fd8dc1b
commit 197fac15de
No known key found for this signature in database
GPG Key ID: 5A6ED5CBF1A0A000

View File

@ -29,6 +29,15 @@ func Cell(x, y int, flipped bool) string {
col := (x - marginLeft) / cellWidth
row := (y - marginTop) / cellHeight
if !flipped {
// Careful: `flipped` is a bit strange here.
//
// `flipped` represents whether the _chess board_ is flipped.
// Normally, the order of the rows will be from 8 (top) to 1 (bottom).
// If the board is flipped (i.e. black's turn) then the order of the rows
// would be how one would normally print of the rows: 1 (top) to 8 (bottom).
//
// In other words, flipped is flipped. This trade-off is for consistency
// with the other parts of the code base, namely the model.flipped property
row = board.LastRow - row
}
return position.ToSquare(row, col)