Code Monkey home page Code Monkey logo

aichallenge's Introduction

AI Challenge Source Code Repository

Codename: Epsilon

This code provides the basis for the Fall 2011 AI Challenge. Epsilon is supposed to implement the ants game.

Folder Contents

  • ants/ - Everything related to ants: engine, starter packages, maps/mapgen, visualizer
  • integration_testing - Anything related to testing/stress-testing the contest setup
  • manager/ - Tournament manager which coordinates the workers and computes skill ratings
  • worker/ - Standalone workers which run games (including compiler and sandbox)
  • sql/ - Files for creating an empty sql database
  • website/ - Main website and frontend

Initializing the git submodules:

  • git submodule init
  • git submodule update

Installation

Follow INSTALL.md.

aichallenge's People

Contributors

aarossig avatar aerique avatar aeter avatar amstan avatar captjumper avatar danielvf avatar dstufft avatar ermau avatar flagcapper avatar gcp avatar hbhasker avatar ibdknox avatar j3camero avatar janzert avatar jbrechtel avatar jmcarthur avatar lavalamp avatar mcleopold avatar mleise avatar naktibalda avatar paulwal avatar pedrosorio avatar philxyz avatar recursive-rat4 avatar sigh avatar sir-macelon avatar synesso avatar teuneboon avatar tjc avatar zannick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aichallenge's Issues

map fairness testing

create system for testing fairness of maps and discarding unfair maps
not a priority for launch, just hand pick maps for now

Internet Explorer compatibility for the canvas visualizers

I ignorantly assumed that IE 8 has some kind of canvas support, but when I checked yesterday I realized it doesn't. How are these IE users supposed to view the replays? It would be possible to write a Java applet from scratch, give them a hint to use a different browser or use Google's excanvas which generates vml (vector markup language) elements for every draw command, effectively emulating the canvas element. But it lacks some features, notably text output.

Current share of Internet Explorer users on ai-contest.com:
1.24% use IE 7 or older
4,21% use IE 8

Merge epsilon-new-schema -> epsilon

I noticed that there's a few changes to epsilon-new-schema that are not actually related to the new schema, so that branch's scope is rather fuzzy.

There's a few of us that are confused in which branch to commit changes now.

None of the branches are functional either.

I propose that we merge epsilon-new-schema back into epsilon regardless how how much the new schema is done.

Secure password storage

I was shunned last year from #mysql because I told them we don't hash passwords.

We should get better password systems:

  • Bad: unhashed, stored plain text
  • Good: simple hashed with md5 or sha1 << Epsilon does this currently
  • Better: md5/sha1+per user salt << Zeta: Django does this by default
  • Best: crypt with a high workload + salt. md5/sha1 was designed so it's fast as possible. We don't want fast, we want as slow as possible so passwords take forever to crack. crypt allows adjusting how slow the hashing gets.

For epsilon, we might want to look at what phpBB is doing. They have some custom password functions.

Scheme Starter Package

Implement support for the scheme programming language. An incomplete list of scheme implementations may be found on this page: http://community.schemewiki.org/?scheme-faq-standards. The author personally recommends, in descending order, ikarus, MIT/GNU scheme or plt-r6rs (part of racket) as having the best combination of useful features and performance, but you will probably find that scheme programmers are willing to adapt to whatever implementation is at hand.

Fix /README.md Documentation

The installation instructions in README.md is outdated.
It should be written to reflect the new setup scripts.

Website

Repurpose the planet_wars website for epsilon/ants launch.

amstan is doing this.

In progress... Need content.

engine needs to attempt to read all bot input before timing check, but not too much

In the last contest there was an infinite loop checking for bot input and the current time as much as possible. I changed this to sleep a little before checking for bot input. Then because the engine only tried to read 1 line at a time, bots were timing out. So I changed this to read all bot input available during 1 iteration.

This would allow a misbehaving bot to fill up the pipe and cause the engine to stall. We need to find a balance number of lines to read without checking every nano-second.

LabVIEW starter package

CPeng said about 2 hours ago:

I am new to this whole github thing but I would like to create a starter package for LabVIEW. I was disappointed last challenge when there wasn't one.

LabVIEW is a graphical dataflow language unlike most text based OO ones. Does it have a place in a competition like this?

Is there a simple, and free way to run this under our linux setup?

Ideally we want a small program that we give the source file to, and it executes it for us. We're not going to be running IDEs for each bot. Our server's don't even have graphical interfaces.

McLeopold's checklist: worker/engine -> visualizer

