Skip to main content

Questions tagged [pset4]

The standard edition of Problem Set 4 will move beyond C programming language basics, testing your knowledge of pointers, memory management, file i/o and structs.

Filter by
Sorted by
Tagged with
0 votes
1 answer
401 views

pset4 ball won't move on click?

I'm having some trouble getting the ball to move when the user clicks at the start of the game. I have the code below positioned in main, right after everything is instantiated, and before the while (...
Jane's user avatar
  • 13
0 votes
1 answer
208 views

Why Does the Ball Disappear After Calling move()?

Code runs perfectly when the initialization functions are called. I get the bricks, the ball and the paddle which moves with mouse. However, when program calls move(ball, velocity, vertical); where ...
ronga's user avatar
  • 1,415
4 votes
4 answers
1k views

Running breakout on Mac OS X

There's a similar question about running breakout on Linux variants: Can't run Breakout outside of appliance My question is specifically about compiling breakout (and hence SPL) on Mac OS X. So ...
Luke Van In's user avatar
  • 2,655
3 votes
2 answers
504 views

Bricks aren't disappearing when hit with the ball

I wrote the following code (within the while loop) but my bricks aren't disappearing. My ball just hits the bricks and bounces off. What am I missing here? GObject object = detectCollision(window, ...
dottified's user avatar
0 votes
4 answers
726 views

How to make ball initially go at random angle?

I don't want to have my ball go at a random velocity when it starts, just a random angle with respect to x. The specs say to use drand48, which I tried, but that makes the ball go really slowly or ...
dottified's user avatar
0 votes
1 answer
711 views

Pset4 error: invalid operands to binary expression ('double' and 'double (*)(void)')

The following error occurs in the lines where the velocity of the ball is initialized/changed using the drand48 function: When velocity is initialized : if(getEventType(event) == MOUSE_CLICKED) { ...
user1580's user avatar
1 vote
2 answers
683 views

Can't run Breakout outside of appliance

I have just finished implementing Breakout, and tried running it outside of the appliance in my Debian machine, but i get the following error, even though it's the same directory that's shared between ...
Oussama's user avatar
  • 27
0 votes
1 answer
359 views

Segmentation Fault in Pset4 when detecting is brick is hit

My code works well except when I insert the following code to detect if a brick is hit, I get a segmentation fault. Does anyone know why ? This is the short code inserted : // bounces if hits ...
Loic's user avatar
  • 25
1 vote
1 answer
739 views

Why does the ball glide along the paddle whenever it touches its sides?

I have no idea why the ball will glide through the paddle when the side of the paddle is hit. It is not the same as normal case when the ball hits the top of the paddle and it bounces back. I have ...
Doufulai's user avatar
0 votes
1 answer
1k views

pset4 image resize properly but check50 says not correctly

:) resize.c and bmp.h exist :) resize.c compiles :) doesn't resize 1x1-pixel BMP when n is 1 :( resizes 1x1-pixel BMP to 2x2 correctly when n is 2 :( resizes 1x1-pixel BMP to 3x3 correctly when n is ...
Rodrigo Schio's user avatar
2 votes
2 answers
523 views

Why Do I Get a Segmentation Fault When Trying to Move the Paddle?

I am trying to get the paddle moving with the mouse but I keep getting the same error message : "Segmentation Fault (Core Dumped)". This is my function, which is very simple. Any suggestions? // ...
Loic's user avatar
  • 25
1 vote
1 answer
110 views

Pset 4 Ending Game?

I got a problem, the game only ends after losing the 3 lives, but after destroying all bricks it doesnt... anybody know what is happening? I noticed that the condition was while(lives > 0 && ...
Joao Turolla's user avatar
0 votes
1 answer
279 views

How to Return a GRect From initPaddle()?

Just one quick question, what should I return in the InitPaddle function? I made to put it on screen without returning anything, but in the step to step tips ain the pset`s page says that I have to ...
Joao Turolla's user avatar
0 votes
0 answers
167 views

How to Fix "Found "result" when expecting ","`" Error? [duplicate]

Please help me! I am stuck at pset4. My code is correct, but in the middle of the game it is giving the error error: Found "result" when expecting "," How to fix this error?
user1411's user avatar
7 votes
2 answers
425 views

getType() causing a seg fault when called on object as returned by detectcollision?

This one is driving me nuts! Why would I get a seg fault when calling getType() on 'object' as returned by detectCollision()? gdb revels this is where the memory error is happening but as far as I can ...
tidymonkey81's user avatar
1 vote
3 answers
1k views

Can't run the staff implementation

i can't run the staff implementation for any problem set, i always get the same error, it's always something like : bash: ~cs50/pset4/breakout: No such file or directory
user1383's user avatar
0 votes
2 answers
196 views

Placing bricks precisely with initBricks (using floats and integers)

i'm trying to be very precise with the positioning of my bricks when using initBricks. however they are not placing exactly where they should be 9out by small fractions) and i'm pretty certain it is ...
tidymonkey81's user avatar
0 votes
1 answer
146 views

pset4 y m getting this error

if (strcmp(getType(object), "GRect") == 0) { if(object==rect) { if(velocity>0) { velocity=-velocity; } } else { removeGWindow(window,...
Paurush's user avatar
-5 votes
1 answer
305 views

PSet4 (breakout ) ball is not moving :(

Ball is not bouncing :( while (lives > 0 && bricks > 0) { GRect rect = newGRect(162, 573, PWIDTH, PHEIGHT); // TODO add(window,rect); setFilled(rect,true); ...
Paurush's user avatar
0 votes
3 answers
718 views

gevents.h File Not Found

When I compile this for pset4 #include "gevents.h" #include "gobjects.h" #include "gwindow.h" int main(void) { // do something } I get this error jharvard@appliance (~): clang -ggdb3 -Ispl/...
Paurush's user avatar
0 votes
1 answer
484 views

pset 4 breakout ball hitting bricks

I am having trouble with hitting all my bricks. I'm done with all 10 steps in the pset but when I get to hitting the last 3 - 5 or so bricks, my ball doesn't have enough "randomness" to hit them. My ...
Msholly's user avatar
0 votes
3 answers
325 views

initBricks as a 2d array of labelled bricks

i am trying to create a labelled 2d array of GRects called brick[i][j]. implementing the code below i am getting an error: breakout.c:112:23: error: variable-sized object may not be initialized ......
tidymonkey81's user avatar
0 votes
2 answers
521 views

How to Initialize Bricks in breakout?

starting pset4 but can't understand how to initialize bricks. Thnx in advance!
Paurush's user avatar
0 votes
2 answers
97 views

Do we need to implement "God" mode for the standard edition of problem set 4?

I see in the staff's implemented solution for the standard edition of problem set 4 that "God" mode works, however I see that it is asked for only in the Hacker edition. Do we need to implement "God" ...
Mercury's user avatar
  • 259
1 vote
2 answers
343 views

PSET 4(breakout) : Paddle goes out of window

When i try code for moving paddle setting location x = getX(event) -getWidth(paddle)/2; but with this a part of my paddle goes out of window. What should i do ?
Mercury's user avatar
  • 259
2 votes
3 answers
842 views

Collision of ball with other objects

I don't understand what I actually have to do for the collision of ball with other objects. I am at the state where ball and paddle are just moving but collision is not yet defined. What should I do ...
user1199's user avatar

1
33 34 35 36
37