diff --git a/lib/chessBoard.ts b/lib/chessBoard.ts index 8a812fd..a9a5572 100644 --- a/lib/chessBoard.ts +++ b/lib/chessBoard.ts @@ -21,4 +21,21 @@ function chessBoard(size: number) { console.log(output) } -chessBoard(8); +function chessBoardAthorSolution(size: number) { + let board = ""; + + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + if ((x + y) % 2 == 0) + board += " "; + else + board += "#"; + } + board += "\n"; + } + + console.log(board) + +} + +chessBoardAthorSolution(10);