C. Program Description for Developers

Adventure

The story follows an individual named Breadon, who is sent on a journey to disrupt an enemy nation’s invasion of his city.

Once he arrives, he makes it to a tavern where he gambles his money in the game High Low Seven 

He talks to a Pilaf soldier, hoping to extract information of the army’s current plans of attack

If he fails, he must fight the soldier for the information. If he succeeds, the soldier gives it to him.

After sleeping, he arrives at the soldier’s barracks, where he encounters the same soldier as in the tavern.

He will fight him regardless of the previous result. If he loses, the game restarts. If he wins, he gains the soldier’s armor, increasing his maximum health.

A second tavern appears where he gambles his money in the game Hangman. Here, he can acquire tier 3 items, getting him ready for the boss.

Once he enters the castle, he will proceed through 4 guarded gates. At each gate, he will have to answer 3 questions. If he gets one wrong, he will have to fight that guard. Once he defeats the 3 guards, he will have access to the council of rice. The goal will be to kill the council.

If you complete the mission, you will return to your king and be given the title of Baron of Texas Toast.

A decision-based story was created with many if functions. The player can choose two dialog options, each having its own response. The questions are coded similarly to conversations, using an if function. If the player inputs the correct answer, the game continues. If he gets the answer wrong, combat initiates (depending on the NPC).

High Low Seven

High Low Seven exists within the main code. There are 5 variable types that are mostly implemented in the game: currency, bet, choice, sumDice, and winnings. A currency variable with a value of 75 was made so the player could bet. The currency used is called gold. The bet variable was made so the player could bet any amount of gold he/she possessed or quit the game. The choice variable was made so the program could determine whether the player chose High, Low, or Seven. SumDice is a variable that adds the values of two dice rolled together, which ranges from 2-12. The winnings variable is what gives are takes away gold from the player. If the player wins, winnings will be positive (give). If the player loses, winnings will be negative (takes away).

The game is played in a while loop, which will only stop if the player bets 0 or the player has more no gold to bet. The game will first display how much gold the player and ask him/her how much he/she wants to bet. If the player makes does not make a proper bet, then the program will ask him/her to enter a valid bet until valid in a while loop. Once a valid bet has been made, the program will ask the user to enter “H” (High),  “L” (Low), or “S” (Seven). The same will happen with the player if he/she does not enter a valid choice similarly to the bet while loop. Once a valid choice has been entered, the program will randomly generate 2 values ranging from 1 to 6 in a while loop. The program will then output a display that shows both dice rolls. The value of each dice is then added to sumDice, which also is displayed to the player.

The winnings are determined by an if-statement. The first statement checks if the player went High and sumDice was 8 or higher. The second statement checks if the player went Low and sumDice was 6 or lower. The third statement checks if the player went Seven and sumDice was 7. If none of these statements satisfy the program, then winnings is negative (fourth statement).

If one of the first 2 statements are true, then the program will display that the player won 2 times his/her bet. If the third statement was true, then the program would display that the player won 4 times his/her bet. Only the fourth statement will cause the program to display the user has lost his/her bet.

SumDice is then reset to 0 just in case another game will be played.

Hangman

Hangman is a function that is called from the main code. In the main code, the player enters an input on whether he/she wants to play the game. If the player enters 1, the Hagman will play. If the player enters 2, Hangman will not play. Once the function called, the code gathers a random word out of an array. A random word is chosen by firstly gathering the length of the array (how many words exist). Then a variable will bet equal to a random value between 1 and the array length.  This random value is then used to gather that specific element in the array.

After a random word has been taken from the array, a blank word (spaces in between letters and letters are “_”) is created through a for-loop.

The program will then welcome the player to the game a print statement, which is followed by the process of making spacing in between the letters in the random word (Ex: “T E S T”).  For the example “T E S T”, the blank word would look like  “_ _ _ _”.

The two variables “plays” and “plays1” are used to display the right and wrong letter guesses with proper spacing. There must be two variables because advancing a space in both when a right or wrong guess isn’t made will mess up the spacing. An example would be when the player guessed right on round 1 and 2 “B A” and wrong on the third round ”    D”.

The character variables’ rightG and wrongG are used to display the right and wrong letter guesses inside the upcoming while loop. If the player has not made any wrong or right guesses, then the program will output that the user has not made any incorrect or correct guesses.

After these values are initiated, a while loop will begin that doesn’t end until the player has incorrectly guessed 6 times or he/she has guessed the word correctly. The program output how many guesses player has left so he/she can play accordingly. The player is then asked to guess a letter. If the player inputs nearly anything that is not a valid letter, the program will ask them again until a proper answer has been made.

After a valid letter guess has been made, a for loop will check if any of the letters in the random word are the same as the guesses word. A variable called score is equal to 0 when there is no similarity and 1 when there is a similarity. When the loop finds a similarity, the blank word will be filled with the correctly guessed letter. An example would be “T _ _ T” in which the player has correctly guessed T.

When score equals 1, the output will display the player was correct and rightG will be updated with the new guess. An output displaying that the player was incorrect and an update of wrongG with the new guess will occur score equals 0.

Once the while loop has ended or broken, the program will finally check if the player has correctly guessed the word. If the player did not correctly guess the word, then the output will display the word.

Combat

Within the game, combat is its own function that is called in the main code. Once the function is called, it brings in the player and enemy stats for that specific encounter. Next, the coin-flip advantage is rolled which affects one of the player’s stats. Combat begins after with the player going first.

The combat in this game is turn-based which means that only one character is taking action at once. Each turn consists of a number of action moves that are tied directly to the AP value of the character. For example, if the player has 5 AP, they can perform 5 action moves per turn. This is accomplished with a value that counts up by one for every action taken until it is the same value of the character’s AP stat.  Once the values are equal, the character’s turn ends and it becomes the opposing character’s turn.

The action moves that can be performed by the player and enemy are ‘Attack’, ‘Relocate’, and ‘Heal’. When an attack move is performed, the role of a seven-sided die in addition to the character’s base attack value is subtracted from the opposing character’s health. When the character performs the heal move, there is a check to make sure the character’s value for the amount of potions isn’t zero. If it is, the heal will not be successful. When the character does have potions, 15 points will be added to the character’s health stat along with the value of a five-sided die roll. When the player chooses to relocate, there is a 50/50 chance the player can either gain or lose an AP. This is to simulate the player trying to get in a more tactically advantageous position in battle. If relocation is successful, the AP counter goes down by one, adding another move. If it fails, the counter goes up by one, losing a move. An additional command, ‘Status’, can be entered to check the health of both combatants as well as the player’s AP at no cost.

Once it becomes the enemy’s turn, they will either attack the player or heal. When the enemy’s health is below 65 and they have a potion value greater than zero, they will use a potion and heal. Otherwise, the enemy will continue to attack the player. The enemy will eventually use up all their moves and it will become the player’s turn again. This cycle will keep repeating until one of the combatant’s health is lesser than or equal to zero.

The player turn and enemy turn are in two separate while loops so that only one can be on at a time. This is done using a variable that switches between 1 and 2. When the variable is 1, it is the player’s turn and the player while loop activates. The variable then changes to 2 when the player uses up all his moves. This deactivates the player while loop and activates the enemy while loop. The enemies’ turn works in a similar manner. When it ends, the variable changes back to 1, deactivating the enemy while loop and activating the player while loop.

An input command is used to determine the player’s course of action. When prompted, the player types in the command they want to choose. for example, if the player wanted to attack, they would type ‘attack’. The player’s input is compared to the programmed commands in the game. If a command the player inputs doesn’t exist, it will tell the player the command isn’t valid and ask for a valid command.