PokéBattle
The program is the transcript of a Pokemon battle. Every Pokemon's HP is a variable.
2016 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
PokéBattle dates from 2016. A program reads like a battle log. Two trainers name their teams, send out a Pokemon each and take turns, and every move does arithmetic on HP. Each Pokemon starts with 5 HP, and HP has no bounds, so a Pokemon at 0 or below keeps fighting.
Read the story
There are two versions. Strict PokéBattle allows six canon Pokemon per trainer. Open PokéBattle allows any number with any names. This implementation runs Open, so a Strict program runs too.
The machine
A program starts with the teams and Battle Start!, then turns of exactly two commands, one from each trainer, and ends with Battle End! and Winner:. "Foe" is the other trainer's active Pokemon.
| Command | Does |
|---|---|
X uses Tackle! and 9 more | Foe loses 2 |
X uses Flamethrower! and 9 more | Foe loses 4 |
It's super effective! / It's not very effective. | After a damage move, double or halve it |
Hyper Beam Dragon Rage | Foe loses the user's HP |
Fissure Guillotine Sheer Cold | Foe drops to 0 |
Absorb Leech Life | User gains the foe's HP |
Skill Swap Heart Swap | User copies the foe's HP |
Blizzard Thunder Wave Sing | Skip the next command if HP are equal, unequal, foe lower |
Swords Dance Barrier | Print the user's HP as a character, as a number |
Growl Lear | Set the foe's HP to an input byte, an input number |
T uses Potion! | Add 1, 2, 4 or 8 to T's active Pokemon with Potion, Super, Hyper, Max Potion |
T: That's enough! Go Y! | Send Y out |
T thinks about Turn n. | Jump to turn n |
Splash, flinches!, tried to run away! | Nothing |
Example
Two Pokemon absorb each other three times, which makes 65 and 105.
Two Pokemon absorb each other three times, which makes 65 and 105. A Max Potion and a weak Tackle leave Pikachu at 72, and two Swords Dances print H and i.
The Hello World works the same way in 26 turns. Its truth machine reads a number into the foe with Lear, knocks Gj2ian out with Guillotine, heals it to 1 and compares with Blizzard. On 1 it loops printing 1. On 0 it jumps to turn 5, but that turn prints Gj2ian, still at 1, so it prints 1 there too.
Patterns it teaches
- Camouflage: the program passes for a battle log.
- Counter machines: HP are unbounded counters, with a skip and a jump.
Further
See also
Also in Camouflage
Write your own in Run Convert a program from PokéBattle
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: pokebattle.
Command line
shib run pokebattle program.txt --input '0'The program is long; save it as program.txt first.
shib manual pokebattleSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/pokebattle.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org