Discussion (for all games)

Memory-

The first step towards creating memory was to pseudocode the entire game. During the process of pseudocode, it was decided that the game would contain 24 cards (12 pairs) and would rely on three main vectors. One for the randomized images(memorycards2), the second for the images placed in the same way as the first vector(memorycards3), and the third vector which would contain the images of flipped cards(flippedCards). The third vector would be modified to store the image in vector2 only when a certain condition was met. It was also decided that the vector “BlueDeck” provided by the ENGR 1181 would be used. The first obstacle was how to relate the three vectors. As the images can’t be used as a condition for example=if(memorycards2(1)==memorycards2(3)) is not applicable. Thus, command” memorycards3(i) = BlueDeck(memorycards2(i))” was used to relate the images with the numbers in “memorycards2” as the value in “memorycards2” became the index value for” BlueDeck” which was stored in the same index value as “memorycards2”. The rest of the coding was finished with no problem. Next was testing, during the first test the code worked the way it was intended. It was then discovered that the first half of the vector “memorycards2” was in the same sequence as the second half for example= v[ 1 2 7 8 10 5 3 9 11 12 4 6 1 2 7 8 10 …]. This made the game predictable. The issue was resolved by re-randomizing “ShuffleDeck” and assigning the second half of the vector “memorycards2” with this re-randomized vector.

 

Under seven, over seven-

 

Like memory the first step was to pseudocode. The two main variables were “money” which was the amount the user started and “bet” which was the amount of money the user wanted to bet. the images used were provided by ENGR 1181. the coding for this game was a simple process. Thus, the code for this game was finished in 30-40 minutes. During the testing process the game was working perfectly it was realized there was one problem that was not resolved. This was ending the game. The way the game was organized was that the loop where most of the code was running until the variable “state” =1 the only time the value of state was changed was when “money” <=0. This was intended to break the loop and display the message. However, this never happened.

 

Reference-

“Memory Game: Drawing a Grid of Tiles.” Khan Academy, Khan Academy, www.khanacademy.org/computing/computer-programming/programming-games-visualizations/memory-game/a/grid-of-tiles.

 

Leave a Reply

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