Skip to content

Collection of tictactoe games written in different langues.

License

Notifications You must be signed in to change notification settings

JanEricNitschke/TicTacToe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TicTacToe

Collection of tictactoe games written in different languages.

TicTacToe-python

Simple tictactoe game with Python.

Run and test with:

python tictactoe_python
coverage run -m pytest
coverage report -m
coverage html

TicTacToe-javascript

Simple tictactoe game with JavaScript.

Hosted here on AWS.

TicTacToe-Cpp

Simple tictactoe game with C++.

To build, test and run:

cmake -S . -B build
cmake --build build
cd build && ctest
cd .. && ./bin/tictactoe

TicTacToe-rust

Simple tictactoe game with Rust.

To build, test and run:

cargo build
cargo test
cargo run

TicTacToe-haskell

Simple tictactoe game with Haskell.

To build, test and run:

cabal build
cabal test --enable-coverage
cabal run

TicTacToe-go

Simple tictactoe game with Go.

To build, test and run:

go build
go test -covermode=count -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
go test -fuzz=FuzzSwapPlayer -fuzztime 30s
go test -fuzz=FuzzGetEmptyCells -fuzztime 30s
go test -fuzz=FuzzRandomMove -fuzztime 30s
go test -fuzz=FuzzMinMax -fuzztime 60s
go run tictactoe_go.go

TicTacToe-Java

Simple tictactoe game with Java.

To install, test and run:

mvn package
mvn test
java -jar target/tictactoe-0.1.0.jar

TicTacToe-ruby

Simple tictactoe game with Ruby.

To build and test run:

gem build tictactoe_ruby.gemspec
bundle install
gem install tictactoe_ruby
bundle exec rake
./bin/tictactoeRuby

TicTacToe-ada

Simple tictactoe game with Ada.

To build and run:

alr build --validation
./bin/tictactoe_ada.exe

TicTacToe-generic

Simple two player tictactoe game with Generic.

To run and test:

generic tictactoe_generic.gen
generic tests/test_tictactoe.gen

TicTacToe-kotlin

Simple tictactoe app with Kotlin.

To run and test:

./gradlew build
./gradlew test
./gradlew connectedCheck

TicTacToe-swift

Simple tictactoe game with Swift.

To build and test:

swift build
swift test

TicTacToe-lua

Simple tictactoe game with Lua.

To test and run:

lua54 tests/test_tictactoe.lua
lua54 tictactoe_lua.lua

TicTacToe-dart

Simple tictactoe app with Dart using Flutter. Targeted towards Windows.

To build and test:

flutter build windows
flutter test

TicTacToe-zig

Simple tictactoe game with Zig.

To build and test:

zig build install
zig build test

TicTacToe-Prolog

Simple tictactoe game with Prolog.

Specifically SWI-Prolog.

To run and test:

swipl -g main -t halt tictactoe_prolog.pl
swipl -g run_tests -t halt tictactoe_prolog_test.pl

TicTacToe-Common-Lisp

Simple tictactoe game with Common Lisp.

In the repl run:

(load "D:/Programming/Projects/TicTacToe/TicTacToe/tictactoe_common-lisp/tictactoe_common-lisp.asd")
(ql:quickload :tictactoe_common-lisp)
(ql:quickload :fiveam)

To compile, run and test:

sbcl.exe --core C:\\lispstick\\Steel\ Bank\ Common\ Lisp\\1.1.12\\sbcl.core  --eval "(let ((warning (nth-value 1 (compile-file \"src/tictactoe_common-lisp.lisp\")))) (if warning (sb-ext:exit :code 1) (sb-ext:exit)))"
sbcl.exe --core C:\\lispstick\\Steel\ Bank\ Common\ Lisp\\1.1.12\\sbcl.core  --load src/tictactoe_common-lisp.lisp --eval '(progn (tictactoe_common-lisp:play) (sb-ext:quit))'
sbcl.exe --core C:\\lispstick\\Steel\ Bank\ Common\ Lisp\\1.1.12\\sbcl.core  --non-interactive --load run-tests.lisp

TicTacToe-C

Simple tictactoe game with C.

AI player settings via command line.

Also creates Python bindings and gives an example of how to use them.

To compile and run:

make
./bin/tictactoe_c -X 0

TicTacToe-Smalltalk

Simple version with 2 player in Smalltalk.

To run in Squeak once installed:

Game new playGame.

TicTacToe-Fortran

Simple version with (currently) 2 players in Fortran.

To compile and run:

make
./bin/tictactoe.exe

TicTacToe-Assembly

Simple version with 2 players in x86 Assembly. Uses NASM.

To compile and run:

make

TicTacToe-Brainfuck

Simple version with 2 players in Brainfuck.

Useful sites to run and debug:

https://kvbc.github.io/bf-ide/

https://copy.sh/brainfuck/

To run use any brainfuck interpreter. Example using brainfuck-exe:

cargo install brainfuck-exe
brainfuck -f tictactoe.bf --print-info

