820
Coding chess (lemmy.world)
top 50 comments
sorted by: hot top controversial new old
[-] cupcakezealot@piefed.blahaj.zone 3 points 20 hours ago

now implement castling in that

[-] wewbull@feddit.uk 71 points 1 day ago

At university I had an introductory C course where one assignment was to write a program that searched a 4x4 array of booleans for groups of cells set to true. Groups had to be rectangles, powers of 2 in width and height, and could wrap (i.e. they could go off the right edge and back on the left edge). We had to submit our programs by e-mail and printed form one week later. The prof. marked the paper versions and the TA ran and tested the digital. One slight problem, if you used the university owned printers, they charged for print outs. A few pence per page to cover costs and stop people abusing the rather nice high quality printers the computer faculty had.

I'd always enjoyed programming and whilst C was new to me, using another language wasn't a big problem. As I worked on it I realised the problem wasn't as straightforward as I first thought, but I spent a few hours on it that evening and had a solution I was happy with.

Penny was a student on the course whose approach to academia was memorization. She didn't consume, process, and apply concepts. She just remembered them. Her favourite subject was maths. While the rest of us were struggling to derive some formula, she'd have just committed the process to memory.

Penny was complaining a lot on this programming assignment. She didn't understand why the assignment was so hard for an introductory class. I didn't judge. I know some people find programming hard, but I didn't feel I could help her much without jeopardising my own mark. There's only so much uniqueness in a small program and if she just copied my solution we'd both get penalised for plagiarism. I did mention to her the cases I'd found tricky to get right was when two groups overlapped. If one group completely covered a smaller one you'd only report the bigger one, but if not you'd report both groups.

I heard, through her boyfriend, that that week had involved many long evenings working on this assignment, but she turned up at the next class solution in hand. Obviously stressed, she carried a pile of paper of several hundred pages. She had written a program that consisted of an if-statement for every possible group size and location. About a hundred different possible groups. Each condition written with constant value indices into the array. To cope with the overlapping groups problem, checks for smaller groups also checked that no larger group also covered this area. No loops. No search algorithm. Just a linear program of if-statements.

Apparently debugging this has been a nightmare. Cut and paste errors everywhere, but when I'd told her about overlapping groups aspect it had blown her mind. There always seemed to be a combination she hadn't accounted for. Multiple times she thought she was done, only to find a corner case she'd missed. And just to kick her when she was down, she'd paid for multiple printouts, each one costing about £10 only to find a problem afterwards.

This consistent A grade student who sailed through everything by relying on her memory had been broken by being asked to create an algorithm rather than remember one. She got credit for submitting a solution that compiled and solved some cases, but I doubt the professor got past the first page of that huge printout.

Penny had worked really hard for that D.

[-] Hawk@lemmy.dbzer0.com 59 points 1 day ago

Lol why does this entire text sound like a setup for that last sentence

[-] Iambus@lemmy.world 2 points 23 hours ago

😂😂😂

[-] DahGangalang@infosec.pub 5 points 1 day ago

I need this in green text format

[-] buttnugget@lemmy.world 3 points 1 day ago

Professor was an idiot if it gave a D for a working solution. Getting it working is the grade, optimizing is the next step.

[-] Iambus@lemmy.world 4 points 23 hours ago
[-] buttnugget@lemmy.world 1 points 21 hours ago

Gottem! Meanwhile, I’m right and you’re a moron.

[-] Iambus@lemmy.world 2 points 20 hours ago

The downvotes says you're retarded, give it up dickhead 😂

[-] buttnugget@lemmy.world 1 points 14 hours ago

So if your moral and intellectual superior was being upvoted, you’d concede me being right? You’re even dumber than I first assessed. Run along worthless dumbfuck, leave your superior alone.

[-] Jtotheb@lemmy.world 8 points 1 day ago

Don’t teach lol

load more comments (3 replies)
[-] bvoigtlaender@feddit.org 33 points 1 day ago

This is actually what made me start my programming journey. Made small games using PowerPoint until I was starting to make an level editor on a 12x12 grid. My father thankfully stopped me pretty early on and showed me Game Maker 7. Not sure for how long i would have continued.

[-] gerryflap@feddit.nl 12 points 1 day ago

Are you me lol? I did exactly the same, and at some point I started computing how many slides I had to make to make anything larger and I pivoted. My dad didn't know this stuff but I also ended up at gamemaker

[-] JackbyDev@programming.dev 5 points 1 day ago

PowerPoint is actually turning complete so... https://youtu.be/uNjxe8ShM-8

[-] Anomalocaris@lemm.ee 4 points 1 day ago

hey, there is an inherent fun in maing games/programs using things that were never meant to.

once i did a CPU/RAM emulator using excel, so you could see every bit.

it was fun to make loops, and programs

[-] NikkiDimes@lemmy.world 3 points 1 day ago

This is how I got into game development myself. I used to use Javascript to make dumb little interactive games in the early 2000s before it was ever meant to do such things, emulating what is now modern day HTML5 canvas and such

load more comments (2 replies)
[-] tinkermeister@lemm.ee 3 points 1 day ago

I suddenly feel in good company. I got my start doing crazy things with PowerPoint and Excel because it was what I knew.

