Conversation
There was a problem hiding this comment.
Code Review
This pull request implements 'ORTHO', a CLI board game where players alternate turns selecting rows and columns on an N×N grid. The submission includes the game engine, board representation, and a command-line interface. The review identifies critical issues regarding invalid project metadata in Cargo.toml and the use of unstable Rust features. Further improvements are suggested for board memory layout efficiency, idiomatic iterator usage, and more robust error handling for standard I/O.
src/main.rs
Outdated
| None => "Choose any row or column".to_string(), | ||
| }; | ||
| print!("{} - {} > ", player.id.name(), constraint_msg); | ||
| io::stdout().flush().unwrap(); |
There was a problem hiding this comment.
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial Rust implementation of the ORTHO CLI board game, including core game logic (board, turns, win detection), a terminal renderer, input parsing, and GitHub Actions workflows for build/lint/test and SPDX checks.
Changes:
- Added core game engine modules (
board,game,player,types) with unit tests. - Implemented CLI loop + input parsing and a text-based board renderer.
- Added Rust project metadata (
Cargo.toml/Cargo.lock), documentation (README.md), and CI workflows (build/lint/test/SPDX).
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.rs | Defines core enums/structs (axis/cell/player/errors) used across the game. |
| src/player.rs | Stores per-player selection state and axis constraint derivation. |
| src/board.rs | Implements board storage and win/full/empty-along checks with tests. |
| src/game.rs | Implements turn processing, skip logic, and win detection with tests. |
| src/input.rs | Parses user input into selections/quit commands with tests. |
| src/display.rs | Renders the board and current selections to the terminal. |
| src/main.rs | CLI entrypoint wiring together parsing, rendering, turn loop, and messaging. |
| README.md | Documents rules, usage, and an example session. |
| Cargo.toml | Declares crate metadata, MSRV, and dependencies (clap). |
| Cargo.lock | Locks dependency graph for reproducible builds. |
| .github/workflows/test.yml | Adds CI test workflow across toolchains and architectures. |
| .github/workflows/build.yml | Adds CI build workflow across toolchains and architectures. |
| .github/workflows/lint.yml | Adds rustfmt + clippy workflows. |
| .github/workflows/spdx.yml | Adds SPDX license header checking. |
| .gitattributes | Enforces LF normalization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| loop { | ||
| let sels = Selections { | ||
| p1: game.players[0].last_selection, | ||
| p2: game.players[1].last_selection, | ||
| }; | ||
| render_board(&game.board, &sels); | ||
| println!(); | ||
|
|
||
| // Auto-skip if no valid completion exists | ||
| if let Some(TurnResult::Skipped) = game.check_skip() { | ||
| println!( | ||
| "{} - No valid placement available. Turn skipped, selection cleared.\n", | ||
| game.current().id.name() | ||
| ); | ||
| game.switch_player(); | ||
| continue; |
There was a problem hiding this comment.
check_skip() can clear the current player's selection, but the board is rendered before this call and sels is built from the pre-skip state. When a skip happens, the UI will show stale selection markers even though the message says the selection was cleared. Consider moving the check_skip() block before constructing sels/calling render_board, or re-rendering the board after a skip so the displayed state matches the game state.
Signed-off-by: Takuma IMAMURA <209989118+hyperfinitism@users.noreply.github.com>
d9d7da9 to
736eb59
Compare
This pull request introduces the initial implementation of a Rust-based board game called "ORTHO" along with supporting infrastructure for building, testing, linting, and license checking.