September 30, 2014

Week of 09/21/14 - Python Part 03

    This week, what I did was work on the "Battleship!" lesson on codeacademy, where I make a game of battleship using a list of lists, random integers, and for loops. What I was doing on friday was screwing around with the code, like trying to make it so the player doesn't have to type 0-4, and instead 1-5. I was also trying to use a snippet of code that I found on stackoverflow, which would let me check if someone typed in letters instead of numbers. However, I couldn't figure out how to use that snippet to ask the user to give input again, using only a number. It would probably require another for loop or something. I also tried making it so that the board would have the rows and columns labeled. And then somehow I broke the definition of print_board(board), and I'm pretty sure it was something further down, but, I don't know what went wrong or how to fix it. So now I'll probably revert to a previous part of the lesson, copy all the code I wrote, replace it, and try my modifications again.

No comments: