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
1
vote
1answer
517 views

Pset3 breakout remove method doesn't remove brick?

This is my code. My particular problem is in the else if where I am checking if a brick has been returned. For some reason when I execute remove(window, object), it doesn't remove the instance of the ...
1
vote
0answers
153 views

week4 some compiling error

jharvard@appliance (~/Dropbox/pset3): make ./bounce clang -ggdb3 -O0 -std=c99 -Wall -Werror bounce.c -lcs50 -l`enter preformatted text here`m -o bounce /usr/bin/ld: /usr/lib/debug/usr/lib/i386-...
0
votes
1answer
461 views

pset3 - Error: Could not find or load main class stanford.spl.JavaBackEnd

Before you shout at me, I know this is a duplicate (Why do I get Error: Could not find or load main class stanford.spl.JavaBackEnd?) but that article did not help solve my problem. I ran sudo chown ...
0
votes
0answers
52 views

check50 giving that the answer is correct of pset3 but in gradebook i am not getting full marks

I checked my answer of pset3 with check50 and its says fine but in gradebook i am not getting full marks.
0
votes
1answer
709 views

pset 3 helpers.c does not compile

:) helpers.c exists :( helpers.c compiles \ expected an exit code of 0, not standard error of "helpers.c:32:18: error: implicit declar..." :| finds 42 in {42,43,44} \ can't check until a frown ...
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 -...
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 ...
0
votes
1answer
110 views

question about pset3/breakoout

I have finished the breakout and it can be compiled. However, when I execute it, "segmentation fault(core dumped)" appears. I test the code block by block and find the code below generate the problem ...
0
votes
2answers
56 views

An extension of sum

In the week 4, lecture ,at 27:30 for (int i=1; i<=m; i++) { sum +=i; } return sum; Q1: why do I need a equal sign after + ? why not just "sum + i;"? Q2: Because I want to create another ...
0
votes
1answer
158 views

getWidth: Illegal Argument

So when I run breakout my paddle wont move with my cursor. As soon as my mouse touches the Gwindow, I get an error in my terminal. here's my code for it, and the terminal output. while (lives &...
0
votes
3answers
109 views

Sort code not functioning properly

My sort code seems to be implemented correctly, however, it sorts based on the first digit in the number, rather than the number itself. any idea what the problem could be? this is some output... ...
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
540 views

Best solution to move the ball in Breakout?

What's the best solution for providing proper parameters (x,y) for move() function? "Move() function" we use it to move the ball in the Breakout game.
0
votes
2answers
2k views

what does killed by server mean?

I implemented my search and sorting codes a few weeks ago and back when i ran check50, everything turned out good. But today when i run check50 again, i am getting all red with "killed by server". ...
0
votes
1answer
96 views

why does my programm fails to combine generate and find?

Programs find.c and generate.c work properly when ran standalone. And find.c also passes the check50. however when trying to combine generate and find as in ./generate x x | ./find x the program ...
0
votes
0answers
162 views

encountered error : ack while trying to write code to move paddle

What is error : ack? I am at that part of breakout where one has to make the paddle move in accordance to the mouse movement. I have successfully compiled the code, but when i run it.... the paddle ...
0
votes
2answers
147 views

Select Sort code not working

I am trying to sort the array below using Selection Sort procedure: array [] = {5,4,3,2,1} However, when I run the code it sort the array as 12222. It clearly stops sorting after 2. I suspect the ...
0
votes
1answer
256 views

pset3: How to check for paddle edges?

When implementing breakout, i am having a hard time trying to figure out how to check if the ball hits the horizontal edges of the paddle. So far everything else works fine, but when the ball touches ...
0
votes
1answer
223 views

My code for pset3 selection sort seems correct but doesn't sort right

I can't find the bug: void sort(int values[], int n) { // loop through numbers for (int i = 0; i < n; i++) { int min = i; // loop through remaining numbers - store ...
1
vote
1answer
334 views

CS50 pset 3 breakout segmentation fault when lives --;

I get a segmentation fault after x times i "die" (it varies) and if i decrement the lives each time the ball hits the bottom i get a segmentation fault after 1 time. It's very anoying and i can't find ...
0
votes
1answer
269 views

pset3 command line error make/clang

clang testing.c -lcs50 -o testing /tmp/testing-6c5209.o: In function `main': testing.c:(.text+0x3f): undefined reference to `sort' clang: error: linker command failed with exit code 1 (use -v to see ...
1
vote
1answer
956 views

PSET3 LINEAR SEARCH

Please help me with this: My code for linear search: // To check n is a positive int. if (n<0) { return false; } // To check if value can be found in values array. if values is found return ...
0
votes
2answers
176 views

How can I compile to Windows from the appliance?

I am currently using the appliance through VMWare, and while doing the breakout program I find myself with 2 problems. One the game runs quite laggy, both versions (staff and mine), and it is quite ...
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
101 views

Ball hits floor more than 3 times, but game is still on

I'm almost done with my code, but it seems that while loop never ends. The ball hits floor more than 3 times, and game is on again. Something wrong with while loop. Can you please while (lives &...
0
votes
1answer
78 views

binarysearch no errors from compiler, but only spews out gibberish , anyone got an idea?

To make it more readable i thought this time i will just post the link to my helpers.file. The bubblesort worked and the linary search before too. Maybe i did something wrong in the implementation of ...
0
votes
1answer
534 views

pset3 implementing bubblesort, how should i test what is most likely garbage?

i am a total beginner and i tried to implement bubble sort as follows: void swap(int* a, int* b) { int temp = *a; *a = *b; *b = temp; } void sort(int values[], int n) { do int counter=0; ...
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
3answers
148 views

pset3 fail right in the beginning with linear search, somehow "may reach end of non-void function@

I am a beginner wanted to get started on pset 3. After watching all the videos i started to implement search as follow : bool search(int value, int values[], int n) { int b = 0; for (b=0;b<n; ...
0
votes
1answer
508 views

Slice a list for recursive function in pset3 search

I'm using a recursive function for pset3's binary search. How do you call the same function again giving half the list as an argument?
0
votes
1answer
806 views

linear search compilation error

I've updated search function in helpers.c with code below. I had to remove reference to helpers.h since that was causing even more errors. #include <cs50.h> // #include "helpers.h" bool search ...
0
votes
1answer
257 views

result of search function ignored by find.c

for negative results ,its O.K. 0 , 1 , 2 , 3 , 4 , 4 , 5 , 6 , 7 , 7 , 8 , 9 , 11 , 22 , 33 , 66 , 78 , 88 , 455 , 999 , lower =0 ,upper = 19 ,mid = 9 ,values[mid] = 7 lower =10 ,upper = 19 ,mid = ...
0
votes
0answers
83 views

Detecting if ball is moving up or down

How can I detect if the ball in the breakout.c problem (pset3) is moving up or down? In other words how do I detect changes in Y parameter of velocity? Are there any functions for this purpose in the ...
0
votes
0answers
160 views

Error in breakout's ball bouncing off the edges

I am doing the pset3 breakout. while implementing the ball bounces off the edges, I did it successfully it is bouncing off whenever it touches the edges but it is giving me error ack after closing the ...
0
votes
2answers
253 views

How do i pass an array into a function?

I have tried passing arrays into functions but I keep getting an error about pointers. So is it possible to pass an array I initialised in my main function to another function I created without using ...
0
votes
1answer
35 views

What does `typedef struct GWindowCDT* GWindow` mean?

I'm little confused about the syntax of typedefs. Can anybody tell me what these lines of code mean typedef struct GWindowCDT *GWindow; typedef void *GObject;
0
votes
1answer
85 views

<value optimized> GDB self optimizing everything

I am currently doing sort in pset3, when I make and then run gdb on find to sort and see the sorted haystack then every time I print out the value of haystack, gdb spits value optimized out. I have -...
0
votes
2answers
300 views

find.c Compiling in my machine but not while doing check50

My code for find.c is working fine. I checked with other examples other than on the problem set. I implemented binary search using recursion and changed the search function to include beginning and ...
0
votes
1answer
40 views

Max value of an int variable

I want to know that can an signed integer accept higher value than its maximum value either negative or positive.In pset3 I am giving significantly large value as an argument to argv[1], that's okay ...
0
votes
1answer
342 views

Binary search always return false

I've been having some problems with the implementation of a Binary search algorithm. The problem is that it always returns false. else if(values[midpoint] == value) { ...
0
votes
1answer
139 views

Error while executing `./window` from problem set 3: `java.awt.HeadlessException` [duplicate]

I tried to execute ./window in the /Dropbox/src4m directory and encountered the following error message: jharvard@appliance (~/Dropbox/src4m): make window clang -ggdb3 -O0 -std=c99 -Wall -Werror -o ...
0
votes
1answer
686 views

What's causing the “'spl/gevents.h' file not found” error when compiling `breakout`?

After executing the command make breakout I'm getting this error: breakout.c:16:10: fatal error: 'spl/gevents.h' file not found #include <spl/gevents.h> I'm using Appliance version 19.
0
votes
0answers
66 views

Couldn't exec spl.jar

This is the problem i cant execute the spl.jar file i already tried installing java jdk but it yet didn't work.
1
vote
1answer
461 views

Why do my SPL example programs fail to compile?

When I rewrite pset3's programs associated with Stanford Portable Library (SPL) on my own, they always fail to compile even though I write them out exactly the same as the original program. For ...
0
votes
1answer
276 views

What is the correct `wget` URL for breakout (pset 3) for spring 2015?

What is the new URL for pset3's wget? Currently the specification for pset3 has http://cdn.cs50.net/2014/fall/psets/3/pset3/pset3.zip, but this appears to download fifteen and find files.
0
votes
1answer
116 views

edx pset 3 file not found

Is it too late to do pset 3 now? Below message seems suggest the file is no longer available.. Thanks~ jharvard@appliance (~): ~/Dropbox bash: /home/jharvard/Dropbox: Is a directory jharvard@...
1
vote
1answer
3k views

pset3 helpers c, linear search

bool search(int value, int values[], int n) { // TODO: implement a searching algorithm for (int i = 0; i < n; i++) { if(values[i] == value) { return i; ...
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
56 views

Can I remove the staff's comments from fifteen before submitting?

I've implemented init, draw, move, and won for Game of Fifteen. What part of the notes at the beginning of the file can I take out without messing up my code?
0
votes
0answers
74 views

Illegal Move when using 4x4 txt

I'm not sure what's going on, but when I try to run the 4x4.txt file on my Game of Fifteen, I get illegal move errors starting when it tries to move 6, but if I replicate the moves by hand, I don't ...