Giter Site home page Giter Site logo

mini-camelot's Introduction

Daniel Clarke CS 6613 - Artificial Intelligence Spring 2015 Project: Mini Camelot

Installation

Install the following dependencies:

  • python 3.4
  • Flask 0.10
    • Once installed, open your terminal can go to the app directory in the source code Run the following command and you should see output similar to this:

       $ python mini-camelot.py
       * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
      
  • Open your browser and go to the given URL
  • Play your game! (To reset/restart, simply refresh the page).

Design

At first, I built the program to run in the console. You can see this by running the camelot.py file in the depreciated folder. The AI model uses the Minimax algorithm with Alpha-Beta Pruning. In addition to that, I build the graph search with an iterative depending approach. Initially the maximum depth the search will go to is a depth of 4. If the alpha-beta search is able to complete at this level in under 5 seconds, the max depth is incremented and the search is restarted. Since the game is infinite in depth (one could move his/her piece back and forth indefinitely), this seemed to be the best approach. It was specified that we should implement a cutoff once such that the search never exceeds 10 seconds, hence the cutoff test look first to see if a given node is a leaf node, then if the current run-time of the search is close to 10s, it uses the evaluation function I designed to provide an accurate depiction of the game in the given state.

My evaluation function is as follows: 100 * ((0.2 * ((#white_pieces - #black_pieces)/5)) + (0.4 * (-1/min_distance_to_black_castle)) + (0.4 * (1/min_distance_to_white_castle)))

This gives us a number between -100 and 100, and takes into account both strategies of either attempting to win via capturing all enemy pieces and attempting to win by reaching the castle. I have weighted it in such a way that reaching the castle is more important (decided through experience).

mini-camelot's People

Contributors

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