INDAPlus21 / INDAPlus21/alholmbe-chess-gui

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

**Very well done Alexander!**

_Scharre_; the game where `GREENWHITE` is a shade of yellow!

An idea:
_Your code_:
```rust
match _col % 2 {
0 => {
if _row % 2 == 0 {
if is_a_move {
GREENWHITE
} else {
WHITE
}
} else {
if is_a_move {
GREENBLACK
} else {
BLACK
}
}
}
_ => {
if _row % 2 == 0 {
if is_a_move {
GREENBLACK
} else {
BLACK
}
} else {
if is_a_move {
GREENWHITE
} else {
WHITE
}
}
}
}
```
_Shorter code_:
```rust
match (is_a_move, (_col + _row) % 2 == 0) {
(true, true) => GREENWHITE,
(true, false) => GREENBLACK,
(false, true) => WHITE,
(false, false) => BLACK
}
```

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

Search the Rust codebase for the shown match on _col, _row, and is_a_move. Compare the current behavior with the shorter match expression, then apply the equivalent simplification if appropriate. Done means the color-selection behavior remains unchanged while the duplicated branching is reduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Refactor
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.