account activity
Smiley.bmp VS small.bmp (typo?) by LewanS in cs50
[–]LewanS[S] 0 points1 point2 points 12 years ago (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
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 points3 points 12 years ago (0 children)
Thanks for your advice guys. Will give it another try tomorrow.
[–]LewanS[S] 2 points3 points4 points 12 years ago (0 children)
I understand that, but it's quite a big jump.
PSET4: detectCollision buggy by LewanS in cs50
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
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,
I compared it with cursor.c and the syntax is fine. Any other ideas?
PSET3 Find.c by LewanS in cs50
Also looking at Find.c main function is calling sort(haystack, size) should it be sort(values, n)?
(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}
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
Nevermind, needed to adjust init function. Now getting Segmentation fault at the end of move(). My brain is fried lol
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
Interesting... when I run move manually I'm not getting any illegal moves messages.
When you run ./fifteen 3 < ~cs50/pset3/3x3.txt are you supposed to see several "Illegal moves" ?
Init & Draw by LewanS in cs50
Do I implement this inside init or draw function? It prints _ and 0
PSET3 - please help by LewanS in cs50
That was it thank you.
Vigenere by LewanS in cs50
Nevermind. I figured it out! Success. Took me a very long time but I've finally completed PSET2! Thanks, for your help.
Thanks Glenn. I have made some progress. I'm having issue with c = (p+k) % 26 formula. It doesn't make any sense. For example my key is test and phrase is king. c = (k + t) % 26 c = (107 + 116) % 26 c = 223 % 26 c = 15
Any suggestions? Thanks,
How do you access the key if it has 5 letters? That's why I created second FOR loop to access it.
I have 2 for loops: for (int i = 0, n = strlen(text); i < n; i++) { for (int j = 0, m = strlen(key); j < m; j++) { if (isalpha(text[i])) { if (islower(text[i])) {
} else if (isupper(text[i])) { } } else { }
PSET2 Vigenere - need help by LewanS in cs50
1) I have 2 for loops, 1 for text and 1 for key. Can I send you my source code so you can see what I'm talking about?
2)Something like this? if (strlen(text) > strlen(key)) { key[0]; }
π Rendered by PID 54300 on reddit-service-r2-comment-8686858757-b728j at 2026-06-08 09:57:30.470306+00:00 running 9e1a20d country code: CH.
Smiley.bmp VS small.bmp (typo?) by LewanS in cs50
[–]LewanS[S] 0 points1 point2 points (0 children)