Browse Source

docs(tic_tac_toe): correct grammar

DEV-3198-new-go-exercise-get-digit-len
davhojt 2 years ago committed by Dav Hojt
parent
commit
f11770b7da
  1. 33
      subjects/tic_tac_toe/README.md

33
subjects/tic_tac_toe/README.md

@ -2,33 +2,18 @@
### Instructions
You must create a `tic tac toe` checker.
Create the following functions:
- `tic_tac_toe` which receives:
- a table of vectors (Vec<Vec<&str>>).
- It should return a String `player O won` or `player X won` or `Tie`.
- `diagonals` which will receive:
- a player and a table.
- It should return a boolean, this must return `true` if one of the diagonals are completed by the player.
- `horizontal` which will receive:
- a player and a table.
- It should return a boolean, this must return `true` if one of the horizontal lines are completed by the player.
- `vertical` which will receive:
- a player and a table.
- It should return a boolean, this must return `true` if one of the vertical lines are completed by the player.
You must create some functions for a tic-tac-toe checker.
### Notions
- [references and borrowing](https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html)
### Expected Functions
Create a function named `tic_tac_toe`, which receives a tic-tac-toe table. It should return the appropriate string: `"player O won"`, `"player X won"` or `"Tie"`.
```rust
pub fn tic_tac_toe(table: Vec<Vec<&str>>) -> String {
}
```
Also create the following functions, which each accept a player and a table. These functions should return `true` if the player has completed one of the diagonals, rows or columns:
```rust
pub fn diagonals(player: &str, table: &Vec<Vec<&str>>) -> bool {
}
@ -41,7 +26,7 @@ pub fn vertical(player: &str, table: &Vec<Vec<&str>>) -> bool {
### Usage
Here is a program to test your function
Here is a program to test your `tic_tac_toe`. You'll need to test the other functions yourself. But they'll probably be useful for implementing your `tic_tac_toe` checker.
```rust
use tic_tac_toe::*;
@ -86,3 +71,7 @@ $ cargo run
"player X won"
$
```
### Notions
- [references and borrowing](https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html)

Loading…
Cancel
Save