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

AnarchyChess

5169 readers
174 users here now

Holy hell

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

Matrix space

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] CeeBee@lemmy.world 49 points 9 months ago (7 children)

I really hope this is satire. Otherwise I'm scared to ask how long it took.

[–] Researchgrant@lemmy.world 91 points 9 months ago (4 children)

It's definitely satire. 2 million lines of code is an absurd under-exageration. This post had me looking up the number of possible chess games, because if you coded chess like above you would have to have an if statement for every outcome, and it's 10^120 different possible games.

https://en.wikipedia.org/wiki/Shannon_number

[–] Taalen@lemmy.world 45 points 9 months ago

The way I understood it, it's two million lines and nowhere near finished.

Anyway, satire.

[–] PeriodicallyPedantic@lemmy.ca 6 points 9 months ago* (last edited 9 months ago)

That's the number of possible games, the number of possible board states is much lower, 10^40.

Although you're still clearly correct in the end anyways because it's still an absurd number of board states and it's not even formatted to be one state per line.

[–] flames5123@lemmy.world 3 points 9 months ago

You only have to code a fraction of those as the computer should take the same move for several of the user inputs.

[–] safesyrup@feddit.ch 3 points 9 months ago (1 children)

I read that there are less atoms in the universe than possible chess games, which is quite insane

[–] chetradley@lemmy.world 16 points 9 months ago (1 children)

By an extremely significant margin. Here's another fun one: getting a unique shuffle in a deck of cards is 1/52!. So if you wanted to count all of the different possible arrangements of cards, counting one per second, you can:

Start walking around the equator at a leisurely pace of one step per billion years.

Once you've made it around the earth, remove a single drop of water from the Pacific Ocean and walk around the earth again.

Once the Pacific Ocean is empty, re-fill it and lay a sheet of paper on the ground. Keep stacking a new sheet every time you've re-emptied the ocean drop by drop every time you circle the earth at one step every billion years.

When the stack of paper reaches the sun, you're about a third of the way there!

[–] hakase@lemm.ee 9 points 9 months ago* (last edited 9 months ago) (1 children)

The way I like to put it is that every single time you randomly shuffle a deck of cards, you are guaranteed to get an order that has never been seen before, by anyone in history. That will be the case for every person who ever shuffles a deck of cards for the rest of time.

[–] Ookami38@sh.itjust.works 5 points 9 months ago

To be fair there was that one time a perfect shuffle led to a perfect bridge deal, each player getting a full suit. Sometimes even a fair shuffle goes weird lol.

[–] ImplyingImplications@lemmy.ca 18 points 9 months ago (4 children)

Today I will remind everyone of DRAGON: A Game About a Dragon

This game was developed by someone who didn't know anything about programming outside of IF statements, integers, and strings. Here is an excerpt of the massively long source code

[–] Xyre@lemmus.org 10 points 9 months ago

For a second there I thought the 100% science-based dragons game had been made.

[–] Da_Boom@iusearchlinux.fyi 7 points 9 months ago

Holy shit... That's nuts. I do see the occasional boolean in there. But it might as well be ifs ints and strings like you said.

Man went full static C programming in C# and coded the whole thing in what looks like one class. Instances?, loops excepting XNA gameloop? What's that? Whos that? Where's that?

Honestly I'm not even mad, that's dedication. Dedication and a refusal to learn more than just the basics. Kinda want to buy the game now just to see how far a fucktonne of if statements can get. By the looks of it, I'd say straight into the dragons maw.

[–] SkyezOpen@lemmy.world 5 points 9 months ago

Yandev as well. Guy put the ai for every single character in a single function separated with if/then statements. It was also called every game tick.

[–] CeeBee@lemmy.world 2 points 9 months ago* (last edited 9 months ago)

My eyes! The ~~global~~ variable list is huge!

Edit: nm, I looked again and they're in a class. Still insane either way.

[–] nicolairathjen@lemmy.world 18 points 9 months ago (1 children)

The post is satire, but I remember being ~8-9 and trying to create a "game" in Microsoft Word with hyperlinks between documents and nothing else. I had hundreds of documents (each representing a game state) before I got tired of that project.

