Digiwar: Battle of the JAVA Monsters

For Submission of 10 digimons:

  1. JAVA File
    1. All Digimon Classes should be under package:
      • ph.softartifact.digiwars.data.model.<school>
    2. Kindly submit only the 10 Digimon JAVA Files. XXX.java. (not the .class)
    3. No additional JAVA files will be accepted.
    4. External classes will not be allowed. Declare them as inner classes.
    5. Your 10 Digimon JAVA files should have NO dependency to other classes. Every Digimon class should stand on its own.
  1. Submission Packaging
    1. Put into RAR file with RAR name: <SCHOOL>.rar
  2. Email Submission
    1. Email to: [email protected]
    2. Subject: DIGIWARS:<SCHOOL>
    3. Date of Submission should be before: July 12, 2013 8pm. (Adjusted from 5pm)
  3. USB Submission
    1. USBs containing the Digimons will be collected on July 13, 2013 11am, to override the Digimons submitted online on July 12, 2013 8pm

You can download the project here.
Date Updated: July 10, 2013 (July 12, 2013 will not be used, we revert back to July 10, 2013)
https://docs.google.com/file/d/0BwoTHWconhEPc0pJOUkyVmZVNk0/edit
Take note of the last update date.

Changes:

  1. The timer is officially set to 60 seconds. Since this is a round robin, and there are 4 official contestants, 4!/2 = 12 combinations. with 1 minute each and max of 5 fights each, we’ll have 36 min to 1 hour duration.

Rules Changes:

  1. The team who will cause the System to Loop Infinitely will lose the fight.
  2. The fight ends either when Fight Timer Ends or when the opponents’ Team Life is depleted to 0.
  3. Regeneration
    1. For Active Digimon: Before every turn, MP regenerates by 1
    2. For Inactive Digimon: Before every turn, MP regenerates by 2 and HP by 1.

—————————-

This year, SPEED-IT will be hosting its first ever DIGIMON Wars, which will showcase Programming skills of participating schools in terms of JAVA Coding, and Turn-Based Strategy Making.

To allow even the member schools to participate in this category, all codes are developed by Soft Artifact, Incorporated, and it abides by the non-disclosure agreement established between Soft Artifact and SPEED-IT.

Event Overview (Updated July 12, 2013)

  1. Every school will send off two participants.
  2. These participants will develop ten (10) Digimon Classes (Extending Digimon class) combined.
  3. Every school will play with all other schools in a round robin fashion. Every encounter with another school is considered a game.
  4. A game is composed of a minimum of 3 fights and a maximum of 5 fights.
  5. A game is won by winning 3 fights.
  6. There will be no coding during July 13, 2013. Matches will be done live by running the codes.
  7. Coding will commence on July 1, 2013 during the orientation and will end on July 12, 2013 5pm.
  8. All ten Digimons should have been submitted by July 12, 2013 5pm.
  9. Digimons will fight against other Digimons on a turn-based system. If the life of all Digimons present in the battle empties out, the participant loses.
Game Mechanics
  1. A game is composed of independent fights.
  2. When a fight is won, a score of 1 is added to the team’s game points.
  3. The team who first gets 3 points win the game.
Fight Mechanics:
  1. Before a fight begins, the participants select two of the ten Digimons they submitted. This is done without knowing the opponents’ choices.
  2. They then verify the authenticity of the Digimon files they submitted.
  3. Of the two Digimons they choose for the fight, they indicate which one is active, and which one is inactive. The active digimon is the first one to combat.
  4. This is a turn-based game. Teams take turn in executing a move. The system automatically facilitates the changing of turns.
  5. The active Digimon of every team engages to fight first. The inactive Digimon becomes active once the active Digimon initiates a TAG move or when the currently active Digimon dies.
  6. There are only 4 possible moves in the fight: ATTACK, MATTACK, HEAL, TAG. Actual codes are provided for the respective functionalities.
  7. Every turn follows this sequence:
    1. Check if the Active Digimon is still alive (HP>0). If it is dead, the inactive alive Digimon is switched.
    2. Regenerate Team (Active: MP+1, Inactive: HP+1, MP+2)
    3. Execute Move. If the move exceeds 1 second, the move is forfeited.
  8. Fight Timer is set to 60 seconds.
  9. The fight is finished when either the timer is down to 0 or when either of the team loses all its team HP (Team HP = 0).
  10. The team who will cause the System to Loop Infinitely will lose the fight.
Game Scoring

1. For the Game Scoring, in a fight there can be 3 possible results: WIN (1 point), TIE or LOSE (0 points). The first to arrive at 3 points wins the game. If 5 fights have been exhausted and the points of either team is below 3, then the team with the highest point win. In the event that both the teams get 0 point, then no winner is declared for that game. The Winner for that game is awarded 1 Game Point, while the Loser gets 0 Game Point. In the event that there is no winner in the game, both team gets 0 Game Point.
2. For the Final Scoring, the team who gets the most Game Points Win. In the case of a tie, the Total Fight Points are computed, and whoever gets the most fight points win. Still if the team arrives at a tie, a single fight rematch will be made.

The Game

Digimon Super Class

package ph.softartifact.digiwars.data.model;

/**
 *
 * @author Soft Artifact Incorporated
 */
public abstract class Digimon {

    public enum DigiMove {

        ATTACK,
        MATTACK,
        HEAL,
        TAG
    }
    protected DigimonStats digimonStats;

    public abstract DigiMove executeTurn();

