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
45 views

resize less help needed

i'm feeling so close to solve it but have some issues with the for loops i tried to debug it and see what's going on but yet there's some things i can't explain specifically with triple variable i'm ...
0
votes
1answer
60 views

Recover help - only 2 imgs are getting recovered

#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if(argc != 2) { fprintf(stderr, "Usage: ./recover <filename>\n"); return 1; } ...
0
votes
1answer
26 views

In CS50 pset3 resize (less), the bfSize and biSizeImage are different than the correct values. Why?

outbf = bf; outbi = bi; outbi.biWidth = n*bi.biWidth; outbi.biHeight =n* bi.biHeight; // determine padding for scanlines int padding = (4 - (outbi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; int ...
0
votes
1answer
27 views

PSet3 Resize (Less) = Random Colors when not 1:1

I saw others posted about the same phenomena I am experiencing, but none of their solutions were what I needed. n = 1 works perfectly. This is large.bmp with an n = 2. I realize the first line of my ...
0
votes
0answers
105 views

PSET3 Resize -resizes correctly Byte… doesn't match

I don't understand what I did wrong... Here's my code : // Copies a BMP file #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char *argv[]) { int n = ...
0
votes
1answer
96 views

Recovered image does not match pset3

I can't figure out what is wrong with my code. I recovered images from 000.jpg to 050.jpg. This is my code #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef ...
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
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
1answer
69 views

pset3 resize (less) compiles but doesn't write into new file for factor != 1

I've been stuck with the pset3 for a long time now and can't figure out why my code isn't working; it compiles fine but doesn't produce an image except for the factor 1. Could someone point me in the ...
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
0answers
54 views

Segmentation Fault When Entering Notes With Synthesis

Hello I have written code for pset3's music problem and have gotten ./notes to run correclty but when I used ./synthensis and enter notes in I get a segmentation error. My code follows. // Helper ...
0
votes
1answer
67 views

Calculate n (semitones) for frequency in pset3

