100-days-of-rust/Week-08/Day-50_Tic-Tac-Toe/README.md

24 lines
537 B
Markdown
Raw Normal View History

2023-03-24 01:14:34 +00:00
# Tic Tac Toe
Create a function that takes an array of char inputs from a _Tic Tac Toe_ game. Inputs will be taken from player1 as **"X"**, player2 as **"O"**, and empty spaces as **"#"**. The program will return the winner or tie results.
## Examples
```text
ticTacToe([
["X", "O", "O"],
["O", "X", "O"],
["O", "#", "X"]
]) ➞ "Player 1 wins"
ticTacToe([
["X", "O", "O"],
["O", "X", "O"],
["X", "#", "O"]
]) ➞ "Player 2 wins"
ticTacToe([
["X", "X", "O"],
["O", "X", "O"],
["X", "O", "#"]
]) ➞ "It's a Tie"
```