Skip to content
Snippets Groups Projects
Commit 1aa2f4e7 authored by Michael Hauspie's avatar Michael Hauspie
Browse files

Simple board and display

parents
Branches
Tags
No related merge requests found
/target
[package]
name = "intro-rust-game"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
struct TicTacToe {
board: [char; 9]
}
fn display(board: TicTacToe) {
println!(" {} | {} | {}",
board.board[0],
board.board[1],
board.board[2]);
println!("---+---+--");
println!(" {} | {} | {}",
board.board[3],
board.board[4],
board.board[5]);
println!("---+---+---");
println!(" {} | {} | {}",
board.board[6],
board.board[7],
board.board[8]);
}
fn main() {
let board = TicTacToe {
board: ['.'; 9]
};
display(board);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment