The project is currently Work In Progress, some security features aren't implemented yet.
It is not safe to run untrusted scripts that you don't understand.
The rebirth of robotgame but in lua instead of python.
You need golang 1.21.4.
To run locally a match between PATH/TO/LUA/BOT1 and PATH/TO/LUA/BOT2 use the following command : go run debug.go lua.go rg.go player.go referee.go main.go PATH/TO/LUA/BOT1 PATH/TO/LUA/BOT2
Note: The first time you run it after an update, run go with the -a flag to make sure C files are recompiled : go run -a debug.go lua.go rg.go player.go referee.go main.go PATH/TO/LUA/BOT1 PATH/TO/LUA/BOT2
Checkout the Documentation section to learn how to create your own robot.
Project currently Work In Progress. Stay tuned.
To create a bot you just need to create a lua script with a function act(self, game) that returns an object with :
- an
actionTypeproperty with a value among[MOVE, ATTACK, GUARD, SUICIDE] xandyproperties if theactionTypeproperty is set to[MOVE, ATTACK]
Example: {actionType=ATTACK, x=8, y=9} is a valid return value.
Here is an example of a very simple bot :
function act(self, game)
return {actionType=GUARD}
endA robot's own info is accessible through the self argument. The default properties exposed are :
robot_id: The unique id of the robot.player_id: An id shared by all the robots of a team.hp: The number of Health Points of the robot.location: The location of the robot as an object with the propertiesxandycorrespondng to its x and y coordinates.
Note: The structure of game may change soon
The game argument let you access robots information by coordinate : game[x][y] returns the info of the robot placed at { x=x, y=y }. If the tile at x, y is empty, nil is returned. Each robot shares the same info as self except that robot_id is not accessible for enemy robots.
game also lets you access the current turn count with the property turn.
an object rg is accessible by all robots, with the following properties :
CENTER_POINT: The location of the center of the arena.GRID_SIZE: The size of the grid.ARENA_RADIUS: The radius of the area.SETTINGS: an object exposing the main constants of the game :spawn_delay: The delay between 2 waves of spawns.spawn_count: The number of robots spawned for each team for each wave of spawns.robot_hp: The maximum number of Health Points of a robot.attack_range: The maximum distance to another bot for an attack to be valid.attack_damage: The min and max damages dealt by an attack :min: the minimummax: the maximum
suicide_damage: The damages dealt by a suicide.collision_damage: The damages dealt by a collision.max_turn: The number of turns in a game.
wdist(location1, location2): A function that returns the walking distance between location1 and location2.: A function that returns the list of locations around location. NOT WORKING PROPERLY YETlocs_around(location)
Robots have 10ms to act, they have one action per turn :
MOVE: moves the robot to an adjacent tile.ATTACK: attack a tile at range.GUARD: stay in place, protect against collision damages and take half damage from attacks and suicides.SUICIDE: dies but deals damages to adjacent tiles.
There are no friendly damages (collison, attack and suicide only deal damage to enemy robots).
They are several waves in which robots spawn randomly, The team that have more robots at the end of the game wins.