Testing JS warriors on randomly generated levels
You have just designed some warrior for WarriorJS but how can you know it it the best one?
Just run this script that will generate as many random levels as you want and see how it compares to your friends' warriors!
Clone sources somewhere (there is no npm package for it yet).
Execute the command
npm install
Write your own warrior as it is described in game rules.
Put the js file with the code of your warrior into \players directory.
Run the game:
npm start ./configs/10-levels.json
Observe the summary of game results:
you | Passed 50% | Total score 131
naive | Passed 30% | Total score 48
runner | Passed 10% | Total score 12
The generated levels and rules can be configured with a json file. You should pass it as a parameter to the program.
The example of configuration file:
{
"seed": 1,
"levels": 10,
"showDetails": false,
"showEvents": false
}
Currently the following configuration values are supported:
The number or string that is used as a seed for the generated levels. If omited then each run will be fully random.
The number of levels to generate or 5 by default.
The time bonus or 15 by default.
The exact number of units (other from warrior). If not set then minUnit
and maxUnits
are used.
The minimum number of units (other from warrior) or 1 by default.
The maximum number of units (other from warrior) or 5 by default.
The exact number of free cells. If not set then minFreeCells
and maxFreeCells
are used.
The minimum number of free cells or 0 by default.
The maximum number of free cells or 4 by default.
Boolean indicating whether or not to show level image and the score each warrior earned at each level. False by default.
Boolean indicating whether or not to show the full log of events at each level. Requires showDetails
to be set to true
. False by default.
Array of strings describing units that can be generated. Default is ["sludge", "thickSludge", "archer", "captive", "wizard"]
.
Array of strings describing actions available to the player. Default is ["attack", "bind", "detonate", "explode", "pivot", "rescue", "rest", "shoot", "walk"]
.
Array of strings describing senses available to the player. Default is ["directionOf", "directionOfStairs", "distanceOf", "feel", "health", "listen", "look"]
.
Array of strings that specifies what players should take part in competition. Defaults to all players available in /players
directory.
Array of numbers in the interval 1...numLevels
that specifies what levels should be used in the competition. Defaults to all numLevels
generated levels.
If you want to contribute to the project feel free to take issue from https://github.com/gerich-home/warriorjs-arena/issues or raise new ones!
Also please share your results (as PR or in other way).
My current results with the command npm start ./configs/100-levels.json
are the following:
gerich | Passed 68% | Total score 2268
naive | Passed 29% | Total score 533
runner | Passed 14% | Total score 187