Skip to content

Latest commit

 

History

History
64 lines (49 loc) · 1.22 KB

README.md

File metadata and controls

64 lines (49 loc) · 1.22 KB

Tic-Tac-Toe-AI-Challenge

Can you create an AI for classic Tic-Tac-Toe?

🏃 Getting started

The challenge is made with typescript and react

Install NPM and Yarn

Install npm and then you can install yarn with npm:

npm install --global yarn

🚀 Building and running the applicaiton

install the dependencies with

yarn install

and then run

yarn start

✨ The Challenge

You are O (P2) and the challenge is to write an AI that can play a tie in tic-tac-toe Start with ai.tsx

🌱 The board

the intial state of the board is filled with number from 1 to 9

1 2 3  
4 5 6  
7 8 9  

First you need to name your bot by editing the line

export const PLAYER_NAME = "";

Then you need to implement the getNextMove function

export function getNextMove(board: string[][], round: number): gameMove {
	const possibleMoves: gameMove[] = getPossibleMoves(board);
	return possibleMove[0];
}

💦 Help?

See helpper functions in GameUtil.tsx

getPossibleMoves

Gets all the possible moves on the board

isWinning

returns true, if player is winning

isSpotOpen

returns true if spot is open

isMovesLeft