Coder Social home page Coder Social logo

abalone-agent's Introduction

Abalone AI

This projects contains several agents to play abalone on the seahorse platform.

Algorithms implemented:

  • Minimax
  • AB pruning
  • AB pruning with nodes sorted by heuristic
  • AB pruning with Transposition Table

Heuristics available:

  • Distance to center of the board
  • Ejected pieces with distance as a tie-breaker
  • Maximise push and ejections available

Run the agents

Run once:

python main_abalone.py -g -c simplified -t local my_player_ab_distance.py random_player_abalone.py 

More info on options with python main_abalone.py -h.

Run on every file change with watchexec:

watchexec -e py -- python main_abalone.py -g -c simplified -t local my_player_ab_distance.py random_player_abalone.py 

Smaller games

Simplified config

In addition to classical and alien starting position, there is an additionnal simplified config where each player has 3 pieces available.

Shorter games

To limit the number of turns, change MAX_STEP value in constants module.

To limit the goal score, change MAX_SCORE value in constants module.

Measure agent performance

Beside victory, an agent logs the following info :

  • Time remaining at the end of the game
  • Nodes where score was computed (as terminal node or from children)
  • (for agents with a Transposition Table) the number of successful lookups

Using a heuristic for sorted AB pruning

  1. Subclass MyPlayer from ab module.
  2. Define the heuristic as a scalar function of a GameState in one of the following places:
    • as the self.heuristic attribute in the __init__ method
    • if your heuristic depends on element unkown at time of __init__, override the get_heuristic method to create the heuristic using the first GameState

abalone-agent's People

Contributors

axelbdt 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.