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
3
votes
2answers
27k views

How to solve “control may reach end of non void function” error

When I try to compile my code, I get an error message that says "control may reach end of non void function." What does this message mean and how can I avoid this error? Here is the function that's ...
1
vote
2answers
3k views

Pset3 Binary Search problems

I have tested the code presented in the picture and find this function always returns false no matter what number you search.There must be a problem in it but I can not see it!! Can anyone help me ? ...
1
vote
1answer
3k views

How to Fix “control may reach end of non-void function” and “No such file or directory” Errors?

When I compile find, I get this error message error: control may reach end of non-void function When I then try to run the program ./find 14 I get this error message bash: ./find: No such file ...
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 ...
2
votes
1answer
2k views

why do we pass arguments to the main function?

I did not understand that ,why do we pass arguments to the main function? for example in pset3 generate.c main {int argc,string argv[]}. please explain?
1
vote
2answers
253 views

Mess of Error Messages From Clang

I just started pset3 and when I try to compile my helpers function I get this crazy mess of error messages from clang. This is my code /** * helpers.c * * Computer ...
1
vote
2answers
1k views

Fatal error “spl/gwindow.h”

I followed the instructions in pset3 but received a fatal error shown below. It was stated that the spl is stored somewhere in the new version of appliance which I think I have. I tried replacing ...
1
vote
2answers
181 views

PSET3 : fifteen: how to identify board edges in move function?

Hi I am working on pset3 : fifteen and trying to implement move function. I'm not quite sure how to identify board edges and deal with this. My swap is also not working as the tile I want to move ...
1
vote
2answers
27k views

How do I fix a “use of undeclared identifier” compilation error?

In the following code snippet: for (int column = 0; column < d - 1; column++); { board[&row][&column] == counter; counter++; make returns the following error: fifteen.c:140:19: ...
0
votes
1answer
170 views

check50 not working on pset3

When I try to run: check50 cs50/2017/x/find/less I get this: Traceback (most recent call last): File "/opt/pyenv/versions/3.6.0/bin/check50", line 6, in <module> from pkg_resources ...
0
votes
2answers
528 views

gevent.h file not found error

I'm trying to run the file bounce.c as Mr. Malan introduces in a clip. However, I have this error: jharvard@appliance (~): make bounce clang -ggdb3 -O0 -std=c99 -Wall -Werror bounce.c -lcs50 -lm -...
0
votes
1answer
59 views

Why isn't this move function from Game of Fifteen working?

bool move(int tile) { for(int row=0;row<d;row++) { for(col=0;col<d;col++) { if(board[row][col]==tile) { if(board[row+1][col]==0 || board[row-1][col]==0 ||...
0
votes
2answers
122 views

Pset3 Resize Array not storing data properly

I'm not sure where the issue is here, but from the looks of debug I only store anything in my horizontal array (line) once despite seeing the debugger hitting that section of code properly. I assume I ...
2
votes
1answer
267 views

pset3 fifteen.c passes local tests but fails check50 with timeouts

My fifteen.c passes the following local tests by getting to "ftw!" in each case: ~/workspace/pset3/fifteen/ $ ./fifteen 3 < ~cs50/pset3/3x3.txt ~/workspace/pset3/fifteen/ $ ./fifteen 4 < ~cs50/...
2
votes
2answers
354 views

why can't I compile the program that I wrote to test helpers.c?

I've made a program to test my sort function. The only problem is that when I try to compile it gives me the "undefined reference to 'sort'" error as seen in the below: For context, I have taken the ...
1
vote
1answer
510 views

Void init(void) or void init(int d)?

Why is the init function in fifteen not declared as void init(int), since it uses the integer d?
1
vote
1answer
331 views

Breakout - bounce off brick- why do I need to check for object == NULL?

When using detectCollision to get the ball to bounce off the paddle, I just need to check if detectCollison returns the object "paddle" and if so, reverse the movement. But for the brick, I have to ...
1
vote
2answers
940 views

pset3 / move function

The program cannot recognize a legal ( or illegal ) move too. How did you check whether a move is legal or not? Here's my code block for testing: //check if the move is legal //posi and posj = i and ...
1
vote
1answer
199 views

Failing add_pairs function check50

I'm in the midst of working on tideman, in the midst of it i decide to check for the add_pairs function but i realised check50 is throwing me red coloured texts, solely based on add_pairs. I debugged ...
0
votes
1answer
585 views

Pset 3 - Check 50 error for fifteen

The code for pset 3 fiftenn is running fine when i enter different values of d and is getting completed as well. But on check 50 getting the following set of errors. Any help here would be ...
0
votes
1answer
51 views

Pset3 fifteen.c works fine but fails cs50 check?

However deleting math.h solves the problem. (even though i am using modulo function $ in the code)
0
votes
0answers
214 views

PSET3 \ expected an exit code of 0, not 1 (find.c)

I successfully built my program and went on to check it using check50 only to discover this :) helpers.c exists :) helpers.c compiles :) finds 42 in {42,43,44} :) finds 42 in {41,42,43} :) finds 42 ...
0
votes
0answers
39 views

recover.c spits out images that are partially recognizable

recover.c compiles and runs normally, but it produces 21 images that have chunks of different images mixed in. Here are the images: 000.jpg: 001.jpg: 002.jpg: 003.jpg: 004.jpg: Because I'm too ...
0
votes
2answers
883 views

Resize ( more comfortable )

int main int argc, char *argv[]) { // ensure proper usage if (argc != 4) { fprintf(stderr, "Usage: copy infile outfile\n"); return 1; } float f = atof(argv[1]); if(f<= 0.0 && f>=...
0
votes
1answer
61 views

PSET3 Game Of Fifteen tiles not swapping! (no illegal function but no change in board)

My game of fifteen is somehow still not working. here is the code for move() bool move(int tile) { // TODO // find location of specified tile using linear search //find tile location in nice ...
0
votes
1answer
466 views

pset 3 “control may reach the end of a non-void function” [duplicate]

I know what this error means, but how do I fix it? I'm using a if... else... function, so I'm not sure how to improve upon that. Thanks!
0
votes
1answer
179 views

pset3 find - gdb with generate as pipe

I am on binary search in pset3 find. As noted here, I get an crash when I try to run it through a pipe to generate with more than 580 numbers to generate with seed of 50. So command (note that it is ...
0
votes
1answer
102 views

Is it okay to check my code against a reference book?

Alright, so I've been having trouble making binary search (I think I either made an asymptote, or it degrades too quickly.), so I decided to see if my reference book had anything on Binary Search. It ...
0
votes
1answer
187 views

PSET3 fifteen - part of move is not working and 1 and 2 switch

close to finishing pset3 fifteen.c. When I am playing with fifteen, everything is working except for when I attempt to switch "" with 8. There ends up being 2 ""s. I think that it might be something ...
0
votes
2answers
334 views

helpers.c passes check50 but cant find 127 in haystack

Just changed the helpers.c file according to pset3 specs:"Re-write search in such a way that it uses linear search, returning true if value is in values and false if value is not in values. Take care ...
0
votes
1answer
514 views

pset 3 “search”: expected an exit code of 0, not 1

I'm at the very end of the "find, sort, search" section of pset3, but when using check50, I get "expected an exit code of 0, not 1". This only happens on the checks where check50 is looking for a ...
0
votes
2answers
431 views

Pset3 (breakout) — problems initiating score label

Below is the code I'm using to initiate the label showing the score. Unfortunately, the label doesn't appear on the screen, and I'm clueless as to why that is the case. I'd very much appreciate any ...
0
votes
1answer
1k views

Error: control may reach end of non-void function [duplicate]

I am currently working on pset3/search and when I try to compile the codes it keeps telling me that ^ error. I know that it is because I must not be returning a boolean value as needed, but I do not ...
0
votes
1answer
320 views

Pset3 Find Check50 is Inconsistent

When I run check50 on the find program for Pset 3 I get an inconsistent error about output from CLang. Sometimes it works and other times it produces an error on one of the tests. The error can be ...
0
votes
2answers
2k views

pset3: sort — having trouble connecting all the dots

I'm not sure what to work on. The pset3 instructions say: Go ahead and implement sort so that the function actually sorts... Odds are you’ll want to implement bubble sort, selection sort, or ...
0
votes
2answers
499 views

How to pass grid values to draw in pset3

I've just finished coding init and have started draw but I'm not sure how to pass on my grid values to the draw functions. Especially as the values may change as the user plays the game. I've tried to ...
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
2answers
532 views

pset3 fifteen move creates double numbers

So my move function finally compiles, but when I run the program and chose a legal tile (i.e. one by the blank) the blank turns into the tile I picked. So from this: 8 7 6 5 4 3 2 1 ...
0
votes
1answer
259 views

Why do I get Error: Could not find or load main class stanford.spl.JavaBackEnd?

This happened to me when trying to execute the window app from src4m.zip. After compiling it on 2014 Appliance CS50 (2014-22). First the spl directory was missing form the zip file. The one installed ...
0
votes
0answers
235 views

pset3 find: Bus error (core dumped)

I finished the binary search algorithm and I get an error Bus error (core dumped) when I try to test it using the generate tool which is given. However, it works fine when I input the haystacks myself....
0
votes
1answer
110 views

Fatal error: <cs50.h> file not included

I'm at pset3 and this error has never happened to me and it's pretty strange to me. When I 'make' the file in my IDE, I get no errors whatsoever and my program runs smoothly. However, when I upload ...
0
votes
2answers
152 views

Pset3 Linear Search (control may reach end of non-void function)

This seems pretty simple, but I'm not sure what I'm doing wrong. Thanks in advance for helping! bool search(int value, int values[], int n) { if (n >= 0) { for (int i = 0; i <= n; i++...
0
votes
1answer
384 views

killed by server

) helpers.c exists :( helpers.c compiles \ killed by server :| finds 42 in {42,43,44} \ can't check until a frown turns upside down :| finds 42 in {41,42,43} \ can't check until a frown turns ...