Coding Practice - Dungeon Crawler



In this challenge, you will allow the user to enter the name of 6 adventures. After that, the application will run with no more user interaction except advancing the application when you pause it.


Enemy Set-Up

Create a collection to store the enemy types that the adventures will battle in the dungeon, as well as a randomly generated amount of damage the enemy will do

Example: A goblin will do from 12 to 18 damage. A troll will do 25 to 32 damage.


Use a STACK to create an “enemy deck” that is randomly populated from the enemy type collection you created. An enemy type will show up multiple times in the deck.

Example: troll, goblin, goblin, bandit, warlock, bandit, troll…


Create a collection to store the name of a location where the character can not do battle


Create a collection to store the name of an enemy type that character can not fight


Dungeon Map Set-Up

Create a collection to store the name of location types as well as a randomly generated number of enemies found at that location

Example: Dungeon Entrance will have 1 to 3 enemies, Throne Room will have 5 to 8 enemies


Create a QUEUE to store the order of locations that will be traveled by the adventurers. The same location type can show up more than once

Example: Dungeon Entrance, Hallway, Crypt, Hallway, Throne Room…


Character Set-Up

Create a collection to store the name of the six adventurers entered by the user.

Create a collection to generate a hit point value for each character randomly

Example: “Tron” has 50 – 100 hit points, “Bear” has 50-100 hit points.


Create a collection to store the name of a location where the character can not do battle

Example: Bear can not do battle in the Throne Room


Create a collection to store the name of an enemy type that character can not fight

Example: Tron is useless against Trolls


Automatic Game Play

After the player enters the character names, the game plays automatically, following these steps.


  • Characters enter the first location in the QUEUE and are informed of the number of enemies they will battle.

  • An enemy is drawn from the enemy deck.

  • A random character is chosen to fight the enemy.

  • If that character can not fight in the current location or can not fight the current enemy type, their hit points are reduced by the enemy damage value.

  • Otherwise, the character defeats the enemy.

  • Another enemy is drawn from the deck, and the process repeats for every enemy in the current location.

  • If any character's hit points reach zero, that character is dead and can no longer fight.


Once all the enemies are defeated for the location, the characters move to the next location.

Whenever the characters change location, the hit points of the characters are displayed.


Battle Rules

A character does not have to battle the same enemy if they have taken damage by that enemy.


A character does not have to battle in the same location if they have taken damage in that location.


End Game

If at least one character has survived to the end of the dungeon, the player wins.


If all of the characters die, the player loses.

169 views0 comments

Recent Posts

See All