Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
run:
working-directory: main/tictactoe_generic
steps:
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Checkout generic
uses: actions/checkout@v4
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
rustflags: ""
- name: Lint
run: |
rustup component add clippy
Expand Down
56 changes: 28 additions & 28 deletions tictactoe_rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tictactoe_rust/clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
allowed-duplicate-crates = ["zerocopy", "zerocopy-derive"]
2 changes: 1 addition & 1 deletion tictactoe_rust/tictactoe_rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tictactoe_rust"
version = "0.1.0"
edition = "2021"
edition = "2024"
authors = ["Jan-Eric <janericnitschke@gmail.com"]
description = "A simple tictactoe game in rust."
readme = "README.md"
Expand Down
14 changes: 11 additions & 3 deletions tictactoe_rust/tictactoe_rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
allow you to play `TicTacToe` alone or with a friend.
*/

use rand::prelude::IndexedRandom;
use rand::Rng;
use rand::prelude::IndexedRandom;
use std::collections;
use std::ops::Neg;
use std::ops::Not;
Expand Down Expand Up @@ -329,11 +329,19 @@ impl TicTacToe {
/// * `col` - An unsigned integer of the column number to make the move on (0 indexed)
fn fix_spot(&mut self, player: char, row: usize, col: usize) -> bool {
if row >= 3 || col >= 3 {
println!("Row {} or column {} are out of bounds. They have to be between 1 and 3 inclusive. Try again!", row+1, col+1);
println!(
"Row {} or column {} are out of bounds. They have to be between 1 and 3 inclusive. Try again!",
row + 1,
col + 1
);
return false;
}
if self.board[row][col] != '-' {
println!("The position ({}, {}) has already been taken by a player! Please do your move on an empty position.", row+1, col+1);
println!(
"The position ({}, {}) has already been taken by a player! Please do your move on an empty position.",
row + 1,
col + 1
);
return false;
}
self.board[row][col] = player;
Expand Down
2 changes: 1 addition & 1 deletion tictactoe_rust/tictactoe_rust_python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tictactoe_rust_python"
version = "0.1.0"
edition = "2021"
edition = "2024"
authors = ["Jan-Eric <janericnitschke@gmail.com"]
description = "A simple tictactoe game in rust for python."
repository = "https://github.com/JanEricNitschke/TicTacToe/tree/main/tictactoe_rust"
Expand Down
Loading