I'm having a bit of a hard time trying to calculate the value of n(the number of semitones from A4). I'm currently using the following formula: if (octave > A4_OCTAVE) { n = (octave - ...
0
votes
1answer
79 views

PSET 3 Music doesn't give correct frequencies

After I finished up to problem set 4, I went back to submit my old Psets, but to my surprise many of the had errors, this being one of them. My code compiles fine, but doesn't give the correct ...
0
votes
1answer
201 views

segmentation fault in pset3, don't understand why

here's the code: // Helper functions for music #include <cs50.h> #include <stdlib.h> #include<stdio.h> #include<string.h> #include "helpers.h" #include <math.h> #...
0
votes
1answer
115 views

How to “make notes” file in pset3 ?

This is a really basic question, but I can't "make notes" in pset 3 . I don't know what is wrong. Here is what I do: I tried the following, but maybe it's wrong because "notes" is not a directory ...
0
votes
1answer
118 views

pset3 Music design and connection to Week 2 lecture?

I have completed all of the work for pset3 Music and it works fine. There are no error messages, I can synthesize the songs, and it passes all the Check50 tests. However I can't shake this nagging ...
0
votes
1answer
241 views

pset3 music frequency question

I am working on pset3 music frequency. I struggled with finding a pattern of frequencies for different notes, so instead, i created two arrays one with all possible note (C,D,E,F,G,A,B) and another ...
0
votes
1answer
109 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
1answer
60 views

Writing the .wav file fails with command-line notes

I have verified that my frequency(note) function returns the correct frequency as an int. However, when I attempt to write out using the "command-line note entry" testing scenario described (and yes ...
0
votes
0answers
117 views

pset3 frequency: adjusting semitones

My code for Frequency is working well in the 4th Octave as well as any A note, but after that I am getting values all over. I used Debug50 to follow the math, and I've boiled it down to the adjustment ...
0
votes
1answer
90 views

Pset 3 Music. Brute forced the frequency function, no syntax errors but only getting 0's for all my answers? Any Ideas?

I know my code is not clean at all. For the frequency function I just brute forced it by just starting with "what if there were only A's?" and copied that for the rest of the letters. Naturally messy ...
0
votes
1answer
560 views

Pset3 Music frequency returns all 440

My frequency function returns all 440. Been researching and trying possible solutions (turn ints to floats, round, power, etc) but still does it. What am I doing wrong? Thank you! int frequency(...
0
votes
1answer
393 views

CS50 pset3 music - EOF segmentation fault

I've compiled notes and synthesize using cmd make without any errors. running notes works just fine but when I run synthesize, it gives a segmentation error when I pass EOF command (ctr+D). I've gone ...
0
votes
1answer
216 views

My music program: frequency returning zeros

// Calculates frequency (in Hz) of a note int frequency(string note) { int n,r,a; double oct, z; float x = 0.0; float y = 0.0; char t; t=0; a = 0;r = 0; n = strlen (note)...
0
votes
1answer
208 views

Music: Error loading audio file

I have finished Pset 3 with no issues compiling or any issues with check50. However, when I try to play the .wav file that I have generated using ./synthesize jeopardy.wav < songs/jeopardy.txt, the ...
0
votes
1answer
66 views

Comparison Between Words

In this, I keep getting the error of comparison between pointer and integer?? My Code: (The List Of Errors Is At The Bottom) /** * scramble.c * * CS50 AP * Scramble * * Implements Scramble in ...
0
votes
2answers
1k views

Cs 50 - 2018- Pset03 Music

Please help me in debugging this code for Pset03 Music, no errors but the output of frequency function is same for all notes. I was unable to get the mistake https://pastebin.com/qNNAQYiQ
0
votes
1answer
83 views

CS50 Pset3 “Fifteen” Works but doesn't pass Check50

My code for pset3 "fifteen" works perfectly when I play it—board sizes fit, goes in descending order, blank space prints as a 0 etc. etc. but for some reason, it won't pass any check50 checks past "...
0
votes
1answer
44 views

pset3 find code works, despite 'sort' failing

I'm very confused! I have spent many (MANY) hours working through this pset. I've gotten to the point where my code passes all check50 requirements for 'find', but it's failing the 'sort' ...
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] <...
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
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
0answers
134 views

Pset 3 !! Find (less) !! Need help, please

this is my code (find.c) : #include "helpers.h" const int HAY_MAX = 65536; int main(int argc, char * argv[ ]) { if (argc != 2) { printf("Usage: %s need\n", argv[0]); return ...
0
votes
1answer
23 views

How to “update” the haystack array not using pointers?

Context: In helpers.c, I can make the sort function actually sort the values[] array. Problem: However, I don't know how to re-inject this sorted array back in main without using pointers. Question: ...
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
119 views

Pset 3 helpers.c check 50 errors

#include <cs50.h> #include <stdio.h> #include "helpers.h" //TODO binearysearch, om te controlere van de waarde. bool search(int value, int values[], int n) { int left = 0; int ...
0
votes
1answer
198 views

Need Help In Merge Sort

From last couple of days I am trying to write code for Merge sort. I have completed Week3 lectures and trying to solve pset3. Need some help in my code for merge sort. The code seems to work fine with ...
0
votes
2answers
117 views

pset3/fifteen/check50 fails on last output of some of the checks

The last output of some of the tests fail. The first failure was: 3x3 move blank up twice. My log.txt is identical to the log.txt of the staff solution and I do not have the word "file" in any of my ...
0
votes
0answers
56 views

pset3 Game of fifteen -make

it is not swapping the values but instead copying it ...pls someone tell me where the problem lies in my code... //move function bool move(int tile) { void swap(int *a,int *b); //check the ...
0
votes
1answer
211 views

Pset3 Fifteen Won function

Could anyone help to have a look at my code? I ran check50 and it works for 3x3 but 4x4. However, when I checked manually with 4x4, it works. Here is my code (won): bool won(void) { int win_board = ...
0
votes
1answer
57 views

pset3(count sort):can't sort using count sort,it doesn't sort at all or not returning the sorted array??plz help

/** * helpers.c * * Helper functions for Problem Set 3. */ #include <cs50.h> #include "helpers.h" #define bound 200 /** * Returns true if value is in array of n values, else false. */ ...
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
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
0answers
26 views

For pset3 binary search will this code work?

Here is the code . bool binary_search (int target, int array[],int length) { int end = length-1; int start = 0; while ( array[end_num]- array[start_num] > 0) { ...
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
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
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
2answers
383 views

Check50, Game of Fifteen. Timed out while waiting for “Illegal move”

I've finished working on my pset3 game of fifteen. After consulting Check50, it keeps telling me that: timed out while waiting for "Illegal move." Can someone explain this to me? Don't know what to do....
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
65 views

Swapping 1 and 2 in fifteen.c

I made the init function in a different tab so I can check it, and it won't switch 1 and 2. My code is /** * fifteen.c * * Implements Game of Fifteen (generalized to d x d). * * Usage: fifteen d ...

1 2
3
4 5
7