User Tools

Site Tools


archief:aichallenge

Aichallenge

Run Server
svn checkout http://ai-contest.googlecode.com/svn/trunk/ ai-contest-read-only  ;
cd ai-contest-read-only/planet_wars;
apt-get install python-mysqldb php5 openjdk-6-jdk openjdk-6-jre-headless mysql-server php5-mysql

Make a file called server_info.py with the contents:

server_info = {"db_host":"localhost","db_username":"zeus","db_password":"zeus","db_name":"zeus","mail_address":"zeuswpi","mail_password":"zeus","mail_name":"zeus","mail_username":"zeus"} 

And server_info.php with (not mail password and mail_username this time):

<?php $server_info= array("db_host"=> "localhost","db_username"=>"root","db_password"=>"zeus","db_name"=>"zeus", "mailer_address"=>"zeuswpi","mailer_password"=>"zeus","mailer_name"=>"zeus"); ?>

Set the submission_directory in www/check_submit.php and backend/compile_daemon and give www-data all permissions to it

Change the link in planet_wars/viz/Viewer.java and recompile the jar.

Create database in mysql

mysql -p
create database zeus;
create table zeus.users(user_id MEDIUMINT NOT NULL AUTO_INCREMENT, username VARCHAR(100) ,password VARCHAR(100),email VARCHAR(100),status_id VARCHAR(100),activation_code VARCHAR(100),org_id VARCHAR(100),bio VARCHAR(100),country_id int,       created  VARCHAR(100),theme_id VARCHAR(100),activated VARCHAR(100),admin VARCHAR(100),PRIMARY KEY (user_id));
create table zeus.submissions (submission_id MEDIUMINT NOT NULL AUTO_INCREMENT, user_id VARCHAR(100),status VARCHAR(100), timestamp timestamp, last_game_timestamp timestamp, language_id int,PRIMARY KEY (submission_id));
create table zeus.languages (language_id MEDIUMINT NOT NULL AUTO_INCREMENT,main_code_file VARCHAR(100),name VARCHAR(100), command VARCHAR(100), PRIMARY KEY (language_id));
create table zeus.maps(map_id MEDIUMINT NOT NULL AUTO_INCREMENT, name VARCHAR(100), path VARCHAR(100), priority int,PRIMARY KEY (map_id));
create table zeus.user_status_codes(status_id MEDIUMINT NOT NULL AUTO_INCREMENT, name  VARCHAR(100), PRIMARY KEY (status_id));
insert into zeus.user_status_codes(name) values ('other');
insert into zeus.user_status_codes(name) values ('zeus');
create table zeus.organizations(org_id MEDIUMINT NOT NULL AUTO_INCREMENT, name VARCHAR(100),PRIMARY KEY (org_id));
insert into zeus.organizations(org_id,name) values (0,'zeus');
create table zeus.jail_users(jail_user_id MEDIUMINT NOT NULL AUTO_INCREMENT, in_use int, username  VARCHAR(100),PRIMARY KEY (jail_user_id));
create table zeus.games(game_id MEDIUMINT NOT NULL AUTO_INCREMENT, winner int, loser int, map_id int, draw int, timestamp timestamp, player_one int, player_two int, playback_string TEXT,PRIMARY KEY (game_id));
create table zeus.leaderboards(leaderboard_id MEDIUMINT NOT NULL AUTO_INCREMENT, timestamp timestamp, algorithm_name VARCHAR(100),calculation_time int,PRIMARY KEY (leaderboard_id));
create table zeus.rankings (ranking_id MEDIUMINT NOT NULL AUTO_INCREMENT, leaderboard_id int, submission_id int, rank int, wins int, losses int, draws int, score int,PRIMARY KEY (ranking_id));
create table zeus.countries(country_id MEDIUMINT NOT NULL AUTO_INCREMENT,name VARCHAR(100),flag_filename VARCHAR(100), PRIMARY KEY (country_id));
create table zeus.playback(playback_id MEDIUMINT NOT NULL AUTO_INCREMENT,game_id int,compressed_playback_string text, PRIMARY KEY (playback_id));
alter table users add key 'user_id' (user_id);

For every supported language something like this

insert into zeus.languages(main_code_file,name,command) values ('MyBot.java','Java','java -jar MyBot.jar');
insert into zeus.languages(main_code_file,name,command) values ('MyBot.py','Python','python MyBot.py');

You could also add some countries.

chmod +x generate_many_maps.sh;
./generate_many_maps.sh;
python add_maps_to_database.py 100

Create some local users on your machine to add here, they need an ssh account that is set up to auto log in using the jail_id_rsa (you might want to create a new pair)

insert into zeus.jail_users(in_use,username) values(0,'jailuser1');
insert into zeus.jail_users(in_use,username) values(0,'jailuser2');

Create jail users

create_jail_users.py 10

cd to planet_wars/backend and run for testing purposses:

python compile_daemon.py 3000 &
python tournament_manager.py 3000 & 
./update_rankings.sh &

You will want to put these in a cron.hourly for 3500 secs or so, update rankings should be run like every 30 minutes.

archief/aichallenge.txt · Last modified: 2021/11/23 14:14 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki