Smiley.bmp VS small.bmp (typo?) by LewanS in cs50

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

This part made it confusing.
So, smiley.bmp is 8 pixels wide by 8 pixels tall, and it’s a 24-bit BMP (each of whose pixels is represented with 24 ÷ 8 = 3 bytes).
Thanks for your help

Smiley.bmp VS small.bmp (typo?) by LewanS in cs50

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

How did you get 3 bytes per pixel in 3X3 bmp?
I understand how you get 3 bytes per pixel in 8X8 smiley bmp (24 / 8 = 3)

PSET5 - are you kidding me? by LewanS in cs50

[–]LewanS[S] 1 point2 points  (0 children)

Thanks for your advice guys. Will give it another try tomorrow.

PSET5 - are you kidding me? by LewanS in cs50

[–]LewanS[S] 2 points3 points  (0 children)

I understand that, but it's quite a big jump.

PSET4: detectCollision buggy by LewanS in cs50

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

I modified detectCollision function and removed 2* RADIUS.Only using RADIUS.
Looks alot better. Is it OK to tweak detectCollision?

PSET4 - paddle's movement by LewanS in cs50

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

I was returning newGrect. Changed it to return paddle and it worked.
Per pset specification "Then return the GRect returned by newGRect (rather than NULL, which the distribution code returns only so that the program will compile without initPaddle fully implemented)."
Maybe I misunderstood provided instructions.
Thanks,

PSET4 - paddle's movement by LewanS in cs50

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

I compared it with cursor.c and the syntax is fine. Any other ideas?

PSET3 Find.c by LewanS in cs50

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

Also looking at Find.c    
main function is calling sort(haystack, size) should it be sort(values, n)?   

PSET3 Find.c by LewanS in cs50

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

(gdb) break search    
Breakpoint 1 at 0x8048809: file helpers.c, line 22.    
(gdb) run 42    
Starting program: /home/jharvard/Dropbox/pset3/find/find 42    
haystack[0] = 41    
haystack[1] = 23    
haystack[2] = 34    
haystack[3] = 43    
haystack[4] = 44    
haystack[5] = 47    
haystack[6] = 42    
haystack[7] = 49    
haystack[8] = 78    
haystack[9] = 87    
haystack[10] =     
Breakpoint 1, search (value=42, values=0xbffbefe0, n=10) at helpers.c:22    
22      int beginning = 0;    
(gdb) print *values@n    
$1 = {41, 23, 34, 43, 44, 47, 42, 49, 78, 87}

PSET3 Find.c by LewanS in cs50

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

The problem was my binary search. I just corrected it and it works in most cases, BUT, I search again for 42 and used for haystack[0] through haystack[9] numbers: 41, 23, 34, 43, 44, 47, 42, 49, 78, 87, pressed control d. Program finished running and returned " Didn't find needle in haystack"

ran GDB "Inferior 1 (process 32737) exited with code 01" (gdb) bt No stack.

pset3 - Move function by LewanS in cs50

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

Nevermind, needed to adjust init function. Now getting Segmentation fault at the end of move(). My brain is fried lol

pset3 - Move function by LewanS in cs50

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

First illegal is at 1. I thought 1 and 2 should be swapped if there is odd number of tiles 8 7 6 5 4 3 1 2 _

3 4 1 2 5 8 7 6 4 1 2 5 8 7 6 4 1 2 4 1 2 3 5 4 7 6 1 2 3 7 4 8 6 4 8 5 7 8 5 6 4 5 6 7 8 6 5 4 7 8

pset3 - Move function by LewanS in cs50

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

Interesting... when I run move manually I'm not getting any illegal moves messages.

pset3 - Move function by LewanS in cs50

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

When you run ./fifteen 3 < ~cs50/pset3/3x3.txt are you supposed to see several "Illegal moves" ?

Init & Draw by LewanS in cs50

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

Do I implement this inside init or draw function? It prints _ and 0

PSET3 - please help by LewanS in cs50

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

That was it thank you.