/tic-tac-toe

tic-tac-toe in rust

Primary LanguageRustMIT LicenseMIT

Tic Tac Toe in Rust

After reading through "the book" as I've started learning rust, I thought a good starting place for applying what I've learned is building a tic-tac-toe game. The program is also an excuse for me to try using box drawing characters.

Launching the program

$ git clone git@github.com:pattrickrice/tic-tac-toe.git
$ cargo run
➜  tic-tac-toe git:(master) cargo run             
   Compiling tic-tac-toe v0.1.0 (/home/patrick/tic-tac-toe)
    Finished dev [unoptimized + debuginfo] target(s) in 0.71s
     Running `target/debug/tic-tac-toe`
┌───┬───┬───┐
│   │   │   │
├───┼───┼───┤
│   │   │   │
├───┼───┼───┤
│   │   │   │
└───┴───┴───┘

Turn X: Enter [row, col]: 

Room for improvement

Here's a list of known places where this program could be improved in case I decide I want to put more free time into it.

  1. I'm sure the code could use a refactor.
  2. Unit tests
  3. Integration tests
  4. GitHub ci
  5. n-curses-like terminal rendering (n-curses only has bindings on linux?)
  6. Minimal AI; maybe something that just chooses a random available square.