ẞ.txt
β.txt
阝.txt
ß.txt
ẞ.txt
SS.txt
ss.txt How nice. We even use const in all
the right places! I think! Except
maybe argv! Who knows? The compiler
sure doesn't seem to care much. I
guess casting non-const to const is
pretty harmless. Fair enough, GCC,
fair enough.
Lucky toupper has no way to return
an error and just returns 0 for 0,
right? Or maybe 0 is what it returns
on error? Who knows! It's a C API!
Anything is possible.
Both of these have defined answers written into the C standard itself. So the problem here is that… we
allocate enough room for “DOG\0”,
but we end up converting “doggo
override\0” to uppercase, so we end
up writing past the area that malloc
allocated for us. I believe the
technical term is a fucky wucky
buffer overflow.
Something about this sentence screams Rust programmer but I can't put my finger on why. - does timers
- does sleeping and/or threads
- handles user input
- gets some kind of output to screen
- provides basic data structures
- writes and loads files for high scores
There are a lot of things that I like about the original Snake that most
people don't put into their hobby projects: - There is a delay right before you hit the wall.
If you are playing at the fastest speed and barrel towards the wall,
it slows down to the slowest speed when you are on the final square
before game over.
I always loved this because the it made the most deadly obstacle the
snake body which is the one that you yourself created.
- When it polled input it stored one of each press.
If you pressed up then left, and the next tick the snake would turn
up, and the next tick the snake would turn left.
- There are only four parts of the screen max that are updated each
tick, the new snake head is drawn, the previous snake head is drawn as
a body, the previous snake butt is cleared, and maybe a new egg is
drawn.
Very common to see a snake game draw the entire screen, or redraw the
entire snake on each tick. Super frustrating to have a game get start
to stutter more and more as your snake gets longer.
- You could play using two buttons instead of four.
The game could be played by using buttons 2=up 8=down 4=left 6=right.
But it could also be played using buttons 1=up-or-left and
9=down-or-right because you can only change from your current
direction to two other directions since you can't have a button to go
the opposite direction, and you don't need a button to go the same
direction.
It was never super intuitive though, a "right turn" or "left turn"
button would make more sense.
The only critique I have for this is your snake almost doubles speed when
you move up or down which is pretty jarring. void * true_ptr = &true_ptr;
true_ptr is a pointer to itself. So however many times you deference it: printf("%p\n", true_ptr);
printf("%p\n", &true_ptr);
printf("%p\n", *((void**)true_ptr));
printf("%p\n", *((void**)*((void**)true_ptr)));
You get the same pointer: 0x5555fefe715b
0x5555fefe715b
0x5555fefe715b
0x5555fefe715b
I still think that it's neat that, even with ASLR, you have an address at compile time that you know won't collide with address space of malloc results, or the address space of your stack. const void * const_pointer = &const_pointer;
void * const const_value = &const_value;
I know they are actually selling the license to use it but still it seems weird that any site that licenses and uses this will also be mass distributing it to peoples machines.