I2P(F)-Simon Kye-Mini Project Week 2

Today I was unable to complete the mini project, but I am very satisfied and happy with the progress I was able to make with my product as I know I’ve pushed myself to try new things that I’ve learnt in class, but never really used in any of my daily challenges. Below (1st image) is the code that I ended up with. I’ve hit a wall that I’m unable to get over for now. This is what I planned would happen. The game would start of with introducing the player. The player would then choose a word to be guessed and this would be stored in the variable word. Right now the gameLetter() doesn’t mean too much. If we skip that and go to the for function on the bottom, it makes it so that for each letter within word, it puts it into the characterList, and each time that happens, it also adds a _ for blanks list. This is why the amount of _ corresponds to the amount of letters in the word. The while function is made so that if the score (correct answers) is less than the amount of letters in the word, the game continues as it runs the gameLetter function. We can now go into the gameLetter function. It sets the gameScore to 0 and if the character that player 2 guesses is in the character, it would find the index of the letter of the guess that matched the word and replace that blank with the letter. This is how the _, _, _, _,_ turns into a h, _, _, _, _. It then prints the list blanks and it is luckily formatted in a way that I don’t have to edit the format the list is made in. This also adds to the gameScore everytime you are right, and we already made sure that the gameScore is corresponding to the amount of letters in the system. If this number increases to the length of the word, then it prints ‘You win!’ and ends the game. Ofcourse if the letter doesn’t correspond then the answer is wrong and says try again. I tried implementing lives too (2nd image) but came up red and I did not know how to fix it so I took a step back and tried it with infinite lives. For some reason, my game will only accept the first letter of the word and nothing else (3rd image). If I put in the first letter of the word the amount of times corresponding to the length of the word, it says I win. I have no idea why it does this and I can’t even look at other people’s blogs at the time of posting for help. So currently this is all I have, but I am proud of trying something new and more experimental 

 

 

Leave a Reply