https://github.com/steliospapamichail/pokemondsl
A C++ based DSL used to program and execute pokemon battles.
https://github.com/steliospapamichail/pokemondsl
cpp cpp11 dsl pokemon
Last synced: 5 months ago
JSON representation
A C++ based DSL used to program and execute pokemon battles.
- Host: GitHub
- URL: https://github.com/steliospapamichail/pokemondsl
- Owner: SteliosPapamichail
- Created: 2023-12-21T09:59:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-21T21:44:44.000Z (over 2 years ago)
- Last Synced: 2025-06-20T06:55:54.067Z (about 1 year ago)
- Topics: cpp, cpp11, dsl, pokemon
- Language: C++
- Homepage: https://www.steliospapamichail.com/
- Size: 67.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# C++ based Pokémon DSL
Author: Stelios Papamichail (csd4020)
Std version: 11
# Compilation & Execution
In order to compile the project and create the executable, simply perform the following commands:
1) `mkdir build`
2) `cd build`
3) `cmake ..`
4) `make`
To execute the program, simply run `./PokemonLeague_4020` executable.
# Language Elements
## Pokemon Definitions
```
CREATE POKEMON {
NAME: "name",
TYPE: "type",
HP: health_points
}
CREATE POKEMONS [
POKEMON {
NAME: "name",
TYPE: "type",
HP: health_points
},
POKEMON {
NAME: "name",
TYPE: "type",
HP: health_points
},
...
]
```
Example:
```
CREATE POKEMON {
NAME: "Pikachu",
TYPE: "Electric",
HP: 120
}
CREATE POKEMON {
NAME: "Squirtle",
TYPE: "Water",
HP: 100
}
CREATE POKEMONS [
POKEMON{
NAME: "Ho Oh",
TYPE: "Fire",
HP: 120
},
POKEMON{
NAME: "Bulbasaur",
TYPE: "Grass",
HP: 85
}
]
```
## Ability Definition
```
CREATE ABILITY {
NAME: "ability_name",
ACTION: START
...
END
}
CREATE ABILITIES [
ABILITY {
NAME: "ability_name",
ACTION: START
...
END
},
ABILITY {
NAME: "ability_name",
ACTION: START
...
END
},
...
]
```
Example:
```
CREATE ABILITY {
NAME: "Electric_Shock",
ACTION: START
IF GET_HP(ATTACKER) < 30 DO
HEAL ATTACKER 25
ELSE
HEAL ATTACKER 15
END
END
}
CREATE ABILITY {
NAME: "Solar_Power",
ACTION: START
POKEBALL ATTACKER ---α
DAMAGE DEFENDER 20
END
}
CREATE ABILITIES [
ABILITY {
NAME: "Electric_Shock",
ACTION: START
IF GET_HP (ATTACKER) < 30 DO
HEAL ATTACKER 25
ELSE
HEAL ATTACKER 15
END
END
},
ABILITY {
NAME: "Blaze",
ACTION: START
DAMAGE DEFENDER 22
END
}
]
```
## Teaching abilities to Pokemon
```
DEAR "pokemon name" LEARN [
ABILITY_NAME(ability_name)
ABILITY_NAME(ability_name)
...
]
```
Example:
```
DEAR "Pikachu" LEARN [
ABILITY_NAME(Electric_Shock)
ABILITY_NAME(Lightning_Rod)
]
DEAR "Ho Oh" LEARN [
ABILITY_NAME(Solar_Power)
ABILITY_NAME(Blaze)
ABILITY_NAME(Tough_Claws)
ABILITY_NAME(Drought)
]
```