TicTacToe-Cobol

Game written in GnuCobol. No minmax algorithm as highest PC strength as recursion seems annoying.

To compile and run:

cobc -x tictactoe_cobol.cob
./tictactoe_cobol

Depending on the setup first run ./set_env.cmd.

TicTacToe-Julia

Version with Julia.

To test and run:

julia --project=. test/runtests.jl
julia --project=. test/runexample.jl -X 3 -O 3

TicTacToe-PHP

Version using PHP.

To test and run:

phpunit --testdox tests
php tests/runTicTacToe.php -X 4 -O 4

TicTacToe-Nim

Version using Nim.

To compile, test and run:

nimble build
nimble test
./tictactoe_nim --X=4 --O=4

TicTacToe-C#

Version using C#.

To compile and run:

dotnet build Tictactoe.Lib
dotnet test Tictactoe.Tests
cd Tictactoe.Prog
dotnet run -- -X 4 -O 4

TicTacToe-Perl

Version using Perl.

To run:

perl tictactoe.pl -X 4 -O 4

TicTacToe-Nix

Version using Nix.

This one is only the PC playing against itself with hard coded strength settings.

nix-instantiate --eval tictactoe.nix --read-write-mode | xargs printf "%b"

TicTacToe-Bash

Version using Bash.

Run with:

./tictactoe_bash.sh 4 4

TicTacToe-Basic

Version using Basic.

Compile and run with:

fbc tictactoe_basic.bas
./tictactoe_basic 4 4

TicTacToe-Clojure

Version using Clojure.

Run:

clj -M tictactoe.clj 4 4

TicTacToe-ClojureScript

Version using ClojureScript.

Run and go to localhost:9000:

clj -M --main cljs.main --compile tictactoe.core --repl

TicTacToe-CoffeeScript

Version using CoffeeScript.

Run with:

coffee tictactoe.coffee

TicTacToe-Crystal

Version using Crystal.

Test and run with:

crystal spec
crystal run src/tictactoe_crystal.cr -- --X-strength=4 --O-strength=4

TicTacToe-D

Version using D.

Test and run with:

dub test
dub run -- --X-strength=4 --O-strength=4

TicTacToe-Eiffel

Version using LibertyEiffel.

Test and run with:

se test tests
se c -style_warning -all_check TICTACTOE make -o tictactoe
./tictactoe --x-strength=4 --o-strength=4
se c -style_warning -no_check TICTACTOE make -o tictactoe
./tictactoe --x-strength=5 --o-strength=5

TicTacToe-Elixir

Version using Elixir.

Test and run with:

mix test --no-start
mix run -- --x-strength 4 --o-strength 4

TicTacToe-Elm

Minimal two player version using Elm.

Hosted here on AWS.

Compile with:

elm make src/Main.elm

TicTacToe-Erlang

Version using Erlang.

Run with:

erlc tictactoe.erl
escript tictactoe.escript 4 4

TicTacToe-F#

Version using F#.

To compile and run:

dotnet build
dotnet run -- -X 4 -O 4

TicTacToe-Pascal

Version using Pascal, specifically FreePascal.

To build and run:

lazbuild tictactoe.lpi
./tictactoe

TicTacToe-Turnstyle

Version using Turnstyle.

Written as lambda expression, then compiled with turnstyle cabal run turnstyle compile -O tictactoe.txt --output tictactoe.png and finally hand optimized.

Does not handle invalid (out-of-bounds or overwriting) inputs.

Run with:

cabal run turnstyle run tictactoe.png

TicTacToe-Tcl

Version using Tcl.

Run with:

tclsh tictactoe.tcl

TicTacToe-Piet

Version using Piet.

Developed using MasterPiets, Pietron and piet_programming_language.

Logic of the individual components is defined in PietLogic.txt.

Run with:

piet_programming_language tictactoe.png

TicTacToe-Intercal

Version in INTERCAL, specifically using C-INTERCAL.

Adopted from BoundedBeans.

Compile and run with:

ick -Ofb tictactoe.i
./tictactoe

TicTacToe-Shakespeare

Version using Shakespeare, specifically shakespearelang.

Run with:

shakespeare run tictactoe.spl

TicTacToe-Chef

Version in Chef, specifically using rchef.

Run using:

rchef tictactoe.chef

TicTacToe-DreamBerd

Version using the perfect programming language.

Makes use of the implementation by vivaansinghvi07.

Run with:

dreamberd tictactoe.db

TicTacToe-scratch

Very simple two player tictactoe game with Scratch.

To play load it on the Scratch website

TicTacToe-Analog-Polarization-WZ

Analog version leveraging the quantum properties of light using polarization filters.

To get and play:

./get_bachelor_of_science_degree_in_physics
./get_master_of_science_degree_in_physics
./study_polarization_of_WZ_bosons
./get_doctor_rerum_naturalium_in_physics
./have_great_colleagues --Erik --Frank --Lisa --Mareen --Maren --Max --Orçun --Tim