Questions tagged [pset3]

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

302 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
102 views

game of fiteen shows errors in check50

guys my game of fifteen is showing errors in check50 please help here's my pastebin link http://pastebin.com/TgA030A5 check50 2015.fall.pset3.fifteen fifteen.c :) fifteen.c exists :) fifteen.c ...
0
votes
1answer
331 views

PSet 3, binary search implementation

I'm struggling with implementation of binary search in PSet 3, and my code can't quite get past check50. Here's my code: bool search(int value, int values[], int n) { // TODO: implement a ...
0
votes
1answer
40 views

pset3 binary search , shows errors in check50

i don't understand acc. to the algorithm it should work correctly , but it doesn't
0
votes
1answer
97 views

pset3 binary search , problems with check50

i have tried a lot but cannot find the meaning of the last two errors of check50 please help
0
votes
1answer
30 views

Cant upload pset3.zip propery

When I try to upload pset3.zip, as the pset states I should do, on uploading, the source code thats shows includes everything except the code which i wrote myself, even tho it was saved and compiled ...
0
votes
2answers
76 views

PSET3 Binary search not yielding results

I can't seem to figure this out. here's my code bool Binarysearch(int key, int array[], int n){ int end = n-1; int start = 0; while(start<=end){ int midpoint = (((end+start)/2)); if (...
0
votes
0answers
34 views

pset3 game: log file showing an unexpected trailing 0

In pset3 game, my log file is showing an unexpected trailing 0 as shown below:- 8|7|6 5|4|3 2|1|0 0 I tried formatting the log file but the additional 0 is just not going away. Code snippet:- // ...
0
votes
1answer
33 views

pset3: linear search (strange behaviour)

My code is going through check50 okay, but when I try to check it manually it doesn't seem to be able to find the needle in the haystack. I can't figure out why that is happening that's why I'm hoping ...
0
votes
1answer
119 views

Init fails to intialize any of the boards for fifteen on check50

I'm receiving a segementation fault with the code below. I've played with the code a little bit. I'm assuming there are problems in the move and won functions as well, but I'm unable to check them, ...
0
votes
2answers
48 views

Pset3 - move function - Keep getting an “Initialize the variable” message

bool move(int tile) { int xaxis = d - 1; int yaxis = d - 1; int tile_i; int tile_j; search_the_board(tile); if (tile_i == xaxis + 1 || tile_i == xaxis - 1) if (tile_j == ...
0
votes
2answers
90 views

Pset3 Game of Fifteen - Zeroes

void init(void) { int count = d*d-1; for(int i=0; i < d; i++) { for(int j = 0;j< d;j++) { board[i][j] = count; count--; } } //if even number swap 1 and 2 if(d%2==1) ...
0
votes
1answer
57 views

pset3 check receives standard error from init()

The game compiles and runs, passing all the other tests in check50 when entered manually, but on the step for testing init, check50 fails. Here's the check50 output: https://sandbox.cs50.net/checks/...
0
votes
1answer
110 views

Receiving an expected expression error on pset3 (curly braces match)

Tad bit confused as to why I'm receiving an expected expression error. I've looked at other questions for help on this, but the solution seems to be the curly braces. I've actually done this, and I'm ...
0
votes
1answer
212 views

pset3-fifteen-check50_error

I think my code if quite correct but i get this when i use check50 . I am not even able to understand what the error is . :) fifteen.c exists :) fifteen.c compiles :) init initializes 3x3 ...
0
votes
1answer
76 views

in pset3 error while performing check50

when i use check50....it is showing error in helper.c but i didn't find any error in source codes of programs or helper.c i wrote programs for generate.c and find.c but they didnt gave any errors i ...
0
votes
1answer
90 views

pset 3 mergesorting in helpers.c is giving me a segmentation fault

I have been trying to implement mergesort for the "sort" part of pset 3 - but it is giving me a segmentation fault every time I try. Help :/ void sort(int haystack[], int n) { int temp[n + 1 / 2];...
0
votes
0answers
197 views

pset3 game of fifteen check50 error 10

I think my code works fine in the terminal but this is what I get in check50: :) fifteen.c exists :) fifteen.c compiles :) init initializes 3x3 board correctly :) init initializes 4x4 board ...
0
votes
0answers
166 views

Merge sort code giving seg fault after providing array of integers

I was implementing mergesort and I am coming across segmentation fault whenever i provide it an array of integers. I ran gdb but couldn't figure it out. Can anyone pls help me. I am attaching my code ...
0
votes
1answer
205 views

Have I got the right idea? Pset3/Fifteen/Move

