Skip to content

London 9-Hengameh Mohammadkhani-TIC Tac Toe Terminal #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions board-printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,31 @@
Test your function by calling it with an example tic-tac-toe board.
*/
export function printBoard(board) {
for (let row of board) {



const colOne = row[0]
const colTwo = row[1]
const colThree = row[2]

console.log(` ${colOne.replace("_"," ")} | ${colTwo.replace("_"," ")} | ${colThree.replace("_"," ")} `)
console.log("===============")

}

}

let board = [
['X', '_', '_'],
['_', 'X', '_'],
['O', 'O', 'X']
];

printBoard(board)



/*
Given a tic-tac-toe board (an array of arrays),
- return true if there are no moves left to make (there are no more '_' values)
Expand Down
130 changes: 1 addition & 129 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.