Crates.io | cnct4game |
lib.rs | cnct4game |
version | 0.2.0 |
source | src |
created_at | 2023-12-16 18:46:40.988055 |
updated_at | 2023-12-26 18:43:23.147135 |
description | A connect 4 game in the command line with custom board sizes |
homepage | https://github.com/AshtonCoates/cnct4game |
repository | https://github.com/AshtonCoates/cnct4game |
max_upload_size | |
id | 1071930 |
size | 15,941 |
Hello! This is a small project I am using to learn rust and experiment with building command line tools. This is a simple game of connect 4 that can be played in the terminal.
As of now, the game can be played locally against another player.
The board size is 6 rows and 7 columns by default, which when cargo build --release
and target/release/cnct4game
is run will be printed to the terminal as an array of zeros
0000000
0000000
0000000
0000000
0000000
0000000
Player 1, choose a column to play in!
Then, a number 1-7 can be chosen, corresponding to the column to play in, and the change will be reflected by an output in the terminal.
When a sequence of 4 is detected, a winning message will be displayed and the script will end. Or, if there are no zeros detected in the board, a stalemate message will be displayed and the script will end.
The size of the board can be changed using the -c
and -r
arguments, for example this command woud start a game with 8 rows and 10 columns
target/release/cnct4game -r 8 -c 10
Currently, the board must be at least 4 rows and 4 columns, or an error message will be printed and the game will not start.