Questions tagged [pset3]

The problem set for Week 3 asks students to write code for a classic puzzle game in the C programming language.

Filter by
Sorted by
Tagged with
0
votes
0answers
24 views

Can´t see the professor implementation

I'm with the platform EDX, and in every pset is not possible for me to see the professors implementation in my appliance.
0
votes
1answer
292 views

Breakout: How do I remove a GLabel?

I'm trying to prompt the user to click to try again after he loses a life. I have implemented this by a GLabel. I am struggling to find a way to remove that GLabel message once the user has clicked to ...
0
votes
0answers
152 views

Ball Not Bouncing in Breakout

I just started working on making the ball bounce in Breakout (not incorporating drand48 yet), but I have tried multiple things and it remains still. I have posted that area of code below and would ...
0
votes
2answers
122 views

Pset3: The ball doesn't move

I can't make the ball move. I don't know where is the mistake. I hope you can help me. Here is my code. [code removed by mod to comply with academic honesty] /** * Instantiates paddle in bottom-...
0
votes
2answers
81 views

pset3 breakout: Only prints one Column of bricks!

My code: int blockspace = 3; int blockx = 0; int blocky = HEIGHT/4; for (int i = 0; i < ROWS; i++){ for (int j = 0; j < COLS; j++) { GRect block = newGRect(blockspace/2 + ...
0
votes
1answer
80 views

Breakout paddle disappears if I try to add color to the bricks

I'm working on Breakout and making good progress. I'm at the point where I'd like to add color to the bricks. I've implemented an array of colors that the 'if' loop iterates through to add color. The ...
1
vote
1answer
104 views

Segmentation Fault w/paddle movement (already changed initPaddle return)

I instatiated the bricks and paddle without any trouble, but when I try to have the paddle move with the mouse I get a segmentation fault. And this error doesn't occur until I move my mouse over the ...
0
votes
1answer
130 views

Binary search. What's wrong?

Hi this is my binary search code, something is not working, but find what it is? Also, I think the if statements should be changed to (if, else if, else) but the compiler yells at me if I code it like ...
0
votes
0answers
151 views

pset3 - check50 for find returns frowny face

I must be missing something on my code for pset3. When i run the Check50 i get this messages : :) finds 42 in {41,42,43} :( finds 42 in {40,41,42} \ expected an exit code of 0, not 1 After ...
0
votes
1answer
137 views

Ball won't bounce off sides

I've written some code to make the ball bounce off the edges and move diagonally. But the ball just disappears off the edge of the window! I've read elsewhere that I have to initialise the velocity ...
0
votes
1answer
132 views

Pset3 Binary Search gets “may reach end of non-void function” error or “inker command failed with exit code 1” [duplicate]

I'm going insane! Pset3 binary search. My code seems to be correct but I keep getting errors when trying to make helpers. Find works with generate when I search for a number that exists but hangs ...
0
votes
1answer
50 views

Stanford Portable Libraries not found [duplicate]

When I try to compile breakout I get the following error: breakout.c:16:10: fatal error: 'spl/gevents.h' file not found #include <spl/gevents.h> Did I miss an update?
0
votes
0answers
86 views

My linear search can't find any values. Why?

Here's the code for my pset 3, which fails to find the '127' in the stack. Any hints will be massively appreciated: bool search(int value, int values[], int n) { for(int i = 0; i < n; i++) ...
0
votes
1answer
1k views

Question regarding srand48 and time(null)

srand48((long int) atoi(argv[2])); Does this mean that srand48 will seed using a long and an int? } else { srand48((long int) time(NULL)); returns the number of seconds since epoch.. so ...
0
votes
1answer
197 views

“Control may reach end of non-void function” but I'm sure my else statements take care of it? [duplicate]

I know this has been asked many times before, but I looked through all the questions and still don't get it. I know what the error means, I'm just convinced that my code ensures that whatever happens,...
0
votes
1answer
341 views

pset3 --> label

in pset3 --> breakout I haven't been able to make the Scoreboard (label) to update after each brick broken or ball touching the bottom. I am printing in the gedit terminal the values of "lives" and "...
0
votes
3answers
194 views

So close on Breakout Problem set 3

When I run breakout.c with clang breakout.c it gives me "errors" EDIT: I also run this with make breakout (removeing the row_space) and gives me this ' breakout.c:(.text+0x1b8): undefined reference ...
0
votes
1answer
318 views

pset3 recursive binary search isn't working [duplicate]

My sort function is working correctly, but my binary search always fails to find value. I think my logic for the search is solid: I compare the value I'm searching for to the value at the midpoint ...
0
votes
1answer
183 views

Collision detection with the paddle

This is collision detection with paddle (bottom right and left ) But the ball passes through the paddle and it is velocity does not change. my questions are Is this the right implementation of ...
0
votes
1answer
95 views

PSET 3 Breakout ERROR

When I run breakout these error happen: breakout.c:141:9: error: unused variable 'row_space' [-Werror,-Wunused-variable] int row_space = 20; and breakout.c:29:11: error: implicit ...
0
votes
2answers
489 views

Pset3 - Binary Search : Control may reach end of non void function

I have written my binary search code, but every time i try to compile I get the following error jharvard@appliance (~/Dropbox/pset3/find): make helpers clang -ggdb3 -O0 -std=c99 -Wall -Werror ...
0
votes
1answer
76 views

Getting Started with Linear Search

To write the search algorithm in helpers.c... I need to conceptualize the array that will be searched. Where does the array come from? Generate.c or get input from a user through command-line? tbc???
0
votes
0answers
139 views

Paddle lags while ball is moving (Pset3 breakout)

Hey guys sorry in advance if I format this wrong it's my first time posting here. The problem i'm having with my code is the paddle lags maybe about 10 seconds behind the actual input while the ball ...
1
vote
1answer
544 views

How to use swap?

I am currently in pset3, implementing sort. I chose to do selection sort and at the end of it I need to swap the numbers, but when I try to compile, I get this message: implicit declaration of ...
0
votes
2answers
126 views

Pset3 - working on linear search

I'm currently working on adding the linear search and receive the following error when I try to compile... Also, when changing the code for helpers.c, is it necessary to compile that file or just ...
0
votes
1answer
112 views

pset3 breakout window compilation shows a fatal error

I'm struggling at the starting point of breakout in pset3. I've downloaded the breakout set using wget http://cdn.c50.net/2014/fall/lectures/4/m/scr4m.zip according to the CS50 2015 instruction. It ...
1
vote
1answer
312 views

Getting Many Breakout Errors

Here are some all the bugs im getting form breakout.c /usr/include/stdlib.h:376:13: note: 'srand' declared here extern void srand (unsigned int __seed) __THROW; ^ breakout.c:23:13: error: ...
0
votes
2answers
158 views

breakout - pset3 removeGWindow function

Anyone having this problem? it seems like my removeGWindow is having a problem but dont know where it was from. :/
0
votes
2answers
256 views

Pset3 - Code sorts, but does not find the needle using generate

I have the following code for helpers.c. When I run find, if I input numbers by hand, it sorts them and finds/doesn't find the n correctly. However, when I use generate to input the numbers, I can see ...
0
votes
1answer
349 views

Helpers code never finds a needle

I am working on helpers.c in pset3. I have the following code. Find.c compiles with helpers.c, but when I run it with "./generate 1000 50 | ./find 127", it lists lines with "haystack[n] =" where n = ...
0
votes
1answer
111 views

Segmentation fault when calling updateScoreboard

I'm hitting a wall with the last few steps of breakout, so all help appreciated. When the pre-written updateScoreboard function is called (after the ball hits a brick), the program freezes and I ...
0
votes
0answers
73 views

Control may reach end of non-void function [duplicate]

I have read the following and am still unable to answer my question: How to Fix “control may reach end of non-void function” and “No such file or directory” Errors? Error: control may reach end of ...
0
votes
1answer
153 views

Breakout — ball continues bouncing after it moves past paddle

i'm currently working on breakout.c, but i'm having trouble with the ball continuing to bounce off the bottom even after it drops below the paddle (step 9 of the spec walkthrough). Instead, I want it ...
0
votes
2answers
2k views

pset3 --> bubble sort

I am in sort section of pset3. I am implementing a bubble sort algorithm, but it seems that, although values[] is being sorted, elements are being moved one position forward in memory. For example: ...
0
votes
2answers
578 views

My sort and search functions work outside of helpers.c but not within. I cant spot the flaw help?

I ran my sort and search function out of the helpers file by sending them a fixed array and they worked fine. Then I put them back into helpers and I am having problems. Any help will be appreciated. ...
1
vote
1answer
197 views

How come we can use objects in a structured programming language like C?

I noticed that data types like GWindow, GOval, etc. are actually classes and we are declaring objects using those eg. GWindow window; and GOval circle;. Here window and circle are objects right? How ...
0
votes
0answers
27 views

Fatal error spl/gwindow.h with version 29

When I try to begin breakout with pset 3, I run into Fatal error spl/gwindow.h although I have 2014 version 29 of the appliance. Really stuck here, any help would be great
0
votes
1answer
292 views

Pset3 linear search. Please help me!

I'm doing pset3 and I seem to have a functioning linear search. But I can't find my "needle" if it's in a higher array position than 331, which is where 127 is (I've copied the output of "generate" to ...
0
votes
1answer
88 views

pset3 return function

When I tried to return newGRect instead of rect in this case and compiled my whole program, I got the message of Segmentation fault. May I know why? Also, may someone tell me where to find a ...
1
vote
2answers
69 views

what does “Unexpected error: decodeError: Illegal color value” mean?

I just finished the code for breakout.c and I received no errors when I typed in "make breakout". However when I typed in ./breakout I received a whole lot of errors saying that there was an ...
0
votes
1answer
366 views

Cannot find the needle 127 in the haystack of 1000 random numbers using linear search . Any ideas on what I may have done wrong?

I'm having a bit of difficulty in compiling the helpers.c program. Specifically when I try to check the correctness of the program, it seems it cannot find the needle 127 in the haystack of 1000 ...
0
votes
1answer
43 views

Can't access pset3 form for part 2 of submission

This link https://forms.cs50.net/2014/fall/psets/3/ Redirects here instead https://www.pin1.harvard.edu/cas/login?service=https%3A%2F%2Fwww.pin1.harvard.edu%2Fpin%2Fauthenticate%...
0
votes
1answer
109 views

why doesn't getColor work?

I have almost all of my PSET3 breakout program complete. I want to add different point values based on the color of the bricks. I have each row colored differently and now when trying to determine ...
0
votes
2answers
1k views

why do I get “error: expected expression” when I try to compile my binary search implementation?

Having some trouble figuring out this error message as I write the Binary Search function. Any advice greatly appreciated! bool binarySearch(int key, int array[], int min, int max); bool search(int ...
0
votes
2answers
138 views

why does my find get stuck?

When I do the ./generate 1000 50 | ./find 127 command, the answer is so that is the right answer. But when I do the ./generate 1000 50 | ./find 128 command, the answer is and nothing ...
0
votes
1answer
200 views

why does my find fails check50 tests?

I'm currently on pset3. I've completed searching and sorting part. Everything works fine. I've manually checked for different inputs and it works fine but when I do check50 it shows the following ...
0
votes
1answer
764 views

pset3 - Bubble sort not working

I'm stuck on pset3. I'm trying to implement bubble sort but somehow its not sorting at all. Here's my program. And here's the output. Thanks.
0
votes
1answer
247 views

pset3 - Linear search wont work at all

So, I'm currently stuck on pset3. I'm doing the linear search coding on helpers.c but it doesn't seem to search for the needle in the hay stack. It is behaving quite weird. If i run ./generate 1000 ...
0
votes
1answer
253 views

Breakout main function will not move the paddle or the ball

I have created the paddle, ball, and bricks, but when I write the code to make paddle move nothing happens. I tried to write the ball movement code also but that doesn't work either. I think I am ...
0
votes
0answers
90 views

pset3 segmentation fault decodeColor Colors must have 6 or 8 hexadecimal digits

I am developing my Breakout, and have just added the check for collision with bricks. This line, to check for brick/ball collision: if (strcmp(getType(object), "GRect") == 0) {//commented code;} ......

1
19 20
21
22 23
26