Your kindly neighbour, Doctor Tree, just gave you three magical creatures called Codémon. There's a battle tournament in the nearby town of Colorville. Are you the very best, like no one ever was?
This is a battle tournament. Each player controls a team of three monsters, and the objective is to knock out (kill) the other team. There are 100 rounds, with points being awarded for wins and ties. The team with the most points wins!
A Codémon is a complicated little creature. There are five types (elements) to choose from, three stats, and three move slots on each.
Each Codémon is assigned one type. The five types are Normal, Psychic, Fire, Water, and Grass. Each has its strengths and weaknesses. Damage is based on the following chart:
The numbers are damage multipliers. For instance, Fire attacking Water has a 0.5 modifier (half damage), whereas Fire attacking Grass is doubled (2).
Each monster has three stats that determine its battle abilities. Attack raises the damage it does. Defense lowers the damage it takes. Speed allows it to move before those with lower Speed.
Each monster has a starting value of 50 for each stat, and a maximum of 100. When you create your monsters, you will be able to assign 80 additional stat points (each). Remember that no individual stat can go over 100. So, you could have a 100/80/50, 90/80/60, or 65/65/100 distribution, but 120/50/60 is illegal. Any team with illegal stats is disqualified. You are not required to use all 80 points, but you probably shouldn't go with the minimum 50/50/50.
You could also consider HP a stat, but each Codémon has a non-modifiable 100 HP. When HP drops to zero, they are unable to continue fighting. HP is refilled to 100 before each battle.
Each monster knows three battle moves. The three chosen must be distinct, so no Punch/Punch/Punch.
There are 15 moves, three of each type. Each type has a direct attack, a weaker attack with an effect, and a sole effect move.
id name type power uses usable effect 0 Punch N 20 - NFWG 1 Heal N 0 3 NFWG Heals 50 HP 2 Slow N 10 5 NFWG Enemy speed x0.8 3 Pain P 20 - PFWG 4 Sleep P 0 3 PFWG No enemy action until wake 5 Weaken P 10 5 PFWG Enemy Atk x0.8 6 Fireball F 20 - NPFW 7 Burn F 0 3 NPFW Enemy -10 HP each turn 8 Sharpen F 10 5 NPFW Own Atk x1.25 9 Watergun W 20 - NPWG 10 Confuse W 0 3 NPWG Enemy may strike itself (10 power) 11 Shield W 10 5 NPWG Own Def x1.25 12 Vine G 20 - NPFG 13 Poison G 0 3 NPFG Enemy -5xTurns HP each turn 14 Sap G 10 5 NPFG Enemy Def x0.8
type refers to the type of the move.
power is its striking power.
uses indicates how many times it can be used per battle (
- is unlimited).
usable shows what types it can be used by (for example, Punch cannot be given to a Psychic type, as there is no
effect shows what effects the moves have. There is a 75% chance of each effect working, except Heal, which always works.
For effects that change a monster's stats, effects may be stacked. For example, using Weaken twice may lower your opponent's attack to 0.64 effectiveness. Effects that do not change a monster's stats (Sleep, Burn, etc) do not stack.
Sleep puts the opponent to sleep, with a 60% chance of waking at the start of each turn. No action will be taken by sleeping monsters.
Burn damages the opponent 10 HP at the end of each turn when active. Poison works similarly, but takes an increasing amount each turn. On the first turn, it's 5, and it gains 5 each turn thereafter. So, by the fourth turn, it will be damaging for 20. These are flat damages, not affected by the monster's type or subject to bonuses.
Confusion may make a monster attack itself instead of doing what it was told to do. This attack has power 10, and has a 30% chance of happening on a given turn.
To be clear, effects last until end of battle (except Sleep, as noted above).
Moves also receive a 20% boost in power if used by a monster of the corresponding type. For example, a Grass monster using Vine is boosted, while using Punch he is not.
The stats and type (but not moves) of each monster is public knowledge. Your opponents will be able to see what they're fighting, in order to choose the best action. However, there are also bonuses available that are hidden.
Specifically, after every two battles, you will be given one "bonus" stat point for each monster on your team. Points are given to all monsters, dead or alive, winner or loser. You can assign this to whichever of the three stats you choose. You cannot stack them on a single monster; each monster gets one each time. These points are immune to the 100 limit. Since there will be 100 battle rounds, this means you can get a single stat up to 149 if you allot all your bonuses to it. Again, the opponent will only see your "base" stats, so the farther into the tournament you are, the further their knowledge diverges from the truth.
Battle takes place between teams of three, with one active on each team at a time. At the start, you will be shown the opponent's team and asked to choose which monster will be your first "active" player.
After that, turns take place with the following steps:
- Switch : Mandatory monster switches take place (if any)
- Choose battle action
- Switch : Any optional monster switches (chosen as battle action) take place
- Sleep Check : Chance to wake from sleep
- Attack 1 : If able, the speedier monster uses its selected move
- Attack 2 : If able, the other monster uses its selected move
- Effect damage : Apply burn/poison damage to living monsters
"Speedier" means the monster with the higher speed. If both speed stats are the same, it is chosen by PRNG coin flip each turn.
At the end of any turn where your active monster dies, you will be asked to choose a new active. You may also choose to switch active monsters as your move for any turn (provided you have more than one alive). Again, if you switch as your move, you will not make a battle move that turn.
Monsters are not "processed" when inactive. This means they take no burn/poison damage, poison counters won't accumulate, no wake from sleep, etc. No effects are removed or changed when switching. This isn't that other monster battling game. If you switch out with attack raised and burned, they'll still be there when you switch back in.
Effect damage takes place whether you kill your active opponent or not. In this way, members of both teams may die on a single turn.
When one team runs out of usable monsters, they lose. If both teams run out on the same turn, it's a tie. If the battle lasts for 1000 turns, it's a tie.
The formula to determine damage is:
floor((effAttack / effDefense) * movePower * typeMultiplier * moveBoost)
effDefense are the effective stats for the monsters. Effective attack is obtained by adding Attack and Bonus Attack, then multiplying (by 0.8 or 1.25) if any effects alter it. Remember that these effects can stack.
Damage can only be 0 when the type modifier is 0 (Normal <--> Psychic) or the move's Power is 0 (Heal, Burn, etc). Otherwise the minimum is enforced at 1.
Tournaments last for 100 rounds. In each round, the teams are shuffled and paired against each other randomly. If there are an odd number of teams, the leftover receives a bye (scores as a tie). Winning a battle earns the team 2 points, ties are worth 1, and losses nothing. The team with the most points at the end wins!
If teams are tied, a tournament with only the teams tied for first place will take place to determine tiebreaker order.
The controller will send your program one of four commands. The first character determines the command type, with data following if necessary.
Your program will accept the command as an argument, and will respond on STDOUT within one second. Do not stay alive listening to STDIN, it won't be there. Each command will spawn a new process.
You may write data/state to disk. Place any files in a subfolder with the same name as your team. Do not write more than 32 kilobytes of data, or you will be disqualified. Data will persist between rounds, but will be cleared between tournaments.
This is sent once at the start of the tournament to register your team. Your reply should be constant, not different for each tournament.
name is a string with your team name. Please use alphanumeric only, for ease of parsing.
memberN is a member string, giving the details of each monster:
Again, 'name' is a string, this time with this monster's name.
typeid is its type. Type ids are in the order shown in the chart above, with Normal=0 and Grass=4.
The next three fields are your base stats. Keep in mind the limits described in the stats section above.
The last three are your monster's moves. IDs are shown in the move chart above.
An example team data reply may look like this:
Any team that sends back garbage, ill-formatted, or illegal data here will not participate until it is fixed.
This is sent at the start of each battle, and when a monster dies and needs to be switched.
battleState shows the state of the current battle. Bear with me here, it's ugly:
XteamState looks like:
activeSlot shows which monster is currently active (0-2). The member states come in two flavors. If it's your team, it gives extra information. So,
id is simply an integer identifier you can use to keep track of monsters if you don't like using
attack:defense:speed are your base stats.
poisonedturns tells you how many turns you've been poisoned for.
moveCountX tells how many uses you have left for each move. If 0, it cannot be used. For unlimited moves, this will be negative.
bonus(stat) is the amount of bonus points you have assigned to each stat.
effectid is a variable-sized list of effects that have been applied to your monster. There will not be a trailing
: on the string, whether there are active effects present or not. If there are stacked effects, they will show up as multiple effects in the list.
The effect ids are:
0 NONE (should not appear, internal use) 1 POISON 2 CONFUSION 3 BURN 4 SLEEP 5 HEAL (should not appear, internal use) 6 ATTACK_UP 7 ATTACK_DOWN 8 DEFENSE_UP 9 DEFENSE_DOWN 10 SPEED_DOWN
The only response required is a single number 0,1,2, telling which member you want to be active. This must be a member who is able to fight. Don't send back
1 if member 1 is dead.
Each turn, you need to decide what to do.
battleState here is exactly as described above.
To use a move, send back the slot the move is in. For example, if I assigned Punch to slot 0, sending
0 performs Punch.
To switch to another member, send the member's slot plus ten. So to switch to member 2, send
Anything not in [0,1,2,10,11,12] is considered invalid and will result in no action taken this turn.
After every two battles, you receive a secret bonus point for each team member.
Your team state is the same as shown above, don't make me repeat it.
Your response will represent what stat to increase for each team member. Attack is 0, Defense is 1, Speed is 2.
So to raise member one's speed, member two's attack, and member three's defense, you would respond with:
The controller can be found on BitBucket: https://[email protected]/Geobits/codemon.git
Just toss all of the compiled class files, submissions, and players.conf in a folder and run.
The controller's main class is called
Tournament. Usage is:
java Tournament [LOG_LEVEL]
Log levels from 0-4 give increasing information. Level 0 runs the tournament silently and just gives the results, where level 3 gives turn-by-turn commentary. Level 4 is debug output.
You can add submissions to the tournament in
players.conf Simply add the command line string needed to run the program, one per line. Lines starting with
# are comments.
In your post, include the command I will need to add to my
players.conf, and any compilation steps (if required).
Included is a dummy team comprised of all Normal members with the three Normal moves. They choose moves randomly and have terrible stats. Have fun beating up on them.
You may not read or write to any external resources (except in your own subfolder, up to 32 kB as noted above).
Your team needs to go into the tournament "blind". That means you can't analyze other people's source to figure out what a specific team/monster will do in a given situation. You can analyze your opponent's moves/stats and keep track as the tournament progresses, but no hardcoding this information in.
Do not interfere with other processes/submissions. No invoking them, using reflection to get at their data, etc. Do not mess with my computer. Just don't try it. This is at my discretion. Violators may be barred from future entry.
Contestants are limited to a maximum of two entries. If you submit more, I will only score the first two submitted. If you want to revoke one, delete it.
Entries may not exist solely to prop up other entries. Also, you may not try to indirectly disqualify other contestants (for example, using a 27M character team name to DQ players that try to write this to disk). Each submission should play to win on its own merit.
Your program may spawn a maximum of one child process at a time (total descendants, not direct). Both the main and any child processes must terminate directly after giving output. Either way, ensure you don't go over the timeout.
The tournament will be held on my computer running Ubuntu with an Intel i7 3770K processor.
These are the results of the current players. It's very close between the top contenders, and I'm thinking about bumping the number of rounds up to 500 (and adjusting the spacing of bonus points to match). Any objections, comments?
------- Final Results ------- 158 Happy3Campers 157 LittleKid 71 InsideYourHead 68 HardenedTrio 46 BitterRivals
Full play-by-play results on Google Drive