Coder Social home page Coder Social logo

chanddu / backgammon-python-numpy- Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 4.0 68 KB

Implemented a expectiminimax agent (2-ply search) with alpha – beta pruning and forward pruning (to reduce the branching factor in the game tree) to determine the best move give the state of the board.

Python 100.00%
artificial-intelligence expectiminimax alpha-beta-pruning forward-pruning adversial-search

backgammon-python-numpy-'s Introduction

Backgammon-python-numpy-

Implemented a expectiminimax agent (2-ply search) with alpha – beta pruning and forward pruning (to reduce the branching factor in the game tree) to determine the best move give the state of the board.

Dependencies:
Python3
copy
numpy

To execute:
python backgammon.py

Input Format:

The first line of the input is 1 or 2 indicating its either white or black who is playing the game. 26 lines follow. Each line contains 1 or 2 integers (separated by a single space) indicating the number of checkers on the point and the type of the checker (1 for 1st player's checker and 2 for 2nd player's checker)

• 5 1 indicates that there are 5 checkers of the first player.

• 6 2 indicates that there are 6 checkers of the second player.

• 0 indicates that the point has no checkers. The first and the last line are bear off points for 2nd player and the 1st player respectively.

2 lines follow, each line indicating the number of coins in the bar for the 1st player and the 2nd player. 

The next line contains an integer (2 or 4) indicating the number of dice rolls played on behalf of player by the computer. 4 – both the dice rolled the same number. 2 or 4 lines follow each indicating a number between 1-6 which is the number on the dice.

Output format:

For every possible legal dice roll possible, print a checker move in a new line. Each move has two integers (start point and end).

• 1 2 a checker is moved from 1 to 2.

• -1 5 a checker is removed from the bar and is placed at 5 on a dice roll of 5.

1 0 a coin is being bared off.

Example Input:

1

0

2 1

0

0

0

0

5 2

0

3 2

0

0

0

5 1

5 2

0

0

0

3 1

0

5 1

0

0

0

0

2 2

0

0

0

2

5

4

backgammon-python-numpy-'s People

Contributors

chanddu avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.