mirror of https://github.com/01-edu/public.git
docs(queens) correct grammar
This commit is contained in:
parent
167027b977
commit
11fd9f5513
|
@ -2,21 +2,18 @@
|
|||
|
||||
### Instructions
|
||||
|
||||
In a chess game, a queen can attack pieces which are on the same rank, file, or diagonal.
|
||||
In a chess game, a queen can attack pieces which are on the same rank (row), file (column), or diagonal.
|
||||
|
||||
The purpose of this exercise is to find out if two queens can attack each other using the same rules.
|
||||
The purpose of this exercise is to find out if two queens can attack each other.
|
||||
|
||||
The chess board will be represented by the struct `ChessPosition`. You must implement the function `new`
|
||||
that allows you to verify if the position is valid or not. If the position is valid the function will return that
|
||||
position, otherwise it will return `None`.
|
||||
The position of a chess piece on a chessboard will be represented by the struct `ChessPosition`. You must implement the associated function `new` which will return the position if it is valid, otherwise it will return `None`.
|
||||
> Remember, chessboards have 8 files and 8 ranks (each from 0 to 7).
|
||||
|
||||
So, given the position of the two queens on a chess board, you will have to
|
||||
implement the function `can_attack` in the given struct `Queen` with
|
||||
the purpose of finding out whether the two queens can attack each other or not. You also need to implement the function `new`
|
||||
that allows you to create a new `Queen` given a ChessPosition.
|
||||
You will create the `Queen` struct with the associate function `can_attack`, which will return `true` if the queens can attack each other or not. You also need to implement the function `new` which creates a new `Queen` with a `ChessPosition`.
|
||||
|
||||
For example, if the white queen is at (2, 3) and the black queen is at (5, 6),
|
||||
then the set-up would be like so:
|
||||
### Example
|
||||
|
||||
If the white queen is at (2, 3) and the black queen is at (5, 6), then the set-up would be like the below. In this case, the two queens can attack each other because both pieces share a diagonal:
|
||||
|
||||
```
|
||||
_ _ _ _ _ _ _ _
|
||||
|
@ -29,8 +26,6 @@ _ _ _ _ _ _ _ _
|
|||
_ _ _ _ _ _ _ _
|
||||
```
|
||||
|
||||
In this case, the two queens can attack each other because both pieces share a diagonal.
|
||||
|
||||
### Expected Function and Structures
|
||||
|
||||
```rust
|
||||
|
|
Loading…
Reference in New Issue