neroist / tictactoe

Play Tic Tac Toe against minimax ai

Home Page:https://neroist.github.io/tictactoe/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tic Tac Toe

Play Tic Tac Toe against minimax ai, built with Nim.

Directories

terminal/

terminal/ is the terminal/text version of Tic Tac Toe, use nim c -r tictactoe.nim to compile and run it. May require nimble install termui in the future.

Files

  • tictactoe.nim

    The terminal version of Tic Tac Toe? Not sure what to say here.

    Differences from web version:

    • you can choose whether or not to go first
    • you input moves via inputting the row and column number, not by clicking.

web/

web/ is the website version of Tic Tac Toe, which is released on Github Pages and can be accessed here: https://neroist.github.io/tictactoe/

It contains 3 directories:

  • imgs/, the images & favicon used in the website are kept here
  • js/, the javascript used in the website is contained in here
  • styles/, the css styling used by the website is here

imgs/

  • favicon.ico

    Favicon of the website. Not sure why you wouldn't know but to explain: a favicon is the icon that appears at the top of a browser tab.

js/

script.js/script.min.js is also kept here, when generated. See the gh-pages branch, this directory.

styles/

  • style.css

    The styling for index.html.

  • normalize.min.css

    Stylesheet to make browsers render all elements more consistently.

Other files

Other files not kept in a subdirectory.

  • confetti.nim

    Small Nim bindings of the confetti.min.js file, used in script.nim. Feel free to take and use it for your own projects and such.

  • index.html

    The html page for the website! Its what you see what you go to https://neroist.github.io/tictactoe/.

  • script.nim

    Source code for the Javascript behind the website! The minimax algorithm and game mechanics & such are implemented here! This file is compiled into Javascript for use on the website. You can transpile it into js by running nim js script.nim; the resulting file will be script.js.

  • script.nim.cfg

    Configuration file for the Nim compiler (when compiling script.nim). Sets release define flag and sets backend as js.

Building

Building & compiling this project requires Nim. You can download it here: https://nim-lang.org/install.html OR using choosenim.

Terminal

For terminal/tictactoe.nim, just compiling it and running it with nim c -r tictactoe.nim is good enough. This compiles the code to an executable then runs it. Make sure you're in the terminal/ directory when running that command.

Web

For web/ you need just to transpile the code to JS, then visit index.html. You can transpile the JS by running nim js script.nim in your terminal. This will result in the creation of a new file named script.js, which index.html uses. Then just open index.html file in a browser and you're done!

Attribution

Favicon

favicon.ico

favicon.ico (as shown above) is from uxwing.com, and can be found here

Made with ❤️ with Nim

About

Play Tic Tac Toe against minimax ai

https://neroist.github.io/tictactoe/

License:MIT License


Languages

Language:Nim 81.5%Language:HTML 10.0%Language:CSS 4.9%Language:Python 3.6%