Post B4UBdoNQWNe7NRray0 by sirwumpus@tilde.zone
 (DIR) More posts by sirwumpus@tilde.zone
 (DIR) Post #B4UBdjTyiauqCJtFz6 by duke_of_germany@mastodon.gamedev.place
       0 likes, 0 repeats
       
       After writing so much software in C# and TypeScript during the past years, I felt a bit burned out.- Decided I need a little "OOP detox"- Dived a little into Rust for a while- Result: great language, but did not fully click in some aspectsSo now I am doing the only sensible thing:Getting back into C. πŸ˜„#C #Clang #oopDetox #CProgramming #Handmade
       
 (DIR) Post #B4UBdjjvlHfyznLzqi by sirwumpus@tilde.zone
       0 likes, 0 repeats
       
       @duke_of_germany If you're looking for a challenge and testing your understanding of #C, then the winners of #IOCCC  are worth exploring.
       
 (DIR) Post #B4UBdjwgzpstdNKBk0 by duke_of_germany@mastodon.gamedev.place
       0 likes, 0 repeats
       
       I am probably not at that level yet! πŸ˜‚ But I will have a look!@sirwumpus
       
 (DIR) Post #B4UBdkBE7nViMS7nOa by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus nevertheless you should never (NEVER) doubt yourself there. You could also start out with simpler ones: perhaps one-liners? Although those can also be complicated. Also some authors give a lot of details. I'm one of those but you probably would not want to try mine with that because I write so much. Always have. Although some of the things I have done are extremely funny. But even if you don't understand them you might enjoy using some of them!
       
 (DIR) Post #B4UBdkLVVZjYsKw0Q4 by duke_of_germany@mastodon.gamedev.place
       0 likes, 0 repeats
       
       Thank you for the encouragement! πŸ™‚Since I wrote the initial post, I feel I already learned a lot. At least I have been busy both reading the book and other resources, and of course writing a lot of C.Even though I still feel like a beginner, I am having so much fun with the language, and I will stick to it for the foreseeable future!@xexyl @sirwumpus
       
 (DIR) Post #B4UBdkWqpOo9RWF46K by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus keep it up! If it works for you I suggest you find a project to work on and focus on that - but maybe also go through exercises in the book. My first real C project was a MUD but I had been doing asm for years before that and some C and other things also. That was a long time ago but that MUD still exists. Whatever you do avoid books by  Herbert Schildt! I actually have the infamous one and it's TERRIBLE. Teaches really bad things. He also uses void for main().
       
 (DIR) Post #B4UBdkkfzzro8Oi6eO by duke_of_germany@mastodon.gamedev.place
       0 likes, 0 repeats
       
       Awesome that you wrote a MUD! πŸ™‚ Did you write any other games?My current project: re-writing my point & click adventure engine (that I wrote in C#) in C. Took me some time to get the hang of things, but I have *so* much fun with C. I am finally excited again to code.I split up the whole project into smaller libraries (recently I finished my parser for Aseprite files, for example). Still a long way to go, but I enjoy the process!@xexyl @sirwumpus
       
 (DIR) Post #B4UBdktBUMfkYmgtua by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus another one to avoid and this one gets lots of praise: Head First. Avoid it. They do not talk about UB (undefined behaviour) at all. They do not bring up sequence points (which is an issue for UB - specifically unsequenced modification and access to variables). They claim that you can replace scanf() with fgets(). They don't even do the same thing.
       
 (DIR) Post #B4UBdkubP5o4dBM27c by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus yes I've written other games and the last two @ioccc  one of my two entries (of the year) were games. I'll link to each one in next comments.
       
 (DIR) Post #B4UBdlCgJsGhXFoTIm by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus @ioccc First one: https://www.ioccc.org/2020/ferguson1/index.html. Very feature-rich Snake game. ncurses. Has a drawing mode, two cheat modes (one enabled by default) and so much more. This was one of the most fun IOCCC entries I wrote but it's not the one I put the most heart into. That's the next one.
       
 (DIR) Post #B4UBdlD2IYYHYLykr2 by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus you might also like the copy of the draft of the C17 standard. An example of unsequenced mod and accessing is btw: i = ++i + 1; This is also bad: foo[i++] = i;Unfortunately there are a lot of traps in the standard and compilers are not required to warn about it though they will usually warn about that one.Here is a copy of the draft: https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf.Good luck with it and keep it up!
       
 (DIR) Post #B4UBdlUPFyRkQE6cvg by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus @ioccc https://www.ioccc.org/2024/ferguson1/index.html. This was my completely different Oregon Trail from the one written in 1978. It is called A Pact With the Devil On the Oregon Trail. It has more gotos than the original BASIC! It has 152 (!!). It is so insane that two of the loops that act on the same iterator AND same loop have the loop code in the OTHER loop. In a few minutes the code jumps hundreds to thousands of times! That was the second year I ruined a technique for the IOCCC.
       
 (DIR) Post #B4UBdlhAUWef3o4ooy by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus @ioccc the judges no longer want to see many gotos to make code hard to follow. The year before it was digraphs and trigraphs. They said they were 'dated'. Who knows if I do that again. Maybe eventually people will start hating me hahaha. I've written other games too t hough. Still the one I've spent most on is the MUD. My main mortal too, he was overpowered because I explored the world so much (without cheating!).
       
 (DIR) Post #B4UBdlqjuwJLXUYSjw by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus @ioccc in fact I knew the world so well that if a god/goddess/immortal run quest was run I won. And that included the races round the world. I put in these quest NPCs that teleport to random locations that then announce where they landed. The idea: find it and get a quest token; kill them and get a certain amount. They then teleport again. If they're not in a wait state and time is  up they teleport and you have to go get them!
       
 (DIR) Post #B4UBdlyXRwY7vgCgtc by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus @ioccc a couple friends of mine (they also had immortal or god characters: one of each .. but this was with one of their mortals) would go round the world. We rarely if ever could not get there in time. The exceptions is when deep in a zone that is protected by keys and things that take time to get. Even now if I were to go in I would be able to travel a significant amount of the world just not as quickly. There was not a single player who knew it better than me.
       
 (DIR) Post #B4UBdm9AoP3YSfBBTM by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus @ioccc I've said for years that fantasy and MUDs have ruined lives. That's true but in many respects they saved my life. Did you ever play a MUD?
       
 (DIR) Post #B4UBdmHKK5ZurwzhBI by duke_of_germany@mastodon.gamedev.place
       0 likes, 0 repeats
       
       I have never played a MUD myself, I only read about them! πŸ™‚@xexyl @sirwumpus
       
 (DIR) Post #B4UBdmNLxgOnAdoVZg by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus @ioccc and keep up the great work! It's great you have a project. That's the way to go about it. Good luck and indeed have a lot of fun!
       
 (DIR) Post #B4UBdmOPtjFXDwJMES by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus ah. Well they're a lot of fun if text games are your type of thing. But there are so many different kinds too. And then some would argue that MMORPGs (like the big graphical ones including Blizzard's World of Warcraft) are just graphical MUDs. We had things they had (and better) long before it was even a game. Obligatory question: have you ever played Colossal Cave Adventure? A funny thing about that one ...
       
 (DIR) Post #B4UBdmfQsSrQ4iGwkq by duke_of_germany@mastodon.gamedev.place
       0 likes, 0 repeats
       
       I have not played Colossal Cave Adventure, but I played a bit of Zork, and a few other games from Infocom, Magnetic Scrolls and Legend Entertainment. πŸ™‚ Great that you were able to fix the bug!Sounds like you worked on a lot of interesting things! @xexyl @sirwumpus
       
 (DIR) Post #B4UBdmmsQmocRnktMG by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany yes I have worked on a lot of interesting things indeed. So has @sirwumpus. I haven't played a computer game (besides one of my own that is) in years and video games even longer. I used to play a lot more. Even then I was into programming in some way or another.
       
 (DIR) Post #B4UBdmnaO9NmU05SSm by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus someone in my past wanted me to fix a bug in their version of it (the version they found). It was segfaulting. So...I decided: what could possibly cause it? I swore at it. It ended up crashing. I was able to fix it even though it was obfuscated. I've got way better at that now and great at obfuscation as well. But last year I was playing with a version and the same thing happened. Saying a variety of rude types of things can be very amusing to see what it does.
       
 (DIR) Post #B4UBdmufxn3OpzP7Vw by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus in high school I with another guy helped a teacher with computers. Well we had a lot of keyboards and mice in the back room so what we sometimes did is one would get a ball out of a mouse and then the other would have the keys facing out as if it was rounders. As you can imagine the ball went flying and keys did too. We always cleaned up after ourselves so she didn't mind.
       
 (DIR) Post #B4UBdnDSpw5BmGC7nc by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus ..and seeing what it does includes crashing. But also other things.
       
 (DIR) Post #B4UBdnH0ckuzxFqxKC by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus and we had to help another computer teacher sometimes. She had us get our tool to remove stuck floppy disks. There was no floppy disk in the drive at all. She at one point did not know how to open the CD-ROM tray. I had to help another person with an (electrical) typewriter that would not turn on. I knew immediately it must be unplugged so I looked at the floor and then pointed down so she would see.
       
 (DIR) Post #B4UBdnY1bUWso1oXqa by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus we had printers that didn't work (what printer does though?) and they would move on their own so we had little races. But there were other things as well. That was about the only real fun I had there. I had to take a C++ class. I loved C but I also loved asm. I was bored to tears in C++ (and I hate it even more now). On the side I was doing low level graphics/sound in asm. It was a pretty rough childhood but I made it through and that's what matters.
       
 (DIR) Post #B4UBdnhb1uBZHiIBlY by duke_of_germany@mastodon.gamedev.place
       0 likes, 0 repeats
       
       Oh, this sounds so lovely, like really wonderful memories, I love this! πŸ™‚Apart from the obfuscation contests, are you working on any other projects at the moment?@xexyl @sirwumpus
       
 (DIR) Post #B4UBdnogbXrBdhbqoi by sirwumpus@tilde.zone
       0 likes, 0 repeats
       
       @duke_of_germany @xexyl Wrote last week ttymacros primarily for rogue(6) but works for other things, inspired by the restoration work for rogue5.4 and rogomatic. Also working on eh(1) v1.5 with tweaks.
       
 (DIR) Post #B4UBdnxu3HEI6HvDBQ by duke_of_germany@mastodon.gamedev.place
       0 likes, 0 repeats
       
       At first I did not fully understand what this was for, but I just compiled it and tried it out a little bit. This is really cool!(I read just a little bit through the code, but so far, I do not understand everything that is going on there... πŸ˜…)@sirwumpus @xexyl
       
 (DIR) Post #B4UBdo4HfYKkQ4uJ84 by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus as far as his code goes. If you're still just learning then yes give it some time. You'll get there. I like that he used memcmp() in find_macro(). You'll probably not see that as much but it can be useful if you know there will be NUL bytes in the data as the str*() functions will stop on the first NUL byte. Not that you can't make use of strings with multiple NUL bytes with the usual print routines.
       
 (DIR) Post #B4UBdoFyy3gv0MNeMa by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus the practical version had 134 gotos which is already insane. I updated it to have what it really should have been - 152. And it is so bad that there are even two for loops that act on the same array using the same iterator but the code of each loop is in the body of the OTHER loop. There is very little you can trust about flow control in the code. One more message on this I think coming up.
       
 (DIR) Post #B4UBdoNQWNe7NRray0 by sirwumpus@tilde.zone
       0 likes, 0 repeats
       
       @duke_of_germany practical version had 134 gotos I think @xexyl  misses BASIC a lot 😁
       
 (DIR) Post #B4UBdoOqR6mRRqWjB2 by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus something I did in https://www.ioccc.org/2024/ferguson1/index.html is use a flat single char * as an array of close to 200 strings. This allowed me to have a lot of fun. Actually a version that did not win encrypted the strings and it had the key encoded in the data itself. I used the key to get the key so I could decrypt the rest of the strings. It was quite amusing but the @ioccc judges told me (which is rare) that they felt it was distracting from the real horrors: gotos being the worst.
       
 (DIR) Post #B4UBdoVE3NstldVp7g by sirwumpus@tilde.zone
       0 likes, 0 repeats
       
       @duke_of_germany @xexyl gcc and clang both support goto *pointer address.Which I think makes for more complex goto.
       
 (DIR) Post #B4UBdoZTnZHrypVDkm by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/gotos.c.txt shows only the lines with goto; whereas https://github.com/ioccc-src/winner/blob/master/2024/ferguson1/jumps.txt shows a single run with all the jumps: from top left to right to bottom left to right. That's how many jumps there are. The judges said gotos will not make it past the final rounds any more. Okay more to say now I think on it.
       
 (DIR) Post #B4UBdp2u2Ap5S5GicC by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus that was the second year I ruined a technique. But in the 1980s there was an entry with I think 23 or 24 gotos and they said then that they thought goto had reached their logical conclusion. I made that reality. The other ones I ruined were digraphs and trigraphs even though I only used digraphs mostly for formatting purposes (and messing up beautifiers). They declared them 'dated' at this point.
       
 (DIR) Post #B4UBdpJv0uQyIrEJ8a by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus oh something Landon told me about the gotos in this entry is something like 'one might say the amount of gotos is almost endless'. Well I certainly took it to an absurd amount. That was the point of course, to show how horrible they are. Though I have a special dislike for them which is all the more reason I'm happy I did it.
       
 (DIR) Post #B4UBdpKGzaiYJxOagq by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus in 2018 the judges asked what's special about 2305567963945518424753102147331756070. I answered it and put it in an easter egg. They removed the question from the guidelines the next year. It's back but in a different way and not asking what it is. It's the primorial prime of 99 btw. I would guess that @landonnoll put the question in as he has a long history of primes going back to the 1970s. Has held the record for primes multiple times.
       
 (DIR) Post #B4UBdpZs3bC76Kh30C by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus actually I wrote a program and this is what I discovered: 1.03 gotos per keyword. Then pre-processed it's 1.13. There are 32 case statements but there are 0 'break's. And the switch()s were rather mean in other ways as well.
       
 (DIR) Post #B4UBdpoPBYovpPUeem by xexyl@fosstodon.org
       0 likes, 0 repeats
       
       @duke_of_germany @sirwumpus @landonnoll he also has his famous calc program: https://github.com/lcn2/calc. And now it's time to go.