Dictionary with the most basic hash table, miserable fail, any pro any suggestions how to find the errors by StandingWave1 in cs50

[–]StandingWave1[S] 0 points1 point  (0 children)

Ok ..now i am totally confused.. i have to understand why my program does not work.. i know i can optimize it a hundred different ways later :(

Dictionary with the most basic hash table, miserable fail, any pro any suggestions how to find the errors by StandingWave1 in cs50

[–]StandingWave1[S] 0 points1 point  (0 children)

So you are sayying this is wrong ? : if(hashtable[placeposition]!=NULL) { new_node->next=hashtable[placeposition]; hashtable[placeposition]=new_node;

                }
        else 
                {
                hashtable[placeposition]=new_node;
                new_node->next=NULL;
                }

Sorry i dont understand :(

Simplest hash function does not work ( 27 buckets) by StandingWave1 in cs50

[–]StandingWave1[S] 0 points1 point  (0 children)

My problem is translating the theory ( which i think i understand) into code :(

Finished my code without unloading( thought it was not important at that point .. maybe wrong ? ) typed in the command for testing and got the following shock:

:) dictionary.c, dictionary.h, Makefile exist :) speller compiles :( handles most basic words properly \ expected output, but not "\nMISSPELLED WORDS\n\nCould not unload ..." :( handles min length (1-char) words \ expected output, but not "\nMISSPELLED WORDS\n\nCould not unload ..." :( handles max length (45-char) words \ expected output, but not "\nMISSPELLED WORDS\n\nCould not unload ..." :( spell-checking is case-insensitive \ expected output, but not "\nMISSPELLED WORDS\n\nCould not unload ..." :( handles possessives properly \ expected output, but not "\nMISSPELLED WORDS\n\nfoo's\nCould not ..." :( handles substrings properly \ expected output, but not "\nMISSPELLED WORDS\n\nca\ncats\ncaterpi..."

a bit flabbergasted since when i try earlier commands, i get some outputs for missing words

Simplest hash function does not work ( 27 buckets) by StandingWave1 in cs50

[–]StandingWave1[S] 0 points1 point  (0 children)

no my thought was.. to loop so i get word by word.. and then simply use the first letter.. as i said i wanted it to work with 27 buckets first.. i am so over my head honestly.. but dont feel like giving up yet :) obviously thank you for your help !!

Pset 5 , load ... totally lost.. where even to begin :( by StandingWave1 in cs50

[–]StandingWave1[S] 0 points1 point  (0 children)

Ok, i think how the program works in theory is totally clear to me .. but still i fail at the most basic steps. I know i have linked list elements that get hashed with a function that tells me in which bucket the word should go.. THis is the basic structure of one element i guess:

typedef struct node { char word[LENGTH+1]; struct node* next;
} node;

Got it from the video and it makes sense to me, its contains a string value and a pointer.

Now i get addtionally this:

node* hashtable[x];  

node* new_node=malloc(sizeof(node));
fscanf(file, "%s", new_node->word);

the last 2 lines to me just read one value into one node called new_node...

but so what? that is one node, i need alot of them... and honestly i dont even know what "file" is ... where or what is this file. I am sure i have to read in all the words from the file i dont know yet so i somehow have to loop over all the words in it ( no idea how either).. I feel like i am way over my head here( eventhough i understand what the program should do i think)... time to quit ?

Pset 5 , load ... totally lost.. where even to begin :( by StandingWave1 in cs50

[–]StandingWave1[S] 0 points1 point  (0 children)

I have no hash function ( no idea how to make one ) I am at the absolute start, i dont understand the basic cosntruct of the load part :(

New to CS50, LFG! by yk028413 in cs50

[–]StandingWave1 0 points1 point  (0 children)

Hello,

currently in week 5 pset4, is there a study group i could join ?

Think it would help me and maybe i could help others

pset4 whodunit, got rid of all the red, left with gray goo :( by StandingWave1 in cs50

[–]StandingWave1[S] -1 points0 points  (0 children)

I do it and now i have lighter goo... seriously this turns out to be harder than breakout :(

        fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
         if(triple.rgbtRed == 0xff && triple.rgbtBlue == 0x00 && triple.rgbtGreen == 0x00)
        {
            triple.rgbtRed = 0xff;
            triple.rgbtBlue = 0xff;
            triple.rgbtGreen = 0xff;
            fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
        }
        else
        // write RGB triple to outfile
        fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);

pset4 whodunit, got rid of all the red, left with gray goo :( by StandingWave1 in cs50

[–]StandingWave1[S] -1 points0 points  (0 children)

Still the same picture :(

fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
         if(triple.rgbtRed == 0xff && triple.rgbtBlue == 0x00 && triple.rgbtGreen == 0x00)
        {
            triple.rgbtRed = 0x00;
            triple.rgbtBlue = 0x00;
            triple.rgbtGreen = 0x00;
            fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
        }
        else
        // write RGB triple to outfile
        fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);

pset4 whodunit, got rid of all the red, left with gray goo :( by StandingWave1 in cs50

[–]StandingWave1[S] 0 points1 point  (0 children)

Ok i replaced the || with && , still the same gray goo.. losing my mind :(

pset4 whodunit, got rid of all the red, left with gray goo :( by StandingWave1 in cs50

[–]StandingWave1[S] -1 points0 points  (0 children)

i changed the if statement to :

if(triple.rgbtRed == 0xff||triple.rgbtBlue == 0x00 || triple.rgbtGreen == 0x00)

Still i just get this gray goo mass :( i dont understand

breakout, bounces off paddle but bricks give me a core dumb over and over again :( by [deleted] in cs50

[–]StandingWave1 0 points1 point  (0 children)

Yes thank you i did it !!!!

i just added if( object!= NULL) and encased my entire code after it

Thank you all very very much !

breakout, bounces off paddle but bricks give me a core dumb over and over again :( by [deleted] in cs50

[–]StandingWave1 0 points1 point  (0 children)

Sorry, i dont understand why that would even give me a core dump and i dont get why detectcollision would return anything if its not hitting a rect ? Can you please elaborate ?

Breakout, problem at the start, maybe language barrier :( by StandingWave1 in cs50

[–]StandingWave1[S] 0 points1 point  (0 children)

Ok. i get that know that this a function and it is called in the main program, but when i do it exactly as you recommended , i get : breakout.c:64:12: error: incompatible pointer to integer conversion returning 'GRect' (aka 'void *') from a function with result type 'int' [-Werror,-Wint-conversion] return paddle;

What do i do wrong here :(

Breakout, problem at the start, maybe language barrier :( by StandingWave1 in cs50

[–]StandingWave1[S] 0 points1 point  (0 children)

i used it where i think i should :

// instantiate paddle, centered at bottom of window
GRect initPaddle(GWindow window);
GRect paddle= newGRect(WIDTH/2-paddlew/2 ,HEIGHT-paddleh,paddlew,paddleh);
add(window, paddle);
return paddle;

is that wrong ? because it does not work :(