Giter Site home page Giter Site logo

tron_battle's Introduction

Tron Battle

Tools for making AI Players for Tron Battle (http://www.codingame.com/cg/#!ranking:20).

Here's a screenshot:

┌──────────────────────────────┐
│                              │
│                              │
│                              │
│                              │
│                              │
│                              │
│                              │
│                              │
│ ┌───────────────┐            │
│ │ ┌─────────────┘┌──────────┐│
│ └┐└─────────────┐│┌─────────┘│
│  │┌─────────────┘│└─────────┐│
│┌┐│└────────┐┌────┘┌─────────┘│
││││┌────────┘│┌───┐└─────────┐│
│││││┌┐┌┐┌┐┌┐┌┘└──┐└──────────┘│
││││││││││││││    └◆           │
││││││││││││││                 │
││└┘└┘└┘└┘└┘└┘                 │
│└─────────────                │
│                              │
└──────────────────────────────┘
┌────────────────────────────────────────────────────────────────────┐
│ Turn 246:                                                          │
│ 0:wanderer 5 AVG:0.51 MAX:1.83 Died at turn 246                    │
│ 1:wanderer 15 AVG:1.03 MAX:3.70 Died at turn 125                   │
│ 2:wanderer 45 AVG:1.92 MAX:5.06 MSG:RIGHT                          │
│                                                                    │
└────────────────────────────────────────────────────────────────────┘

To create an AI player:

from client import TronClient  # @include(client.py)

def lefter(players_count, my_number, players, grid):
    return 'LEFT'

tc = TronClient(lefter)
tc.run()

Note the # @include(client.py) comment in the first line. This is needed for building a single-file client for using with online Tron Battle.

To test a player add it to players.conf and run:

$ python tron_runner.py

Tron runner can run one or several battles and it writes the game into a logfile in the current directory. Run it with -h to get information about the command line options.

To make a single script that is usable for the online Tron Battle:

$ python build_ai.py ai_lefter.py ~/output/ai_lefter.py

tron_battle's People

Contributors

kvas-it avatar

Watchers

James Cloos avatar  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.