rust-cli-arcade 0.1.0

A collection of classic CLI games: Tic-Tac-Toe, Connect Four, Hangman, and Rock Paper Scissors

mod connectfour;
mod hangman;
mod rps;
mod tictactoe;

use std::io::{self, Write};

fn main() {
    println!("Welcome to the Rust CLI Arcade!");
    loop{
        println!("Select a game");
        println!("Multiplayer games:");
        println!("1) Tic Tac Toe");
        println!("2) Connect Four");
        println!("Single player games:");
        println!("3) Rock Paper Scissors vs CPU");
        println!("4) Hangman");
        println!("5) Exit");
        io::stdout().flush().unwrap();
        
        let mut choice = String::new();
        io::stdin().read_line(&mut choice).unwrap();
        
        match choice.trim() {
            "1" => tictactoe::play(),
            "2" => connectfour::play(),
            "3" => rps::play(),
            "4" => hangman::play(),
            "5" => {
                println!("Thanks for playing!");
                break;
            }
            _ => println!("Invalid choice, please try again."),
        }
    }
}