Skip to content

Commit

Permalink
sync with upstream (#1)
Browse files Browse the repository at this point in the history
* Add actual map size reporting.

* Parse width and heights as ints. Fix test.

* add verst to organizationWhitelist.txt

* Update the description of quiet mode output.

* Update organizationWhitelist.txt

* Count number of workers down

* Take apostrophe out of website

* Limited # of characters accepted by getString()

Limit presently set at 24000

* Put a random bot replay on intro halite

* Update basics_intro_halite

* Fixes to ErrorFilterCompiler

* Fixed some networking bugs

* Fixed env such that "boom.py" no longer breaks it

* Fix to updateOrgs

* Take out "Final map size:"

* Require equality in worker tests

* Update organizationWhitelists.txt

Added my company name qure.ai to the whitelist.

* Include xss script in electron visualizer.

* Use a colorblind safe palatte for the visualizer.

* Closes HaliteChallenge#347

* Add interview waiving note

* Initial pull-mu-sigma with some related refactoring

* Update README.md

* Store the last 500,000 games

* Update color palette after more feedback.

* parsereplay.js indentation

* Revert "Merge branch 'colorblind'"

This reverts commit ca2b332, reversing
changes made to f8aa93f.

* One more visualizer color change.

* Switch to lighter cyan.

* Reinstate debugging disabled code.

* Fix formatting.

* Possible runaway crash bot fix.

* Update advanced_third_party.php

* Add in fix to sametine problem

* Add num users

* Add in num submissions

* Revert "Add in num submissions"

This reverts commit 8433141.

* Revert "Add num users"

This reverts commit 4ef3011.

* Update organizationWhitelist.txt

* Update INSTALL.md

* Update third party list

* Update titles

* Small latency fix to tier picking

* Update advanced_third_party.php

* Replay file dumps and third party edits

* Adding association window and capabilities

* Add @nmalaguti's visualizer

* Change numRows back practice

* Add KalraA's new tutorial

* Update organizationWhitelist.txt

* Update advanced_third_party.php

* Add number of coders on the homepage

* try out an increase in memory

* added -r for no replay, added -i for replay directory

* added -r for no replay, added -i for replay directory

* typo

* Indentation

* JS run fix

* Make dummy data easier to deal with

* Performance improvement for Java Starter Package: Got rid of object churn

The current implementation of the java starter package has the disadvantage that it produces a lot of object churn mainly because the game map is re-created upon each turn. This commit prevents the object churn by creating the game map, locations, and sites once and updating them later on.

* Changed replay to a new favorite

* Changed default speed for homepage vis

* Trying another color scheme

* Colors (hopefully) fixed

* popped out 1&4

* Dropped HaliteChallenge#11

* -i no longer requires lagging / and supports "

* Killed light green

* Center initial player positions in the visualizer.

* Revert "Performance improvement for Java Starter Package: Got rid of object churn"

* Update downloads.php

* Initial inclusion of nmalaguti's extra visualizer graphs.

* Adding Edinburgh to orgs

* Fix vis fps bug

Now limits to 20 when idle to decrease lag using <> and mouse when paused.

* Make sponsor images smaller

* Clear graphics before toggling extra graphs.

* Force a render after clearing graphics before changing graphs.

* Improve speed of game parsing.

* Fix parsereplay.js's indentation

* Scala starter package bug: Fix size parsing for unequal width/height

Added utilities in Grid that I've found useful so far.

* Performance improvement for Java Starter Package: Got rid of object churn

The current implementation of the java starter package has the disadvantage that it produces a lot of object churn mainly because the game map is re-created upon each turn. This commit prevents the object churn by creating the game map, locations, and sites once and updating them later on.

* Changed visibility of var production in Site from private to to public

* Stop indirect mutation of gameMap.

* Allow loading another replay after starting one in the local visualizers.

* Update about.php

* Update about.php

* Typo

* Make the cumulative graphs, cumulative on the final frame.

* Make trueskill updates dependant on numSubmissions not changing.

This should solve a race condition when a new submission comes in after
a game has already been accepted but not yet had trueskill updated.

* Fix visualizer maxHeight calculation when not using minimal display.

* Leave space for the file select button.

* Take scrimmage out of UI

* Fully remove scrimmages from the UI

* Take out unnecesary associate.php code

* Force associate on sign up

* Bump up worker limit

* Add levels to leaderboard

* Take out currently unneeded scrimmage and high school code

* Revert "Take out currently unneeded scrimmage and high school code"

This reverts commit 6c43d76.

* Remove currently unneeded scrimmage code

* Fully remove scrimmages from the db

* Remove unnecessary level logic

* Take out bold associate styling

* Add back j-clap's proper organization reporting

* wait message

* Fixes

* Bump user to server ratio

* Put level before org

* Update associate.js

* Adding University of Bordeaux

* Added University of Bordeaux (student addresses)

* Fix symlinks in visualizer/lib

* add wargaming.net organization

* Change Horace Mann name

* Fix to updateOrgs.py

* Adding UoE students 

forgot to include them before >.>

* Fix extended graph off by one error.

* Refining association page and adding an email request button

* Revert "Revert "Add num users""

This reverts commit 515152a.

* Default user value to prevent caching problems

* Update end date

* Bumped Init time to 30 sec

* Add ./ to julia runGame.sh

* Archive starter package julia fix

* Fix

* Hopefully fixes CI

* Janzert CI fix

* Make CI patch nicer

* On the user page, always show if a bot errored in a game.

* Add dash to error column

* Eliminate error column in user page gamelist.

* Show mark if any opponents error out of a game.

* Add number of others that also errored out in tooltip.

* Changed make.bat to @nmalaguti's

* Moved back but modified... hoping for appveyor

* added appveyor.yml

* Perhaps fixed spacing?

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update make.bat

* Update appveyor.yml

* build

* Changed Windows download to link to Appveyor

* switched to static build

* Updated version number [build]

* Add Grand Valley State University to whitelist

* add aqr to the whitelist

* Return GameUser.versionNumber in api/web/game results.

* Force ssh host key accept

* Added derivco

* Added Nerdery

* Added URochester

* End date clarification

* Add another harvard email

* Script to reset all user ranks and scores.

* Add median mu and sigma to status page.

* Stick with old stable phpunit that will work with php 5.6.

* Use versioned filenamefor phpunit.

* Changes to manager task api for finals.

Add setting to stop game tasks being handed out.
Add setting to change to uniform seeding for the finals.

* Script to check for tasks completion.

* Print out last gameID after all tasks completed.

* Add option to close submissions in the web api.

* Only display bot submit button when bot submissions are open.

Also fixes config section name in WebsiteAPI.php for closing submissions.

* Add alfred's suggestions

* Add 'tentative'

* More games allowed

* Try bumped timeouts

* Revert "Try bumped timeouts"

This reverts commit f09e12c.

* Add Erdman's Halite Lint to third party tools

* Seed Players above 1000

* Add workerID to Game

* Top 500 seed

* We are now at 200 games; Limit finals to silver and above

* Halite end note

* Added Citi

from email request
  • Loading branch information
wizzup authored May 16, 2017
1 parent e525281 commit 2183ec8
Show file tree
Hide file tree
Showing 132 changed files with 3,517 additions and 1,572 deletions.
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Halite Contributing Guide

If you find a bug or have a feature request, please [open an issue](https://github.com/HaliteChallenge/Halite/issues/new).

Want to help out? Have you implemented a patch or a new feature? Send us a pull request! If you are looking for things to do, check out [our open issues](https://github.com/HaliteChallenge/Halite/issues).

## Common Contributions

### Writing a Starter Package

If you'd like to write a starter package for a new language, see this [guide](https://halite.io/advanced_writing_sp.php).

### Adding Your Company or University

Edit [this whitelist](https://github.com/HaliteChallenge/Halite/edit/master/website/organizationWhitelist.txt) and send us a pull request. If you need to change your email, head [here](https://halite.io/email.php). We'll make sure to tag all members of your organization who have already signed up.

## Folder Contents

- `admin/` - A collection of administrative resources (ex. a technical specification)
- `airesources/` - The language-specific starter kits for writing bots
- `environment/` - The halite game engine
- `tests/` - All of the project's unit and integration tests
- `website/` - The website that hosts the competition. Includes the API that manages the game servers.
- `worker/` - The source for the worker servers that compile bots and run games safely

## Installing the website on Ubuntu

Clone the repo:

git clone https://github.com/HaliteChallenge/Halite.git

Run the website install script with root user permissions. This will install php, apache, python (and some python modules), and composer (and some composer packages):

cd website; sudo ./install.sh

Run the database install script with root user permissions. This will install mysql and insert our schema into a database titled Halite.

cd sql; sudo ./install.sh

Create a `halite.ini` file using your favorite text editor in the root project directory. Place information about your local database setup in there. Your `halite.ini` file should look like this;

[database]
hostname = 127.0.0.1
username = YOUR_LOCAL_MYSQL_USERNAME
password = YOUR_LOCAL_MYSQL_PASSWORD
name = Halite
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,16 @@

Halite is a programming competition. Contestants write bots to play an original multi-player turn-based strategy game played on a rectangular grid. For more information about the game, visit [our website](http://halite.io).

## Folder Contents

- `admin/` - A collection of administrative resources (ex. a technical specification)
- `airesources/` - The language-specific starter kits for writing bots
- `environment/` - The halite game engine
- `tests/` - All of the project's unit and integration tests
- `website/` - The website that hosts the competition. Includes the API that manages the game servers.
- `worker/` - The source for the worker servers that compile bots and run games safely

## Contributing

If you find a bug or have a feature request, please [open an issue](https://github.com/HaliteChallenge/Halite/issues/new).
See [the Contributing Guide](CONTRIBUTING.md).

## Questions

Want to help out? Have you implemented a patch or a new feature? Send us a pull request! If you are looking for things to do, check out [our open issues](https://github.com/HaliteChallenge/Halite/issues).
See [the Forums](http://forums.halite.io) and [our Discord chat](https://discordapp.com/invite/rbVDB4n).

If you'd like to write a starter package for a new language, see this [guide](https://halite.io/advanced_writing_sp.php).
## Authors

### Authors
Halite was primarily created by [Ben Spector](https://github.com/Sydriax) and [Michael Truell](https://github.com/truell20) for Two Sigma during their summer 2016 internship.

Halite was primarily created by [Ben Spector](https://github.com/Sydriax) and [Michael Truell](https://github.com/truell20) for Two Sigma during their summer 2016 internship. However, many others contributed to Halite's developement, including [Matt Adereth](https://github.com/adereth) and [Trammell Hudson](https://github.com/osresearch) from Two Sigma and [Arnaud Sahuguet](https://github.com/sahuguet) and [Scot Spinner](https://github.com/awesomescot) from Cornell Tech.
Many others contributed to Halite's developement, including [Matt Adereth](https://github.com/adereth), [Trammell Hudson](https://github.com/osresearch), and Jaques Clapauch from Two Sigma and [Arnaud Sahuguet](https://github.com/sahuguet) and [Scot Spinner](https://github.com/awesomescot) from Cornell Tech. Halite's participants, including [Nick Malaguti](https://github.com/nmalaguti), [Travis Erdman](https://github.com/erdman), and [Janzert](https://github.com/janzert), have also been instrumental to the project.
62 changes: 62 additions & 0 deletions admin/checkTaskCompletion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env python3

import configparser
import time
from datetime import datetime

import pymysql

parser = configparser.ConfigParser()
parser.read("../halite.ini")

DB_CONFIG = parser["database"]

def check_compiles(db):
db.begin()
with db.cursor() as cursor:
cursor.execute("SELECT COUNT(*) FROM User WHERE compileStatus != 0")
return cursor.fetchone()['COUNT(*)']

def check_workers(db, start_time):
db.begin()
with db.cursor() as cursor:
cursor.execute("SELECT workerID, lastRequestTime FROM Worker ORDER BY workerID")
workers = cursor.fetchall()
waiting = list()
for w in workers:
if w["lastRequestTime"] < start_time:
waiting.append(w)
return waiting

def main():
if ("compState" not in parser or "noGameTasks" not in parser["compState"] or
not parser["compState"]["noGameTasks"]):
print(parser["compState"]["noGameTasks"])
print("Game tasks still activated. Disable in halite.ini [compState] noGameTasks")
return
start_time = datetime.now()
db = pymysql.connect(host=DB_CONFIG['hostname'], user=DB_CONFIG['username'], passwd=DB_CONFIG['password'], db=DB_CONFIG['name'], cursorclass=pymysql.cursors.DictCursor)

compiles = 1
workers = [1]
while compiles or workers:
compiles = check_compiles(db)
workers = check_workers(db, start_time)
if compiles:
print("Waiting for %d more compiles to complete." % (compiles,))
if workers:
print("Waiting for workers: ", end="")
print(", ".join(str(w["workerID"]) for w in workers[:5]), end="")
if len(workers) > 5:
print(" and %d more" % (len(workers) - 5,))
else:
print()
time.sleep(5)
db.begin()
with db.cursor() as cursor:
cursor.execute("SELECT MAX(gameID) FROM Game")
max_game = cursor.fetchone()["MAX(gameID)"]
print("All tasks completed, last gameID %d." % (max_game,))

if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion admin/commandRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def runOnWorker(worker, keyPath, command):
print("########"+worker['ipAddress']+"########")
os.system("ssh -i \""+keyPath+"\" ubuntu@"+worker['ipAddress']+" '"+command+"'")
os.system("ssh -oStrictHostKeyChecking=no -i \""+keyPath+"\" ubuntu@"+worker['ipAddress']+" '"+command+"'")
print("########"+worker['ipAddress']+"########")

parser = configparser.ConfigParser()
Expand Down
4 changes: 1 addition & 3 deletions admin/cron/workerChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@
print("All good!")
else:
message = "Some workers haven't communicated with the manager in a while!<br><br>"
for res in results:
message += "Worker with an id of "+str(res[0])+" and an api key "+str(res[1])+" hasn't contacted the manager for over 30 minutes.<br>"
haliteEmailer.sendEmail(HALITE_EMAIL, HALITE_EMAIL_PASSWORD, "WORKER ALERT", message, HALITE_EMAIL)
haliteEmailer.sendEmail(HALITE_EMAIL, HALITE_EMAIL_PASSWORD, str(len(results))+" workers down", message, HALITE_EMAIL)
1 change: 0 additions & 1 deletion admin/md/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Finish Apache setup:
* [Allow the following of symlinks by apache](http://superuser.com/questions/244245/how-do-i-get-apache-to-follow-symlinks)
* [Allow .htaccess override](http://stackoverflow.com/a/22526144)
* [Redirect root directory to website directory](http://serverfault.com/questions/9992/how-to-get-apache2-to-redirect-to-a-subdirectory)
* Tell apache to forbid access to the storage/errors and storage/bots folders and to the halite.ini file
* [Increase your max file upload size (worker's posting large replays, users posting big bot archives)](http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload-file-size)

To setup automatic backups on the website server, copy the `backupWebsite` file in the `Halite/website/cron` folder into the server's `/etc/cron.hourly` folder, change the IP address in the file to that of the backup server, and make sure that the ssh key of the website server is in the `~/.ssh/authorized_keys` file on the backup server. Once copied, mark the `backupWebsite` file as executable and give cron permission to execute it like so:
Expand Down
26 changes: 26 additions & 0 deletions admin/rankReset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3

import configparser
import pymysql

parser = configparser.ConfigParser()
parser.read("../halite.ini")

DB_CONFIG = parser["database"]

def main():
confirm = input("This will clear all current ranks, are you sure? [y/N] ")
if confirm != "y":
return
db = pymysql.connect(host=DB_CONFIG["hostname"], user=DB_CONFIG['username'], passwd=DB_CONFIG['password'], db=DB_CONFIG['name'], cursorclass=pymysql.cursors.DictCursor)
cursor = db.cursor()
cursor.execute("SELECT COUNT(*) FROM User WHERE isRunning=1")
num_active = cursor.fetchone()['COUNT(*)']
cursor.execute("INSERT INTO UserHistory (userID, versionNumber, lastRank, lastNumPlayers, lastNumGames) SELECT userID, numSubmissions, rank, %d, numGames FROM User WHERE isRunning=1" % (num_active,))
cursor.execute("UPDATE User SET numSubmissions=numSubmissions+1, numGames=0, mu=25.0, sigma=8.333 WHERE isRunning=1")
db.commit()
db.close()
print("All ranks successfully reset.")

if __name__ == "__main__":
main()
9 changes: 6 additions & 3 deletions admin/updateOrgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
continue

realUserOrg = "Other"
emailDomain = user["email"].split("@")[1]
try:
emailDomain = user["email"].split("@")[1]
except:
pass
for org in orgs:
if emailDomain == org[1]:
realUserOrg = org[0]
break
if realUserOrg != "Other" and realUserOrg != user["organization"]:
print(user["organization"] + " " + realUserOrg)
if (realUserOrg != "Other" or user["organization"] == "") and realUserOrg != user["organization"]:
print("%s, %s, %s" % (realUserOrg, user["organization"], user["email"]))
cursor.execute("update User set organization = '"+realUserOrg+"' where userID="+str(user["userID"]))
db.commit()
36 changes: 36 additions & 0 deletions airesources/C/MyBot.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include "hlt.h"

#define BOT_NAME "MyCBot"

int main(void) {

GAME game;
int x, y, direction;

srand(time(NULL));

game = GetInit();
SendInit(BOT_NAME);

while (1) {

GetFrame(game);

for (x = 0 ; x < game.width ; x++) {
for (y = 0 ; y < game.height ; y++) {
if (game.owner[x][y] == game.playertag) {
direction = rand() % 5;
SetMove(game, x, y, direction);
}
}
}

SendFrame(game);
}

return 0;
}
36 changes: 36 additions & 0 deletions airesources/C/RandomBot.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include "hlt.h"

#define BOT_NAME "RandomCBot"

int main(void) {

GAME game;
int x, y, direction;

srand(time(NULL));

game = GetInit();
SendInit(BOT_NAME);

while (1) {

GetFrame(game);

for (x = 0 ; x < game.width ; x++) {
for (y = 0 ; y < game.height ; y++) {
if (game.owner[x][y] == game.playertag) {
direction = rand() % 5;
SetMove(game, x, y, direction);
}
}
}

SendFrame(game);
}

return 0;
}
Loading

0 comments on commit 2183ec8

Please sign in to comment.