I can't copy the code from VMWare to Windows, so I took a screenshot: https://i.stack.imgur.com/jrqh3.jpg What am I doing wrong? I think my logic is correct and my code should work.
I get this output: https://i.stack.imgur.com/lhCbE.jpg
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
Look at the value of X after you create your first row of bricks. Using your image, that's 9 bricks in the first row. The 10th brick is going to be at x=405, outside the window. How are you going to position the 10th brick as the first brick of the next row? There's something missing. (Trying to make you think instead of just giving the answer. ;-) )
BTW, I noticed that there is no space between the top of the window and the top row of bricks. It's going to be kind of hard for the ball to get up there and bounce between the top of the window and the bricks, don't you think?
If this answers your question, please mark it as answered. Let's do the housekeeping on the forum. ;-)