F. Discussion

Normtech Dice Game

 

Testing

The testing process was very smooth for this game. The script was ran after typing each line in order to ensure that there would be no surprises at the end. There was also a lot of commenting done and so when adjustments needed to be made, the quick additions were easy.

Progression

As mentioned above, the testing was very linear and simple and so it didn’t require that much finesse. However, the progression was seen in the testing of the odds. It was noted that the game was too easy to will and so the winning value was increased from 15 to 18. This changed the odds from about fifty percent to about thirty percent.

Obstacles

In the Dice game, one of the obstacles was having the mat lab choose a random integer between 1 and 6. Even when using the random integer function, it continue to give out a decimal value. All of the functions recommended in Matlab were used but with no success. Eventually the problem was solved by creating a variable, n, which was equal to the number of sides of a die, 6.

21 Sticks

 

Testing

The errors which occurred were throughout the entire project. The first error was that the AI would enter four numbers after every time the user went. The second error was that the program would crash if the user did not enter 1 or 2 sticks. The third error occurred outside of the while loop in which the user kept losing despite the result landing on an odd number, which was the user’s turn. The first error was solved by creating a new variable turnCounter, which determined whose turn it was (odd for the user, and even for the AI), which only gave both the user and AI to only enter one number. The second error was solved by placing a while loop so that if the user did not enter 1 or 2, it would keep prompting the user to enter 1 or 2. The third error was solved by using the mod() command and using an if statement to determine if the remainder was even or odd (1 for odd, 0 for even).

Progression

At first the code was only composed of one while loop. The idea was that if the sum of the numbers entered was 21 or greater the code would then go to an if statement. However, that did not work because the sum would. Then, it was realized that a break statement was required in order to not make the loop repeat again. The code was revised so that it was composed of two parts: a while loop and outside of the while loop. The outside of the while loop determined if the user won or lost. After the while loop was designed with break statements in order to make sure that the conditions were met.

Obstacles

The obstacles faced during this project were getting the user and AI to go in turns, as well as getting the program to exit when the sum had reached 21.

 

Battle Ship

 

Testing

The testing for this particular game was much more of a rigorous task because involved more than just a coded game. The visual component was hard to control, particularly the placement of the pins where guesses were made. The code required that quite a bit of it be written between test runs and so the debugging process took much longer than expected.

Progression

The biggest progression was seen in the AI. The artificial intelligence within the game was supposed to be the most difficult part of creating this game. Although it was a lot of coding, it wasn’t the most difficult part and it was very satisfying when it started to work. Instead of giving random guesses on the board, it guessed randomly until it got a hit, then it began guessing in the area around the initial site of the hit.

Obstacles

The previously mentioned obstacle of placing guesses or pins on the boards was the most difficult obstacle. At first, pins and ships alike could overlap on the board, the computer would guess the same location multiple times, and the graphics weren’t coming through quite right. However, with some debugging and many lines of added code, the problem was solved. The game needed to have a way to prevent the overlapping of any pins and especially any of the ships. Also, in order to be difficult enough, the same location should not be able to be guessed by the enemy. These were the last obstacles to be overcome before the game was ready for testing.