[-] ChaoticNeutralCzech@feddit.org 3 points 1 day ago

I coded basic games in PowerPoint using animations plus VBA. Not good.

[-] SGG@lemmy.world 144 points 2 days ago

Honestly back when I was a kid this is how I thought games were made, every possible image of a game was already saved and according to your input it just loaded the next image.

I stopped thinking that with 3d games

[-] 0ops@lemm.ee 51 points 2 days ago

I thought that they were managing that stuff on a per-pixel basis, no engine, assets, or other abstractions, just raw-dogging pixel colors.

And before I even played video games at all I was watching somebody play some assassin's creed game I think and I thought the player had to control every single limb qwop-style.

[-] FateOfTheCrow 22 points 2 days ago* (last edited 2 days ago)

In the first few Assassin's Creed games, they did use the idea of a Puppeteer system for the control scheme, although it wasn't physics-based or anywhere near as hard as QWOP. Each of the controllers face buttons performed actions associated with each limb, and the right trigger would swap between low profile actions and high profile actions.

In the top right of the screen, there was always a UI element showing what the buttons did at that moment in that context, which might've been why you thought it was a QWOP style system. It's not exactly what you were thinking of at the time, but you were closer than you realise.

load more comments (1 replies)
load more comments (1 replies)
[-] Scoopta@programming.dev 25 points 2 days ago

Even with 2D games that's basically impossible. Only time it could work is with turn based games and then...you end up with this post lol.

[-] Wolf314159@startrek.website 16 points 2 days ago

I see you've never played "Dragon's Lair", where every scene was cell animated and the player "chose" the path that the animation would take.

load more comments (2 replies)
[-] papalonian@lemmy.world 18 points 2 days ago

I remember having a thought one day as a young kid while interacting with a DVD main menu (the kind that had clips from the movie playing in the background, and would play a specific clip depending on what menu you went in to).

"This is basically how video games work, there's a bunch of options you can choose from and depending on what you do it shows you something. Videogames are just DVD menus with way more options."

I grew up to not be a programmer.

load more comments (3 replies)
[-] mister_flibble@sh.itjust.works 4 points 1 day ago

Those shitty old tiger hand holds kind of worked like that.

load more comments (6 replies)
[-] pugnaciousfarter@literature.cafe 50 points 2 days ago

This is very inefficient, they should be using a switch case.

[-] Hotzilla@sopuli.xyz 3 points 1 day ago* (last edited 1 day ago)

For efficiency you should you GOTO, so you can join trees that end up in same position.

Like those create your own adventures books.

Programming chess as a single lookup table is wild

[-] mormegil@programming.dev 1 points 23 hours ago

Its written vibe.

[-] grendel84@tiny.tilde.website 19 points 2 days ago

@VoidJuiceConcentrate @maris

Right?

pretty sure there are more possible chess positions than atoms in the earth (universe?), so even if every atom of our planet were converted to transistors there'd be no way to fully represent all possibilities.

[-] Zink@programming.dev 36 points 2 days ago

This was a fun one to look up. https://en.wikipedia.org/wiki/Shannon_number

It looks like the number of valid chess positions is in the neighborhood of 10^40 to 10^44, and the number of atoms in the Earth is around 10^50. Yeah the latter is bigger, but the former is still absolutely huge.

Let's assume we have a magically amazing diamond-based solid state storage system that can represent the state of a chess square by storing it in a single carbon atom. The entire board is stored in a lattice of just 64 atoms. To estimate, let's say the total number of carbon atoms to store everything is 10^42.

Using Avogadro's number, we know that 6.022x10^23 atoms of carbon will weigh about 12 grams. For round numbers again, let's say it's just 10^24 atoms gives you 10 grams.

That gives 10^42 / 10^24 = 10^18 quantities of 10 grams. So 10^19 grams or 10^16 kg. That is like the mass of 100 Mount Everests just in the storage medium that can store multiple bits per atom! That SSD would be the size of a ~~small~~ large moon!

load more comments (13 replies)
[-] nexguy@lemmy.world 6 points 1 day ago

Well this is how programing works so if you don't like it...

[-] xep@fedia.io 17 points 2 days ago

This is where you'd normally go "there must be a better way..."

load more comments (2 replies)
[-] darvocet@infosec.pub 24 points 2 days ago

AI has probably finished this game by now.

[-] MadMadBunny@lemmy.ca 22 points 2 days ago

And still lost.

[-] MnemonicBump@lemmy.dbzer0.com 19 points 2 days ago

As a middle schooler I used Power Point to make FMV games for my friends and classmates, and it was basically this. Just, like, SO MANY slides

[-] the16bitgamer@programming.dev 3 points 1 day ago* (last edited 1 day ago)

They are doing it dumb. You can text output chess but you just need to keep track of where the pieces are in code, then when you are ready to output, place the characters. Saves so much time. /s

[-] _AutumnMoon_ 11 points 2 days ago

Are they trying to code every possible chess position??

[-] porous_grey_matter@lemmy.ml 14 points 1 day ago

The implication is that the person in the meme is

load more comments
view more: next ›
this post was submitted on 27 Jun 2025
820 points (100.0% liked)

Programmer Humor

24587 readers
559 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS