14168 - Great Debate   

Description

In an alternate universe, arguements are won through strength instead of intellect; therefore whenever someone disagrees with someone else, they initiate a duel with one another until only one of them is left standing.

One day, Aurick was arguing with his senior, Dunqian, about whether or not cereal is a soup. Because they cannot seem to agree with each other, they must duel.

The mechanic of the duel is as follows:

  • The duel can only last for 20 rounds. If both duelists are still standing, then they will duel again the next day.
  • Each duelist has 9 variables:
    • Name
    • Health
    • Strength
    • Magic
    • Healing Power
    • Defense
    • Resistance
    • Move
  • When the match starts, duelists will perform their action at the same time. After they perform their action, they must switch to the next attack type.
  • The next move is determined by a simple loop:
    • Magical  -> Physical
    • Physical -> Heal
    • Heal -> Magical
  • Because the each duelists attack at the same time, there are three possible scenarios that can occur:
    • Duelist A wins
    • Duelist B wins
    • Draw (either both of them getting knocked out or agfter 20 rounds has passed)

(If the Defense/Resistance stat is more than the Strength/Magic stat, the damage dealt will be 0) 

Your job is to code the following functions:

void magicalAttack(struct Duelist* self, struct Duelist* target); (attack using magic against resistance, switch to physical attack)

void physicalAttack(struct Duelist* self, struct Duelist* target); (attack using physical against defense, switch to heal)

void heal(struct Duelist* self, struct Duelist* target); (heal user's hp,  switch to magical attack)

struct Duelist getDuelist();

*Do not forget to include the struct and the 4 function declaration at the top of the submitted code*

**Healing can go over the starting health value**

Input

The input comes in 2 lines.

Each line contains the variables of each participant as follows:

name - health - strength - magic - healing power - defense - resistance - move

(0 <= stats <= 100)

Output

The health value of each duelist every round (already done in main)

The result of the match (already done in main)

Sample Input  Download

Sample Output  Download

Partial Judge Code

14168.c

Partial Judge Header

14168.h

Tags




Discuss