This is my code for identifying the blank tile: bool move(int tile) { int temp; int didSwap; int blankTile = 0; // search for blank tile for(int row = 0; row < d; row++) ...
0
votes
1answer
54 views

PSET 3 Linear Search Error

Keep getting the error of "control may reach end of non-void function" This is for the linear search, can someone please give me some help/tips into getting this error to go away? This is my code: ...
0
votes
0answers
34 views

Only the blankspace is moving in my move function in the game of fifteen

Can someone please help looking into my code for move and draw? When executed, only the blankspace goes to the right position. The tile sometimes jumps to the next line and the board gets expanded. ...
0
votes
2answers
255 views

Won function of pset3 game of fifteen making error

My code is not able to compile clang is stating error in won function. My code is as follows: /** * fifteen.c * * Computer Science 50 * Problem Set 3 * * Implements Game of Fifteen (...
0
votes
1answer
70 views

My won function is not working. I am getting the following checks. https://sandbox.cs50.net/checks/6ca6c632ceb0408aaac04be0ed215bfe

/** * fifteen.c * * Computer Science 50 * Problem Set 3 * * Implements Game of Fifteen (generalized to d x d). * * Usage: fifteen d * * whereby the board's dimensions are to be d x d, * ...
0
votes
0answers
122 views

Move function not working in Game of Fifteen

I cant seem to find the bug why my move function is not working for me, any help would be much appreciated bool won(void) { int counter = 0; // loop for rows to start from one position left ...
0
votes
1answer
48 views

pset3 Linear search output problem

the code isn't working for ./generate 1000 50 | ./find 127 and also for other inputs too. Please help.
0
votes
1answer
171 views

Pset 3 - Binary Search - clang: error: linker command failed with exit code 1

When I compile, with "make find", the following code: I get: So, if I'm interpreting this correctly, there's an undefined reference to search on line 58 of find.c, which is -- if (search(needle, ...
0
votes
1answer
387 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 ...
0
votes
1answer
78 views

If / else if / crazy behavior

How Is it possible that the code below do prints the printf ("Found it!") statement, but don't return true as the statement that follows? Instead, it's returning false as the last statement outside ...
0
votes
1answer
233 views

pset3 move function segmentation fault

I have been getting segmentation fault for a couple of hours now, i tried alot of different things, anyone have any advice? thank you bool move(int tile) { int zerotile=board[d-1][d-1]; ...
0
votes
1answer
110 views

pset3 fifteen move function adds 0

My move function generally works properly, but every so often it adds an extra 0 in to the table, so that there are two. Both can then be moved around. I can't figure out what corner case I haven't ...
0
votes
1answer
21 views

Attempting to call getType on an object with unexpected type

error: Attempting to call getType on an object with unexpected type after calling the function updateScoreboard(window, label, points); in code for pset3.
0
votes
1answer
233 views

pset3: The sort function does not return my code

I am stuck with the implementation of the sort function. I have written a code, but I can't check if the code is correct. This is what I have done thus far: void sort(int values[], int n) { for (int ...
0
votes
1answer
70 views

Pset 3: Breakout initBricks implementation

I don't understand why my implementation of initBricks isn't working. I noticed that most people have been using nested loops for the ROWS and COLS and I don't particularly mind using doing that too, ...
0
votes
0answers
22 views

pset3. breakout. help on sendBackward

I have a bug in my breakout code. For some reason the ball is arranged behind the score. I even put the code to fix it twice (used both sendBackward and sendToFront). But it didn't help. I need an ...
0
votes
0answers
121 views

pset3. question on sort in find.c

Why do I need to implement sort for find.c if by the task I should be only using linear search which just compares each value from 0 to maximum? What is the reason for the sort? Thank you.
0
votes
1answer
23 views

Cursor.c week 4 pset3 math question on getX - getWidth

I have watched the video on cursor.c, and I understand that the goal is to put a circle (oval) on top of the mouse cursor, but I don't get the math of the formula used. I see that it's a kindergarten ...
0
votes
1answer
794 views

pset3 helpers.c linear search confusion

bool search(int value, int values[], int n) // TODO: implement a searching algorithm if (n >= 0) { for (int i = 0; i < n; i++) { if (values[i] == value) ...
0
votes
1answer
185 views

PSET 3, Bool problem

I dunno why doesn't run! I've tried many things and nothing. The compiler yells saying: «conflicting types for 'search'». Any help, please? Here's my code: #include <cs50.h> #include <...
0
votes
0answers
50 views

addToRegion not working pset 3

Get the following when I use addToRegion for the paddle, when breakout is executed. No other changes made, just trying to create the initial paddle. Does anyone know how to fix? jharvard@appliance (~/...
0
votes
0answers
73 views

pset3 issues with Makefile

I have been having problems with pset3. Pretty much every time I try to make a program it gives me the error: relocation 0 has invalid symbol index 11, and then repeats this error several times. I ...
0
votes
0answers
58 views

Using removeGwindow is giving me <implicit declaration of function 'removeGwindow' is invalid in C99> error

I haven't changed any of the #include statements at the top of the file. The #include spl/gwindow.h is clearly there. What am I doing wrong?
0
votes
0answers
91 views

Why isn't my linear search working correctly?

I cannot get my linear search programm to work and it seems to be a problem with the return of false if the needle is not found. My coding for the search is bool search(int value, int values[], int n)...
0
votes
1answer
46 views

How to solve the deflated by (x%) while using zip -r pset3.zip pset3?

My solution is correct while checking but when I try to zip it it says deflated by certain percent. I don't know if it is a problem in my machine. I tried to upload the same zipeed version, but there ...
0
votes
1answer
45 views

GetWidth error CS 50 breakout

How do I fix this problem? breakout.c:109:26: error: expected expression if (getX(ball) + getWidth() >= getWidth(window)) ^ /usr/include/spl/generic.h:44:49: note: ...
0
votes
1answer
99 views

Unable to resolve host address for the pset3.zip file

When I first encountered the error when downloading the pset3.zip file for problem set 3, I wasn't very worried because the pset3 html had directions on what to do for when that happened. It said that ...
0
votes
1answer
435 views

pset 3's selection sort

#include <cs50.h> #include <stdio.h> #include <stdlib.h> #include <string.h> void swap(int *a, int *b){ int tmp = *a; *a = *b; *b = tmp; } int main(void){ int s = 5; int size[s]...
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
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
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 ...

1
3 4
5
6 7