    public void setStats(DigimonStats digimonStats) {
        this.digimonStats = digimonStats;
    }
}
For your every turn, you are only to take note of the following:
1. The system runs your executeTurn();
2. And you are to return a DigiMove either: ATTACK, MATTACK, HEAL, TAG. This will be explained.
3. You get a copy of your digimonStats at the start of the fight, so your code should be able to track your own Digimon Stats.
4. You will be fed of both the HP and the MP of the opponent Digimon before your executeTurn is run.DigimonStats

package ph.softartifact.digiwars.data.model;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 *
 * @author Soft Artifact Incorporated
 */
public class DigimonStats {

    private BigDecimal hp;
    private BigDecimal mp;
    private BigDecimal physicalAttack;
    private BigDecimal magicAttack;
    private BigDecimal physicalDefense;
    private BigDecimal attackAccuracy;
    private BigDecimal defenseAccuracy;

    /**
     * @return the hp
     */
    public BigDecimal getHp() {
        return hp;
    }

    /**
     * @return the mp
     */
    public BigDecimal getMp() {
        return mp;
    }

    /**
     * @return the physicalAttack
     */
    public BigDecimal getPhysicalAttack() {
        return physicalAttack;
    }

    /**
     * @return the magicAttack
     */
    public BigDecimal getMagicAttack() {
        return magicAttack;
    }

    /**
     * @return the physicalDefense
     */
    public BigDecimal getPhysicalDefense() {
        return physicalDefense;
    }

    /**
     * @return the attackAccuracy
     */
    public BigDecimal getAttackAccuracy() {
        return attackAccuracy;
    }

    /**
     * @return the defenseAccuracy
     */
    public BigDecimal getDefenseAccuracy() {
        return defenseAccuracy;
    }

    public void hitDigimon(BigDecimal attackPoints) {
        hp = hp.subtract(attackPoints);
    }

    public void initializeStats(int hp, int mp, int physicalAttack, int magicAttack, int physicalDefense, int attackAccuracy, int defenseAccuracy) {
        this.hp = BigDecimal.valueOf(hp);
        this.mp = BigDecimal.valueOf(hp);
        this.physicalAttack = BigDecimal.valueOf(physicalAttack).divide(BigDecimal.valueOf(10), 2, RoundingMode.UP);
        this.magicAttack = BigDecimal.valueOf(magicAttack).divide(BigDecimal.valueOf(10), 2, RoundingMode.UP);
        this.physicalDefense = BigDecimal.valueOf(physicalDefense).divide(BigDecimal.valueOf(10), 2, RoundingMode.UP);
        this.attackAccuracy = BigDecimal.valueOf(attackAccuracy);
        this.defenseAccuracy = BigDecimal.valueOf(defenseAccuracy);
    }
}

Let me explain to you the seven stats your digimon has:

  1. HP: Health Points. If this gets <= 0, your digimon dies.
  2. MP: Magic Points. This gets generated every turn. MP allows you to cast Magic Attacks and Heal.
    1. Your MP is drained by the same points you render a Magic Attack.
    2. When you HEAL, your MP is drained completely, and for every MP that is used up, your HP is equivalently replenished.
  3. Physical Attack: The number of points you can potentially damage your Opponent’s HP
  4. Magic Attack: The number of points you can damage your Opponent’s HP
  5. Physical Defense: If after the computation your physical defense is greater than your opponent’s physical attack points, you will be able to completely block that attack.
  6. Attack Accuracy: Makes for the Uncertainty Variance affecting the final attack points.
  7. Defense Accuracy: The probability at which your digimon will attempt to block the opponent’s physical attack.

Initialize Stats

At the start of every fight, the participant keys in the initial stats they would like to give to their Digimon.
For every digimon, they only have a maximum of 400 Integer Points Allowed.

For the Physical Attack, Magic Attack, and Physical Defense, the integer are divided by 10, and converted to a BigDecimal value.

Example:

HP: 200
MP: 50
Physical Attack: 100
Magic Attack: 0
Physical Defense: 50
Attack Accuracy: 50
Defense Accuracy: 100

During the initialization stage, the system will only consider the first four 500 points and will discard the rest. This means that this Digimon will only have:
HP: 200
MP: 50
Physical Attack: 100
Magic Attack: 0
Physical Defense: 50
Attack Accuracy: 0
Defense Accuracy: 0

during the fight.

Then, the three stats above will be converted to:
HP: 200
MP: 50
Physical Attack: 10.00
Magic Attack: 0
Physical Defense: 5.00
Attack Accuracy: 0
Defense Accuracy: 0

So, the Digimon will execute its strategy based on the stats it is provided with.

Computation of Attack Points
Given RAND(min, max) function,

1. Physical Attack

Range Normalizer =  1/3(Attack Accuracy);
Range = RAND(0,Attack Accuracy) – Range Normalizer;
Percentage Range = Range / 100;
Physical Damage = Physical Attack * (1 + Percentage Range);

2. Magic Attack

Physical Damage = Magic Attack (if MP >= Magic Attack; MP = MP – Magic Attack);
or
Physical Damage = 0 (if MP < Magic Attack; MP = MP – Magic Attack until MP = 0);

3. Defense

Range = RAND(0,100);
If Range > Defense Accuracy
Defense Status = True
else
Defense Status = False
Therefore:
Block = UNSUCCESSFUL

If Defense Status = True
Block = SUCCESSFUL (If Opponent Physical Damage > Physical Defense)
Block = UNSUCCESSFUL (If Opponent Physical Damage <= Physical Defense)

Move Technicality

If executeTurn() takes more than 1 minute, the digimon move is forfeited and the opponent makes its move.

Leave a Reply

Your email address will not be published. Required fields are marked *

*