Giter VIP home page Giter VIP logo

ai_player's Introduction

AI Player

Building an AI "Gomoku" player

โœ’๏ธ Note : our team was ranked in 10% best teams during school competition @ESILV.

๐Ÿ“ Introduction

Gomoku is a turn-based two-player board game (player 1 with black pawns, player 2 with white pawns).

The black player plays first. Each player has 60 pieces. The size of the board is 15x15 cells. The rows are numbered from 'A' to 'O' and the columns are numbered from '1' to '15'.

A player can place a pawn on any free space. The first player to align 5 consecutive pieces (horizontally, vertically or diagonally) wins. Otherwise, the game is a draw if there are no more pawns.

In the game of Gomoku (as for tic-tac-toe), the first player has more chances to win. Then we used the long-pro variant :

  • player 1 (black) places a pawn in the center of the board (H8)
  • player 2 (white) can place a pawn anywhere
  • then player 1 can place a pawn anywhere except in a square of size 7x7 from the center H8.
  • Then the game is going normally

๐Ÿ‘ฉโ€๐Ÿ’ป Just tell me what to do

In order to play this game, you can download the AI_Project.py file and launch it in command line python AI_Project.py.

Then, follow the instructions displayed on the shell. (French version)

๐Ÿ“ Some explanations

In order to build our AI, we focused on implementing the MinMax algorithm based on 4 functions :

  • Actions
  • Result
  • Utility
  • Terminal Test

To improve performance, we needed to reduce the number of nodes since a grid of 15x15 is really large. We used an improved version of MinMax algorithm by using a method called "Alpha-Beta pruning".

We also used a maximum depth in our searching tree to limit the time we have to wait during each move to 0-20 seconds approximately.

And what about our heuristic ?

We decided to implement a best score heuristic which is giving a specific score to each cell of the grid. It means that each cell will be assigned a value based on the probability to win the game if we play on this cell. Then, we return only the 5 cells with the highest score to reduce our AI complexity.

๐ŸŽ“ Developers

Students @ESILV - Paris.

  • Alban STEFF
  • Soumaya SABRY
  • Fanny ZHONG
  • Alexandre SALOU

Project of 2019

ai_player's People

Contributors

albans98 avatar

Watchers

 avatar  avatar

Forkers

soumayasabry

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.