Here are some points you and I should finalize so that we can start to watch replays:

  • Drop the full state information for food.
  • Decide on wether to drop the full state information for ants (usually 50% of file size; not a blocker, but don't forget :) )
  • Player colors set by the replay.
  • Give information on when a bot crashed. (playerNcrash ?)
  • Update the specs page where neccesary.

Comment is wrong

From ants.py

463         # kill ants with damage > 1
464         for ant in damage:
465             if damage[ant] >= 1:

Either the comment or the implementation is wrong. Emphasis on '>' vs '>='.

Clojure Starter Package.

I would try and make Clojure work in this edition.

While I'm tinkering with Starting Package I'd need to determine the environment setup possibilities. This is actually associated with https://github.com/aichallenge/aichallenge/issues#issue/16 -- can we use a build like leiningen or is setup to be done by hand? There are two ways we can go here.

1. Leiningen -- managed project building, requires Java and Leiningen install script.

  • Pros:
    • It manages project dependencies -- JAR libraries needed, including Clojure and Contrib.
    • Which means that Clojure and Contrib versions can be selected by the author.
    • It can also compile the project into one, single uberJAR, that can be run by issuing java -jar MyBot.jar
    • Project name, package name, runnable namespace and everything can be changed, as long as uberjar target remains valid.
  • Cons:
    • The manager can be extended with project dependencies and probably abused.
    • Needs access to network to fetch libraries, so, adding to one above, not really sandboxed.
    • Some space overhead for local artifact repo (per user).

Installation: wgetting leiningen sh and running lein self-install.

Compiling: lein uberjar in directory with project.clj.

Running: java -server -jar MyBot.jar in directory with project.clj.

2. Manual -- requires Java, we provide Clojure & Contrib JARs.

  • Pros:
    • No automatic management, all .clj and .jar files uploaded by user.
    • With set package name, and assuming our-package-name.core namespace is always the entry point, it should be relatively easy to set up and utilize.
    • This is the closest to what you already have, should fit in nicely albeit "magic" part.
  • Cons:
    • Will fix Clojure and Contrib version at 1.2.
    • Will require classpath manipulation to get right, individual per package setup (os.path magic).
    • So assumptions regarding directory layout will be made, so it will not be very flexible.

Installation: Installing JDK, getting Clojure and Contrib JARs, putting them somewhere +rx accessible (/opt/clojure).

Compiling: java -cp classes:src:lib_items:/opt/clojure/clojure.jar -e "(compile 'ai-challenge-ants.core)"

Running: java -cp classes:src:lib_items:/opt/clojure/clojure.jar ai_challenge_ants.core

Thoughts?

Setup does not set a password for a new installation of mysql

Setup does not set a password for a new installation of mysql.
The installer quits with:
Setting up unzip (6.0-4ubuntu1) ...
Processing triggers for python-support ...

Executing: chown contest:contest /home/contest/submissions
Executing: chown contest:contest /home/contest/maps
Executing: chmod 600 server_info.py
Executing: chown -R contest:contest /home/contest
Executing: echo 'quit' | mysql -u contest -p'contest' aichallenge
ERROR 1045 (28000): Access denied for user 'contest'@'localhost' (using password: YES)
Traceback (most recent call last):
File "setup/server_setup.py", line 234, in <module>
    main(sys.argv)
File "setup/server_setup.py", line 230, in main
    setup_database(opts)
File "setup/server_setup.py", line 75, in setup_database
    passwd=opts.database_root_password) as cursor:
File "/usr/lib/pymodules/python2.7/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/MySQLdb/connections.py", line 170, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

More install scripts

There's a few places where stuff has to be compiled.

We should go through them and make python install scripts for them.

Places of the top of my head:

  • Sample Bots Packaging
  • Visualizer
    • Javascript minification
    • Java visualizer compiling

Organize epsilon folder structure

  • Delete old games
  • Untangle website, backend from planet wars
  • Delete planet wars
  • Organize by website, backend, worker folder structure

Visualizer should allow dragging of maps

I noticed that the maps that antimatroid makes are pretty wrapable, and they look the same regardless of where the wrap line is.

I'm thinking from the point of view of the player. If your bot starts at the middle of the map, you're all good. But if your bot spawns at the side, your ants will wrap a lot and will be rather annoying to track where they are visually.

I propose having a way to scroll the map, so that players that spawn at the sides can move the map to be in the middle.

Sandboxed compilation

Compilation should be sandboxes.
I have heard of a few loopholes during the last contest: some compilers allow code execution at compile time.

jmcarthur has successfully proven this with haskell.
Even though we patched that haskell problem, I heard that this is also possible with CL.

They might be possible with others as well. Instead of risking it, I propose to sandbox the compilation step as well.

Getting Money

j3camero is responsible for this. He will go around shaking his tin cup with potential sponsors, with right of first refusal going to our generous sponsor from past contests, Google. He also has to perhaps register us as a non-profit corporation so that he does not incur personal income tax liability when sponsors give him money.

Get rid of simple-json

simple-json is a json library for python, in latest versions it can be replaced with the built in json library.

The only reason this exists is because planet-wars was running on an ancient python.

Please replace simple-json with json wherever you see it.

ants.py has a bug with score distribution

This code doesn't check if enemies is empty before calling Fraction(). It
throws a DivideByZero exception.
Commit id: 508db7c

  •    # distribute score for ants which died from collisions
    
  •    for ant in colliding_ants:
    
  •        # find living nearby enemies
    
  •        enemies = self.nearby_ants(ant.loc, self.attackradius, ant.owner)
    
  •        # in addition to the living nearby enemies, dead nearby enemies 
    
  •        #   should get points too!
    
  •        for other_ant in colliding_ants:
    
  •            # only interested in enemies within range
    
  •            if other_ant.owner != ant.owner and self.distance(ant.loc, other_ant.loc) <= self.attackradius:
    
  •                enemies.append(other_ant)
    
  •        score = Fraction(1, len(enemies))
    
  •        for enemy in enemies:
    
  •            self.score[enemy.owner] += score
    

