From f11770b7da4e7fc83cbba6b815f238d6c6ce5a2c Mon Sep 17 00:00:00 2001 From: davhojt Date: Mon, 23 May 2022 12:58:49 +0300 Subject: [PATCH] docs(tic_tac_toe): correct grammar --- subjects/tic_tac_toe/README.md | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/subjects/tic_tac_toe/README.md b/subjects/tic_tac_toe/README.md index 5f1084a6..0eb77f83 100644 --- a/subjects/tic_tac_toe/README.md +++ b/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>). - - 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>) -> 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>) -> bool { } @@ -41,7 +26,7 @@ pub fn vertical(player: &str, table: &Vec>) -> 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)