[–] aksdb@lemmy.world 7 points 9 months ago

That's pretty clever for that age and shows, that your brain already had the right wiring for (software) engineering. You set out to solve a problem by leveraging the tools you had and bending their functions to your needs. There's a lot of abstract thinking involved.

[–] Lux@lemmy.blahaj.zone 17 points 9 months ago (1 children)

Literally impossible to code every bosrd state, so forever

[–] grue@lemmy.world 11 points 9 months ago (1 children)

The person who downvoted you must not have thought it through.

For comparison to that 10^120^ possible game states, the number of atoms in the universe is only 10^82^ and the amount of time until the "Dark Era" of the universe (after all the stars have died and even all the black holes have decayed via Hawking radiation) is only 10^114^ to 10^117^ seconds. In other words, it really is literally impossible either to build a computer big enough to store all the board states or to write them all down even if you did.

[–] morrowind@lemmy.ml 1 points 9 months ago (1 children)

is only 10^114^ to 10^117^ seconds

I mean a good program could do a 100 million states/s . So if you could make a computer that lasts until the end of the universe it could go through all of them I guess?

With supercomputers, probably way more, that's just the figure for like a laptop. Plus you could filter out all the states that are symmetric and stuff and lower it by one order of magnitude.

[–] grue@lemmy.world 3 points 9 months ago (1 children)

I guess, maybe?

I'm not prepared to speculate on the performance of a computer literally larger than the universe.

[–] morrowind@lemmy.ml 1 points 9 months ago (1 children)

that's the most fun type of speculation. No fun speculating over computers that could emulate realistic things like all states of a rubiks cube, cause that's probably already been done.

[–] grue@lemmy.world 1 points 9 months ago* (last edited 9 months ago) (1 children)

...hey, wait a second, you pulled a fast one on me with that "100 million states/s" silliness!

I just remembered what the time boundary I was talking about was actually trying to measure: it had nothing to do with the speed of computation; it was the speed of typing in the program code. That's why 1 state per second was a reasonable estimate (if not overly optimistic). If you tried to type in all those ifs and prints manually, that's what would take you longer than the heat death of the universe.

Besides, even executing the program can't do 100 million states per second because it only does one state transition and then waits for user input.

[–] morrowind@lemmy.ml 1 points 9 months ago

Oh I was assuming you'd write another program to create this program, like the "4 billion if's" blog post if you've read it.

[–] Droggelbecher@lemmy.world 10 points 9 months ago* (last edited 9 months ago) (3 children)

There's a mathematician that figured that there's 10^120 possible chess games, as a lower bound. https://en.m.wikipedia.org/wiki/Shannon_number#:~:text=Shannon%20showed%20a%20calculation%20for,a%20Computer%20for%20Playing%20Chess%22. That's a 1 followed by 120 zeros for just the number of possible games. With this method they'd have to manually go through every move for every one of those games. If we say a game lasts 30 turns on average and they'd take 1 second to code each turn (realistically it'd be longer) it'd take 6.9*10^109 (69 followed by 108 zeros) times as long as the age of the universe.

[–] rikudou@lemmings.world 4 points 9 months ago (1 children)

So it's doable? That's all I needed to hear.

[–] Droggelbecher@lemmy.world 2 points 9 months ago

Are you a theoretical computer scientist?

[–] PM_ME_VINTAGE_30S@lemmy.sdf.org 3 points 9 months ago

69 followed by 108 zeros

Nice

[–] tiredofsametab@kbin.social 2 points 9 months ago (1 children)

for just the number of possible games.

for just the MINIMUM number of possible games. (lower bound)

[–] Droggelbecher@lemmy.world 2 points 9 months ago (1 children)
[–] tiredofsametab@kbin.social 2 points 9 months ago

I responded to the wrong comment. Sorry.

[–] dannym@lemmy.escapebigtech.info 5 points 9 months ago

this is definitely satire, otherwise it would take longer than the age of the universe to finish coding it lol

[–] SpaceNoodle@lemmy.world 3 points 9 months ago

I've seen people try to write programs like this.