All Projects → LazoCoder → Tic Tac Toe

LazoCoder / Tic Tac Toe

Licence: gpl-3.0
An unbeatable game of Tic Tac Toe.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Tic Tac Toe

Commandcenter
Starcraft AI Bot
Stars: ✭ 456 (+700%)
Mutual labels:  artificial-intelligence, ai, game
Owl Bt
owl-bt is editor for Behavior trees. It has been inspired by Unreal engine behavior trees in a way, that it supports special node items like decorators and services. This makes trees smaller and much more readable.
Stars: ✭ 112 (+96.49%)
Mutual labels:  artificial-intelligence, ai, game
Warriorjs
🏰 An exciting game of programming and Artificial Intelligence
Stars: ✭ 8,673 (+15115.79%)
Mutual labels:  artificial-intelligence, ai, game
Pygame Learning Environment
PyGame Learning Environment (PLE) -- Reinforcement Learning Environment in Python.
Stars: ✭ 828 (+1352.63%)
Mutual labels:  artificial-intelligence, ai, game
Autodl
Automated Deep Learning without ANY human intervention. 1'st Solution for AutoDL [email protected]
Stars: ✭ 854 (+1398.25%)
Mutual labels:  artificial-intelligence, ai
Machine Learning Experiments
🤖 Interactive Machine Learning experiments: 🏋️models training + 🎨models demo
Stars: ✭ 841 (+1375.44%)
Mutual labels:  artificial-intelligence, ai
Pycm
Multi-class confusion matrix library in Python
Stars: ✭ 1,076 (+1787.72%)
Mutual labels:  artificial-intelligence, ai
Ai Programmer
Using artificial intelligence and genetic algorithms to automatically write programs. Tutorial: http://www.primaryobjects.com/cms/article149
Stars: ✭ 948 (+1563.16%)
Mutual labels:  artificial-intelligence, ai
Riceteacatpanda
repo with challenge material for riceteacatpanda (2020)
Stars: ✭ 18 (-68.42%)
Mutual labels:  artificial-intelligence, ai
Awesome Ai Books
Some awesome AI related books and pdfs for learning and downloading, also apply some playground models for learning
Stars: ✭ 855 (+1400%)
Mutual labels:  artificial-intelligence, ai
Openkore
A free/open source client and automation tool for Ragnarok Online
Stars: ✭ 956 (+1577.19%)
Mutual labels:  ai, game
Sliding puzzle
Swift implementation of the Sliding Puzzle game with Iterative Deepening A* AI Solver.
Stars: ✭ 25 (-56.14%)
Mutual labels:  artificial-intelligence, ai
Game Server
Distributed Java game server, including cluster management server, gateway server, hall server, game logic server, background monitoring server and a running web version of fishing. State machine, behavior tree, A* pathfinding, navigation mesh and other AI tools
Stars: ✭ 916 (+1507.02%)
Mutual labels:  ai, game
Evalai
☁️ 🚀 📊 📈 Evaluating state of the art in AI
Stars: ✭ 1,087 (+1807.02%)
Mutual labels:  artificial-intelligence, ai
Tetrisai
The old school Tetris game in addition with an AI that learns evolutionary how to play this game
Stars: ✭ 22 (-61.4%)
Mutual labels:  artificial-intelligence, ai
Machine Learning Open Source
Monthly Series - Machine Learning Top 10 Open Source Projects
Stars: ✭ 943 (+1554.39%)
Mutual labels:  artificial-intelligence, ai
Carrecognition
This is one of the best vehicle recognition applications. It can determine the car's license plate number, color, model, brand and year.
Stars: ✭ 34 (-40.35%)
Mutual labels:  artificial-intelligence, ai
Goapy
Goal-Oriented Action Planning implementation in Python
Stars: ✭ 33 (-42.11%)
Mutual labels:  artificial-intelligence, ai
Rlcard
Reinforcement Learning / AI Bots in Card (Poker) Games - Blackjack, Leduc, Texas, DouDizhu, Mahjong, UNO.
Stars: ✭ 980 (+1619.3%)
Mutual labels:  ai, game
Clarifai Apple Sdk
Artificial Intelligence with a Vision
Stars: ✭ 46 (-19.3%)
Mutual labels:  artificial-intelligence, ai

Tic-Tac-Toe

An unbeatable game of Tic Tac Toe. The AI uses a tweaked Alpha-Beta Pruning algorithm for the decision making.

Gameplay

The AI cannot be defeated. Every game either ends in a draw or the AI winning.

alt-tag

What I Learned

Alpha-Beta Pruning has a "Flaw"

Vanilla Alpha-Beta Pruning sometimes leads to unexpected results such as the following:

alt-tag

You can see in the above gif that the AI could have won by playing an O in the bottom left corner but it instead chose the middle cell in the first column. This may seem a little strange but no matter what move I choose afterwards, it still wins.

What I found was that even though Alpha-Beta Pruning based AI plays perfect games, occassionally it chooses to make a move where the outcome will be a slower victory or a quicker loss. By tweaking the algorithm a little bit and including search depth in its board evaluation I was able to get it to always choose the quickest victory or the slowest loss.

The following is what the tweaked Alpha-Beta Pruning algorithm does:

alt-tag

As you can tell, this time it chooses the path of quickest victory.

Quantity of Boards Evaluated

When using a regular MiniMax algorithm the AI checks 59,704 possible board combinations for its first move (this number obviously decreases throughout the game as less cells are available). The Alpha-Beta Pruning on the other hand brings this number down to 2,337. Adding the tweak that I mentioned above brings the number up slightly to 2,787. This increase is miniscule in comparison to the advantages that the algorithm brings to the table.

Instructions

After downloading, navigate into the folder that contains the packages ArtificalIntelligence, Assets, TicTacToe, and Results.txt. Then type the following commands to run the game in Window mode:

javac Window.java
java TicTacToe.Window

Typing in any parameter will run the game in Player vs. Player mode. Example:

java TicTacToe.Window -pvp

To run the game in the console, without a GUI, type:

java TicTacToe.Console

The console version takes in the player input by index. This means that to select position (1, 1), the index would be 4 since it is the 5th square but we are using zero based indexing.

alt-tag

Console mode does not support Player vs. Player.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].