Sample stack trace:

Traceback (most recent call last):
File "../worker/engine.py", line 157, in run_game
game.finish_turn()
File "/Users/bhasker/Projects/aichallenge/ants/ants.py", line 1015, in finish_turn
self.do_orders()
File "/Users/bhasker/Projects/aichallenge/ants/ants.py", line 512, in do_orders
score = Fraction(1, len(enemies))
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/fractions.py", line 98, in new
raise ZeroDivisionError('Fraction(%s, 0)' % numerator)
ZeroDivisionError: Fraction(1, 0)

Archiving old contests

I would like to make sure the old contests remain uploaded and all the info from them accessible. Ideally in a ai-contest.com subdomain.

How should this be done? A static html copy of everything? A read only php thing with everything disabled(that still uses the mysql database)?

need trueskill update code to run after game results reported by worker

Get a trueskill script to read a game from the database and update the mu/sigma of the game and the submission. After the worker reports a game, there will be a game record and a list of game_players for that game. The game players will only have the old mu/sigma. The code needs to find the game by game_id, pull the old mu/sigma, and update the database with the new mu/sigma. The code then needs to update the submission mu/sigma values. This should be run in a transaction.

verbose is always

verbose = bool('verbose' in options)

returns always TRUE in engine.py, even if you run without -v, it's printing ignoring the argument

C Starter Pack has a sample bot

The wallBot should be moved to the sample_bots folder and not included with the starter pack. Given this is a submodule in git, I don't know the best way to go about doing this.

check food bonus logic

Ensure the food bonus logic is this:

If the game has 1 bot left and is therefore declared over, the 1 bot should have the following added to its score:

  • 1 point for every ant left on the map ( includes both friendly and enemy ants left )
  • 1 point for every food left on the map
  • 1 point for every food that would be spawned in the future

Organization handling

Make it easier for new users to add their organization. It cannot be processed by a human.

Multi Opponent Rankings & Matchings

Since now we have used bayeselo for rankings. But bayeselo can only handle 1v1 games with a binary state(win/loss) at the end. In order to have a 4 player game another rankings mechanism must be found.

Forums Topic

Content from the Website

I have to move over the stuff from the wiki written by antimatroid to the website using a markdown to html program.

prepare for leap seconds

In case a leap second is declared and the ntp updates during a game, a bot may get extra time to process moves giving them an unfair advantage. The engine should be updated to account for this.

Supporting build systems

I think compile_anything.py is really inflexible and makes it hard for some users to make their bots to use libraries.

The main reason we have to use compile_anything.py is because compilation is not sandboxed right now. But since this has to be solved either way, why not deprecate this script.

I propose a system in which we let users use makefiles, or whatever build system they choose(that we have installed). This way we minimize the amount of work needed to install a new language.

In order to inform the manager what build system is in use, i suggest a compile.sh script that just calls the build system, example below:
#!/bin/bash
make
make could be substituted with any build system. The starter packages could come prepared with the build system most used for that language (haskell: cabal, c: makefile, java: ant).

The system will also need a run.sh in order to inform the manager what to execute to run the bot.

Ants starter packages

We need as many starter packages as possible.

Documentation

Some sample bots can be found in the repo.

There should be valid documentation in the wiki.

Versions

Regarding Compiler/Interpreter/Runtime versions, the first available should be preferred:

  • Ubuntu 11.04 amd64 repository (main multiverse restricted universe)
  • Ubuntu PPA
  • .deb files
  • source files
  • binaries

This is not a strict list, but it would make it much easier to install the language/starter pack.

IMPORTANT: If you do want a language to be supported, please modify worker_setup.py, compiler.py. Check IRC for more details.

Files

  • See ants/dist/(starter_bots|sample_bots) for the bots.

Voluntering

Comment here to volunteer, then get started making it. We'll accept either:

  • Fork the repo, add your starter pack in a folder, then submit a pull request
  • Make a new repo, we'll add it as a submodule

Manager + Worker

Repurpose the planet_wars old code.
The code is organized, there should be no useless files anymore.

Whoever does this could also become the next sys-admin.

Sandbox Issues

"[01:37] <@Janzert> amstan: the biggest first thing is that it leaves stuff in the jail user home directory from previous bot runs (any .dot files/directories), but overall it works on a blacklist principle of trying to block all the bad stuff instead of a whitelist of things the bot is allowed to access/do"

add uncertainty to trueskill sigma values at regular intervals and update leaderboards.

Get a submission to add a counter to the database, every so often increment all the sigma's by the counter * some appropriate value. This is similar to the recommended method where you add some uncertainty before updating skills. Since the bots are static, they will not tend to learn or improve so we can use this method for a little speed gain. Bot will only climb or fall in the ranks as new submissions are added.

Every so often we also need to take a snapshot of the current leader board and populate the correct tables in the database.

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.