vurise / CodeBreakers-1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CodeBreakers- Tic Tac Toe Project using AI

Project title:

Entertain The Crew

Motivation:

The project is a part of Microsoft Codess mentorship program-2020. During this program we learnt many new technologies via sessions conducted by Microsoft team and mentors assigned to us. Microsoft team motivated us throughout the program to build this project.

Theme:

Our great astronauts are on a mission to reach Mars and colonize there.While they are on board the spaceship has to cover a huge distance of almost 103.6 million km and feel bored on the way. So, to entertain the crew we have rebuilt the tic-tac-toe game with some exciting twists and turns. Hope they will enjoy it!

Screenshots:

choose your options

choose your options

playing a 5*5 tictactoe with the AI

playing a 5*5 tictactoe with the AI

playing a 5*5 tictactoe with a friend

playing a 5*5 tictactoe with a friend

winning the game

winning the game

Features:

The game provides following options:

1. Symbol : A player chooses any symbol of his choice to play the game each time , the game includes ‘X’ and ‘O’ .

A player marks any of the squares of grid with his symbol and his aim is to create a straight line horizontally, vertically or diagonally with two intentions : Create a straight line before the opponent could win the game. Restrict his opponent from creating a straight line first.

In case when none of the two could make a straight line then the game results in a tie. Thus there are three possible outcomes of the game i.e. the player wins, his opponent wins or it’s a tie.

2. Dimension:

The player selects the dimension In 3x3 the player makes a straight line by placing the same symbol 3 times in a row/ column/ diagonal. In 5x5 the player makes a straight line by placing the same symbol 5 times in a row/ column/ diagonal.

3. Opponent:

Friend- The player chooses to play against a friend from the same computer turnwise. Computer- The player chooses to play against the AI.

4. Level:

In level1 : computer is naive and can be defeated. In level2 : The computer is smarter to play against. In level3 : The computer either wins the game or it's a tie. It's an unbeatable level such that the player never wins against the AI.

5. First player:

The player either chooses to make the first move on the board with its symbol or gives the chance to the opponent to make the first move.

6. Scoreboard:

The player can view the scores on the scoreboard, after the game is over. There is also a reset option to make scores of both players 0 and restart the game.

Other feature provided:

7. Webcam:

The user is provided with the option of taking a snapshot through the webcam and displaying the image on the page itself. In the case of a computer as an opponent the opponent is displayed with the image of AI while in case of friend both the friend and the player one can capture their snapshots separately and display them on the same page so as to make the game much more interesting. This webcam has been coded using webcam.js library.

Algorithms Implemented:

  1. Using Random()
  2. Magic Sqaure Logic
  3. Alpha Beta Pruning (Optimised Minimax Algorithm)

Flow of Game:

flowchart of game [ Refer to the documentation here ] (https://docs.google.com/document/d/e/2PACX-1vRscJjfPxWcIdIDCs8Um2lGbVysCw8zQTi6Ii3YE1vgVsmry9VMLZuXmMY-tqN0IaFStSQT39cIxDzY/pub)

About


Languages

Language:JavaScript 72.2%Language:CSS 18.1%Language:HTML 9.8%