Giter Club home page Giter Club logo

itvb23ows-hive-ai's Introduction

ITVB23OWS Development Pipelines Hive AI

This repository contains an implementation of a Hive AI for the course ITVB23OWS Development pipelines, which is part of the HBO-ICT program at Hanze University of Applied Sciences in Groningen.

The implementation is based on the work of Samuel Carlsson in the Github repository vidstige/hive, with minor modifications.

The application contains Python code and can be run using the built-in Flask server, which can be started using the following command.

flask --app app run --debug

The AI can be called using HTTP at the root URL. The API expects a POST request with a Content-Type: application/json header and a JSON payload. It will return a JSON response.

An example request is as follows.

{
    "move_number": 1
    "hand": [
        {"Q": 1, "B": 1, "A": 1, "S": 1, "G": 1},
        {"Q": 1, "B": 1, "A": 1, "S": 1, "G": 1},
    ],
    "board": {
        "0,0": [[0, "Q"], [1, "B"]],
        "-1,0": [[1, "A"]]
    }
}

move_number contains the total number of moves played so far, by both players. This means this number will be even if the current player is white, and odd if the current player is black.

hand is a list with two elements, the hands of white and black. Each element is a dictionary mapping tile types to the number of tiles of that type the player still possesses. The tile types are as listed for queen bee, beetle, soldier ant, spider and grasshopper respectively.

board is a dictionary mapping coordinates in the cubic coordinate system used in both this repository and the starter code repository to lists of tiles. Each list contains the stack of tiles at the given position, with the top-most tile being the last element of the list. Each tile is itself a list of two elements, the player number, 0 for white and 1 for black, and the single character abbreviation of the tile type.

The response is the JSON-encoded move the AI suggests in the given position. This can be either a play, a move or a pass. The formats for each are as follows.

["play", "B", "0,0"]
["move", "0,0", "0,1"]
["pass", null, null]

A play indicates the tile to play and the position to play it at, and a move first indicates the position the tile is currently at, and then the position the tile should be moved to. A pass has no parameters.

The application end point is licensed under the MIT license, see LICENSE.md. The AI implementation is licensed for educational use, see vidstige/LICENSE.md. Questions and comments can be directed to Ralf van den Broek.

itvb23ows-hive-ai's People

Contributors

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