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
1answer
18 views

The output is only _

So in this program, the only output I am getting is _. Help would be appreciated. My init: void init(void) { // Initializing the game int square; square = (d*d) - 1; for (int i = 0 ;...
0
votes
0answers
4 views

cs50 pset3 tideman lock pairs and print winner function are not working rest all are working

in lock pair (lock_pairs skips final pair if it creates cycle is working) rest all lock_pair and print winner is not working. #include <cs50.h> #include <stdio.h> #include <string.h> ...
0
votes
1answer
106 views

Pset3 Helpers.c “timing out while waiting for program to exit”

I have been working on Helpers.c for an extremely long time now, and I have little help with the style of the program due to my doing this totally on my own. When I run check50 from the 2018 pset3 doc,...
0
votes
0answers
6 views

PSET3 Tideman: Help with lock_pairs function

how's it going? I'm now working on Tideman but I'm now having a hard time why my code does not satisfy all the condition, only the first one: :) lock_pairs locks all pairs when no cycles These two ...
0
votes
1answer
117 views

How to set rank for all preferences?

Any thoughts on that to set rank for all preferences?
0
votes
1answer
26 views

pset3 search function declaration must stay the same?

Sorry for asking a probably repeated question, but I wanted to commit to a community! So the search implementation part of pset3 states: "You may not alter the function’s declaration. Its prototype ...
0
votes
1answer
30 views

Problems executing make clang-7 error cs50

Hi, do you know how to solve this error? Thanks!!
0
votes
0answers
14 views

I'm STUCK for a good while in pset3 Tideman last 3 functions :(

I'm mostly concerned about the sort_pairs() function atm, but i'm willing to receive answers regarding the whole code. I can't really see what's wrong with the way i coded it in general, but mostly ...
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
31 views

pset3 code not finding any numbers when in helpers.c

// TODO: implement a searching algorithm if(n <= 0) { return false; } int end = n; int start = 0; int middle = (start + end)/2; int found = 0; while(found == 0) { if(value == values[...
0
votes
1answer
37 views

Fifteen- Pset3: Weird error that is not my fault - help

Well my Fifteen doesn't compile because get_int but I included cs50 library. What I am missing? Check the screen shot please. Thank you!
0
votes
0answers
7 views

My program does **NOT** skip the last pair if it creates cycle. #PSET3 #Tideman

my program has apparently one bug. check50 says my program does NOT skip the last pair if it creates cycle. However, I ran my function through debug and it did skip the last pair and did not write ...
0
votes
1answer
36 views

Help finishing the move function pset3

I've been stuck on this problem for a really long time. I think I'm almost done with the move function, but I need someone to explain what I need to do. Please help me. My code is: bool move(int ...
0
votes
1answer
15 views

Pset3, fifteen.c

In the game of fifteen, I couldn't figure out a way to view the under-score sign "_" , I tried these lines of code: if (board[i][j] == 0) //checking if value is 0 to print a blank tile. ...
0
votes
1answer
11 views

pset3 move function takes illegal moves

Alright, so I've had a go at this for a very long time, and haven't been making much progress. My problems is with this move function. It doesn't accept some illegal moves, however, some illegal moves ...
0
votes
1answer
57 views

CS50 Pset3/less check errors

Hi I am very frustrated since 5 days that I cannot pass check50 that keeps giving me error as: Does anyone have any suggestions? :) helpers.c exists. :) helpers.c compiles. :( sorts {5,4,3,2,1} ...
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
18 views

Breakout / pause(function) slows the paddle

When I add pause(5) to the while loop, pause function makes the ball not zip around, it also seems to slow down the paddle responsiveness. What do I have to do to get around that? I do understand why ...
0
votes
1answer
62 views

pset3 Segmentation fault ./generate 1000 50 | ./find 127

the generate.c file compiles and runs well and the find.c also compiles and runs well but i don't know why is i can't test them together
0
votes
1answer
46 views

Init function in pset 3

I've been working on fifteen, and I started with the init function, and I want to make sure I have it right. Other than the part where you swap 1 and 2, does this look right? void init(void) { ...
0
votes
1answer
41 views

Pset 3 -> Counting Sort - need tips to find my error

What is wrong in my code? Why am I getting a segmentation fault? void sort(int values[], int n) { int aux_list[65536] = {0}; //map the count of values in the values list as the index of the aux list ...
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
28 views

Error with fifteen?

I am taking the Harvard ap cs5o class, and I just started the pset3's fifteen. I followed the directions to get the skeleton code from here: Problem scope After reading and following along I tried ...
0
votes
1answer
33 views

pset3/fifteen/issue with board

I have an issue making my board in fifteen, i think im doing well but it shows something i can't explain. Can anyone help me? why my board numbers shudenly do this weird thing: My code: void init(...
0
votes
1answer
35 views

why is binary search return false for everything

Here I have implemented the binary search in 2 ways, the iterative way, and the recursive way, but I get the same error for both ways, I also have implemented a insertion sort which works. but I am ...
0
votes
1answer
38 views

CS50 Pset 3 Music errors - please help! :(

I really don't know what I am doing wrong. I think I've mad a mistake in frequency. Check50 says: :( note C3 has frequency 131 expected "131", not "220" :( note Bb5 has frequency 932 ...
0
votes
1answer
61 views

cs50 pset3 runoff tabulate - why you say candidates[i].votes = 0 ; here?

why use that ?? for (int i = 0; i < candidate_count; i++) { candidates[i].votes = 0; } } return 0;
0
votes
1answer
41 views

Pset 3 move function not working

I tried to make the move function recently, and it doesn't put the tile where it is supposed to go. It moves the blank over, and only once. Please help me fix this. My code is ` bool move(int ...
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
1answer
45 views

My runoff problem doesn't pass check50

when I run check50 this is the message I get and I don't know what to fix :( tabulate counts votes when all candidates remain in election tabulate function did not produce correct vote totals :( ...
0
votes
1answer
33 views

Defining array[i] as a macro

I'm getting the following error: helpers.c:25:12: error: called object type 'int *' is not a function or function pointer if (MIN < MAX) ^~~ helpers.c:20:24: note: ...
0
votes
1answer
25 views

Haystack not found

Hi can someone help me out the code "./generate 1000 50 | ./find 127" doesn't find the haystack. And I even removed the "./find 127" and went through the generated numbers but still didn't see the ...
0
votes
2answers
103 views

Help finding segmentation fault

In my code, I get a segmentation fault some, but not all of the times that I run it. Sometimes, it sorts the code and finds the needle, sometimes it doesn't sort correctly and ends with a segmentation ...
0
votes
1answer
21 views

How to swap elements in “struct” data type?

I am working on "tideman" from pset3 and stuck on sorting the data that i have in "struct" data type. Don't really know if it was supposed to be figured out on our own, but they ...
1
vote
2answers
34 views

Resize less fails when trying to resize small.bmp when n is not multiple of 4 or is 1(probably padding issue)

int oldHeight = bi.biHeight; int oldWidth = bi.biWidth; bi.biWidth *= n; bi.biHeight *= n; int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; bi.biSizeImage = ((sizeof(RGBTRIPLE) * bi....
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.
1
vote
1answer
28 views

Can't figure out what's wrong with my linear search code

// add grave accents before and after code // to show it nicely in your question. bool search(int value, int values[], int n) { if(n<0) { return false; } // TODO: implement ...
0
votes
1answer
32 views

pset3 'fifteen' - init function only works for small grids

My init() code works beautifully for grids of 3, 4, or 5, but chokes with larger grid of 6, 7, 8, and 9. It looks almost like an integer overflow or floating point imprecision problem, but I can't see ...
0
votes
1answer
48 views

CS50 recover - images are some kind of blank

//My program creates images of different sizes but without content (just black and white pixels). Someone can help me? #include <cs50.h> #include <stdio.h> #include <stdlib.h> #...
0
votes
2answers
29 views

Fifteen.c/PSTE3 MOVE FUNCTION NOT SHOWING EXPECTED OUTPUT

Though my program fifteen.c/pset3 compiles with the int,draw,move function but the tiles are not moving at all. Here's my code as well the output.Kindly check and any suggestions will be appreciated. ...
0
votes
1answer
29 views

Everything's working in manual testing, but cs50 says 4x4 not working (pset3 fifteen)

Source code for init: void init(void) { int k=(d*d)-1; for(int row=0; row<d; row++){ for(int col=0; col<d; col++){ board[row][col]=k; if((d%2==0)&&(k==3)){ ...
0
votes
1answer
51 views

pset3 game of fifteen won() function does not work

Just in case, I'll put the code of the other functions, but they, like, are successfully tested. void init(void) { int value = d*d - 1, c; for(int i = 0; i < d; i++) { for(int ...
0
votes
1answer
51 views

PSET 3 still stuck

I'm still so very stuck on this one. Below I have a cobbled together "solution" that at least increases the size of the image. I have no clue what I'm doing when it comes to copying the value of ...
0
votes
1answer
28 views

In find, I print the array before sorting it, The last number it prints out is always consistent but unrelated to the problem

It continuously prints 2147483647 as the last number of the haystack, even when I use a different seed or no seed at all. Does anyone know why?
0
votes
2answers
49 views

Pset3, Game of Fifteen, won, game keeps winning!

for the final part of fifteen, my game wins automatically upon start up and I'm not sure why, please help, thanks. my code is as follows: bool won(void) { //for each row for (int i = 0; i < d; ...
0
votes
1answer
38 views

Sort Function not changing haystack

The array gets sorted inside the sort function but the haystack doesn't change. How do I pass haystack by reference without changing the function prototype? void sort(int values[], int n) { int ...
0
votes
1answer
124 views

How does one print out all existing integers in an int array?

The code below generates the following error: format specifies type 'int' but the argument has type 'int *' [-Werror,-Wformat] printf("%i", array); include include int main(void) { int ...
0
votes
1answer
41 views

Help with the move function pset3 game of fifteen

I've been stuck on the move function for a really long time and I can just not figure out how to do it. I've tried to get help from other people and I really just don't understand any of it. Please ...
0
votes
1answer
28 views

Binary search recursing issue

I've been working on a binary search of pset3 find, and I'm having an issue when I call the function again recursively. I believe that I know what the issue is, I'm just not sure how to fix it. When I ...
0
votes
1answer
63 views

Error: Make sure game is winnable (fifteen) won

bool won(void) { for(int i= 0; i<d; i++) { for(int j = 0; j <d; j++) { if((i==(d - 1)) && (j==(d -1)) && board[i][j]== 0) { if(board[i][j] <...

1
2 3 4 5
26