INDAPlus21 / INDAPlus21/ogronman-chess
Pass
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Superbra jobbat!!!
However, I failed to compile you library. I judge this to be a case of "but it works on my machine".
error[E0277]: the type `[Vec<u8>]` cannot be indexed by `u8`
--> src\lib.rs:375:16
|
375 | if self.board[possible_moves[_i as usize][0]][1] == _BLACK {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Vec<u8>]>` is not implemented for `u8`
= note: required because of the requirements on the impl of `Index<u8>` for `Vec<Vec<u8>>`
error[E0277]: the type `[Vec<u8>]` cannot be indexed by `u8`
--> src\lib.rs:376:20
|
376 | if self.board[possible_moves[_i as usize][1]][1] == _WHITE {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Vec<u8>]>` is not implemented for `u8`
= note: required because of the requirements on the impl of `Index<u8>` for `Vec<Vec<u8>>`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
error: could not compile `ogronman-chess`
Tips: It is more efficient to search for check from the perspective of the king, rather than that from the opponent's pieces.
Your approach of defining position as Vec<u8> is slow, as it utilises heap memory. The sized type [u8; 2] or (u8, u8) is much quicker.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the project and inspect src/lib.rs around lines 375-376, where the reported indexing errors occur. Confirm the indexing types and rerun the build; done means ogronman-chess compiles without the two E0277 errors. The issue also notes possible position-representation and check-search optimizations, which may require separate investigation.
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
- 45/100