X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=base_rules.js;h=f9913c44bea0be04c6ba049fed65c97a18053492;hb=55d3b31f34f6b29f089db5723caf552ebf091905;hp=7dc134d0a8b0cfadc2b38a346f42597ca032fd2d;hpb=10c9010b3b04915e132b6b3820f2f19c9ea6dcf0;p=xogo.git diff --git a/base_rules.js b/base_rules.js index 7dc134d..f9913c4 100644 --- a/base_rules.js +++ b/base_rules.js @@ -286,9 +286,9 @@ export default class ChessRules { // Position part of the FEN string getPosition() { let position = ""; - for (let i = 0; i < this.size.y; i++) { + for (let i = 0; i < this.size.x; i++) { let emptyCount = 0; - for (let j = 0; j < this.size.x; j++) { + for (let j = 0; j < this.size.y; j++) { if (this.board[i][j] == "") emptyCount++; else { @@ -303,7 +303,7 @@ export default class ChessRules { if (emptyCount > 0) // "Flush remainder" position += C.FenEmptySquares(emptyCount); - if (i < this.size.y - 1) + if (i < this.size.x - 1) position += "/"; //separate rows } return position;