485
Coding chess (startrek.website)
you are viewing a single comment's thread
view the rest of the comments
[-] PeriodicallyPedantic@lemmy.ca 85 points 9 months ago

No lie, after taking about 2 weeks of my first programming course in university, I did almost exactly this, trying to make a poker game.

I hadn't learned about objects, or functions, or even loops. Just one big method that had an if for every hand permutation.

I hadn't ever been exposed to programming before, and I loved it, but I knew nothing about it. Those were the only tools I had in my toolbox, and you know what they say about how when you only have a hammer everything looks like a nail.

I'm a professional dev now, so I really hope I grew out of it lol

[-] homura1650@lemm.ee 12 points 9 months ago

Back when I was learning, I made a flashcard program. It had a class that was essentially a constant array, so you could call get(int i), and it would return an object describing both sides of the card.

How did I implement such a class you ask? First, I made a spreadsheet with 2 collumns to hold the data, with a third collumn of incrementing integers. Then, in the 4th column, I used string concatanation to right a java if statement that compared a variable against the index collumn; and if they match, return an object constructed from the 2 data columns.

Click and drag the 1 cell I wrote in the 4th collumn to replicate it in all the rows, then copy and paste the 4th collumn into notepad++.

I'd like to say I've moved past this; but my most successful projects have mostly been code generation ones; so really I've just moved past Excell.

[-] luciferofastora@lemmy.zip 1 points 6 months ago

I mean, moving past Excel is still an excellent development.

Signed, a guy that keeps dealing with people who need my code to spit out weird spreadsheets.

[-] Droechai@lemm.ee 9 points 9 months ago

Time to get some qbasic coding in, your if and goto experience will do wonders

[-] Anticorp@lemmy.world 6 points 9 months ago

I'm a professional dev now, so I really hope I grew out of it lol

I was reading your comment and wondering if I've outgrown it. I've been a programmer for 20 years...

[-] PeriodicallyPedantic@lemmy.ca 3 points 9 months ago

I'm going on 15 years. Some times I'm not so sure.

[-] LarmyOfLone@lemm.ee 4 points 9 months ago* (last edited 9 months ago)

I still remember when "the light went on" as realized how variables worked. I was on my way to school and couldn't focus on mundane things and started hating school.

Now I live in a van down by the river. But I'm still coding!

[-] nelly_man@lemmy.world 4 points 9 months ago

Same thing with me and chess in high school. I learned TrueBASIC, and I didn't learn about arrays or subroutines. But, I did manage to make a chess application that two people could play a game of chess on. It highlighted legal moves when you clicked on a piece and ensured that only legal moves were made. It also showed the captured pieces to the side of the board. I think I had it set up so that you could only promote to a previously captured piece, but all the other rules were implemented properly (or at least, I assumed they were).

The implementation involved a bunch of variables for each individual chess piece and a bunch of if statements inside a loop. I remember describing arrays and explaining that I wished they existed, but never actually found out they did until I was finished. I don't know how many lines of code it was, but when I copied it into Word, and it spanned about 350 pages in total.

Part of me is proud of the accomplishment. Another part is horrified.

[-] 65gmexl3@lemmy.world 1 points 9 months ago

That's why its good to have a mentor or someone just to give feedback if we can find one for ourselves

[-] PeriodicallyPedantic@lemmy.ca 2 points 9 months ago

To be fair, or only took a few more classes before they introduced things like arrays and loops, and I realized how stupid my plan was lol

this post was submitted on 29 Jan 2024
485 points (98.4% liked)

AnarchyChess

5192 readers
139 users here now

Holy hell

Other chess communities:
!Chess@lemmy.ml
!chessbeginners@sh.itjust.works

Matrix space

founded 1 year ago
MODERATORS