Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use stdio as io
- const ATTACK = 99
- struct Warrior {
- String name,
- Int life
- }
- Warrior yannick = Warrior { name = "Yannick", life = 100 }
- Warrior guillaume = Warrior { name = "Yannick", life = 0xFFFF }
- Bool attack(Warrior attacker, ref attacked) {
- for i = 0 to ATTACK by 1 {
- attacked.life -= 1
- }
- if attacked.life < 0 {
- attacked.life = 0
- }
- return attacked.life == 0
- }
- Bool died = false
- while not died {
- Bool died = attack(attacked = yannick, attacker = guillaume)
- if not died {
- io.println("Il reste ${yannick.life} points de vie à ${yannick.name}")
- }
- }
- io.println("${yannick.name} est mort au combat")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement