INDAPlus21 / INDAPlus21/azeezd-chess

Pass

Open
#1 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

**Superbra jobbat!**

You impress me with your commentary!

However, I failed to compile your library. I judge this as a "but it works on my machine" moment.

Console detailes

```rust
error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:69:26
|
69 | for direction in DIRECTIONS {
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:69:26
|
69 | for direction in DIRECTIONS {
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:79:30
|
79 | for direction in DIRECTIONS {
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:79:30
|
79 | for direction in DIRECTIONS {
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:98:28
|
98 | for direction_x in DIRECTIONS { // front and back
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:98:28
|
98 | for direction_x in DIRECTIONS { // front and back
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:99:32
|
99 | for direction_y in DIRECTIONS { // left and right
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:99:32
|
99 | for direction_y in DIRECTIONS { // left and right
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:119:28
|
119 | for direction_y in DIRECTIONS { // up and down
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:119:28
|
119 | for direction_y in DIRECTIONS { // up and down
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:120:32
|
120 | for direction_x in DIRECTIONS { // left and right
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:120:32
|
120 | for direction_x in DIRECTIONS { // left and right
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:147:21
|
147 | for axis in DIRECTIONS { // Horizontal -1 or Vertical 1
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:148:30
|
148 | for direction in DIRECTIONS { // left & right for horizontal, up & down for vertical
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:147:21
|
147 | for axis in DIRECTIONS { // Horizontal -1 or Vertical 1
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\board_moves.rs:148:30
|
148 | for direction in DIRECTIONS { // left & right for horizontal, up & down for vertical
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:62:26
|
62 | for direction in DIRECTIONS {
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:62:26
|
62 | for direction in DIRECTIONS {
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:71:26
|
71 | for direction in DIRECTIONS {
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:71:26
|
71 | for direction in DIRECTIONS {
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:94:28
|
94 | for direction_x in DIRECTIONS { // front and back
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:94:28
|
94 | for direction_x in DIRECTIONS { // front and back
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:95:32
|
95 | for direction_y in DIRECTIONS { // left and right
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:95:32
|
95 | for direction_y in DIRECTIONS { // left and right
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:113:28
|
113 | for direction_y in DIRECTIONS { // up and down
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:113:28
|
113 | for direction_y in DIRECTIONS { // up and down
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:114:32
|
114 | for direction_x in DIRECTIONS { // left and right
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:114:32
|
114 | for direction_x in DIRECTIONS { // left and right
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:139:21
|
139 | for axis in DIRECTIONS { // Horizontal -1 or Vertical 1
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:139:21
|
139 | for axis in DIRECTIONS { // Horizontal -1 or Vertical 1
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:140:30
|
140 | for direction in DIRECTIONS { // left & right for horizontal, up & down for vertical
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error[E0277]: `[i8; 2]` is not an iterator
--> src\chess\threat_map.rs:140:30
|
140 | for direction in DIRECTIONS { // left & right for horizontal, up & down for vertical
| ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
|
= help: the trait `Iterator` is not implemented for `[i8; 2]`
= note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
= note: required because of the requirements on the impl of `IntoIterator` for `[i8; 2]`
= note: required by `into_iter`

error: aborting due to 16 previous errors

For more information about this error, try `rustc --explain E0277`.
error: could not compile `azeezd-chess`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: aborting due to 16 previous errors

For more information about this error, try `rustc --explain E0277`.
error: build failed
```

Also, it is more efficient to check for threats from the perspective of the king in question, rather than from that of all of the opponent's pieces. Additionally, I'm also curious of why you are searching for check every time `GameState` has to be returned, instead of generating threat maps only after a turn has been made.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the compilation check and inspect the reported loops in src/chess/board_moves.rs and src/chess/threat_map.rs. Review the compiler guidance for the DIRECTIONS iterations at the listed lines, then rerun the compilation check; done means the library compiles without these iterator errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.