October 2, 2014

Week of 09/28/14 - Python Part 04

    Okay, so this week I did some more screwing around with the Battleship game. Now, when someone inputs anything other than a number from 1 to 5, the while loop causes the entire thing to restart. It uses this code:

    While the Python course hasn't taught me how to do while loops (gettit?) or how to anticipate and fix value errors, I found part of this code on stackoverflow and adapted it to the battleship program.

    Then I tried to make it so that when the game prints, it print the board with the rows and columns labeled 1 through 5, so that the player wouldn't be confused. Then I made it so that it printed the board before the guess row input, with the labels for the rows put in brackets. I did the same thing for the columns, you can see it here:
    Then I started learning about while loops. It was informational.

1 comment:

Anonymous said...

Cool!