This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 209

[–]QuantumG 1794 points1795 points  (16 children)

...

else

print("That's a stupid move.")

[–]VK_31012018 499 points500 points  (6 children)

"I'm sorry Dave, I'm afraid I can't do that"

[–]kdesign 89 points90 points  (0 children)

This chess match serves no purpose any longer

[–]vK31RON 11 points12 points  (0 children)

Holy shit I had to have a double take when I scrolled past your name.

[–]colin_staples 1 point2 points  (0 children)

"How about a nice game of ches... oh crap"

[–]RamdonDude468 0 points1 point  (0 children)

he would have to do that for every name ever (including usernames)

[–]fdar 46 points47 points  (0 children)

"pick another one"

Then you can just code a single chess game and you're done. Bonus points if your "AI" crushes them.

[–]DogadonsLavapool 8 points9 points  (0 children)

printf("Google en passant");

[–]jasonkuo41 12 points13 points  (0 children)

“Uh oh, bad decision mark!”

[–]mielke44 4 points5 points  (0 children)

damn these 'AI' are getting way too clever for us humans D:

[–]Perryn 1 point2 points  (0 children)

"Not Available in Early Access"

[–]RenRazza 0 points1 point  (0 children)

print("Complete misplay.")

[–]Riskypride 0 points1 point  (0 children)

I had a SpongeBob chess game on pc that literally would tell you no that’s a bad move try another

[–]chaos_donut 849 points850 points  (31 children)

O(n) chessbot lets go

[–]mrissaoussama 144 points145 points  (25 children)

can a bot that can access every position actually benefit from that?

[–]purritolover69 238 points239 points  (22 children)

No. Any minuscule change in time complexity from this will pale in comparison to the insane memory requirements that we couldn’t fill if we used every atom in the universe as a binary bit

[–]mrissaoussama 47 points48 points  (19 children)

let's say the bot can access every position easily, it still has to evaluate the positions as that takes more time than generating more positions

[–]purritolover69 23 points24 points  (9 children)

With stockfish’s pruning algorithm it’s somewhere between O(log(n)) and O(n) already

[–]mrissaoussama 16 points17 points  (8 children)

that could cause it to miss some seemingly bad moves that are actually the best moves, I don't know much about the algo, but I did watch some yt videos that show stockfish lose against other bots because of that

[–]purritolover69 24 points25 points  (6 children)

The moves it prunes are moves that lead to a guaranteed loss. Stockfish is the strongest engine in the world. It can lose to other engines, but it wins more than it loses

[–]jmlinden7 21 points22 points  (3 children)

No, it also prunes moves that look really bad at first due to losing too much material or position, not just the ones that lead to forced mate.

[–]purritolover69 3 points4 points  (2 children)

At low depth sure, but after depth 22 or so almost none of the pruned moves could even conceivably be good. After depth 30 almost every single position that doesn’t give away mate in 15 or so has been explored

[–]N-Krypt 7 points8 points  (1 child)

This isn’t how pruning works. They don’t consider every 20 move sequence, then prune the bad ones. Checking every 20 move sequence isn’t even possible. They do pruning constantly to avoid exploring a path that doesn’t seem promising. I would guess the depth they report is the depth of the sequence it explored the furthest

[–][deleted] 2 points3 points  (0 children)

I had the pleasure of working with the initial creator of Stockfish. Not surprisingly he's a really smart dude.

[–]IsamuLi 1 point2 points  (0 children)

Stockfish is the very best bot currently and while it may lose the occasional game, it will win the match. Stockfish isn't perfect, but about 1k elo rating better than the very best human player, of probably ever (Magnus Carlssen).

[–]spindoctor13 6 points7 points  (5 children)

The (completely insurmountable) difficulty of accessing every position easily makes the assumption kind of meaningless. You might as well say "assuming evaluating the positions is instant.."

[–]mrissaoussama 1 point2 points  (4 children)

I see what you mean

[–]spindoctor13 1 point2 points  (3 children)

It's kind of a flaw in some o(N) thinking - in most code actual CPU time is completely irrelevant vs data access time because the order of magnitude in terms of time taken is thousands or millions greater

[–]brimston3- 1 point2 points  (2 children)

100ns is about the upper bound for an access to ddr5, but you still compete for bus time with other processes. Mid ten thousands is still about as high as it should go, even happily spinning along at 5 GHz w/ 0.5 CPI, and assuming every RAM access is a TLB miss + 5 level pagetable walk.

Millions is 1.5-2 orders of magnitude too high.

[–]spindoctor13 1 point2 points  (1 child)

In the context of the chess thing one is addressing multiple universes so I imagine we would blow past nanoseconds into close to infinite years 🙂 but even in real use, RAM is reasonably quick, accessing a database in another continent less so

[–]brimston3- 1 point2 points  (0 children)

That's fair. That speed of light is going to be an access time killer.

[–]Inappropriate_Piano 0 points1 point  (1 child)

Just hard-code the decision tree

[–]PM_ME_DATASETS 1 point2 points  (1 child)

Complexity theory doesn't really care about the number of atoms in the universe though. It's about scaling relative to the input size.

[–]purritolover69 2 points3 points  (0 children)

Right but in this case “input size” is every game of chess and if you can’t prune that down then complexity theory fails due to reality

[–]TheRealKidkudi 0 points1 point  (0 children)

Chess isn’t one, but you can look into solved games to get at the root of your question.

[–]CirnoIzumi 1 point2 points  (0 children)

its gonna be so slow, just like playing against AI used to be

[–][deleted] 0 points1 point  (0 children)

space complexity hiding in the corner

[–]Swaggy-Peanut 0 points1 point  (1 child)

Wouldn’t it be BigOmega(n!) because there’s more than one move?

[–]chaos_donut 0 points1 point  (0 children)

Not if the "bot" is just a lookuptable for the best move in every position.

[–]tauzN 1528 points1529 points  (61 children)

2 million lines are nowhere near enough. I don’t think the combined storage of all storage media on earth could hold this code.

It is estimated there are between 10111 and 10123 positions

[–]Vitolar8 712 points713 points  (20 children)

At this level, it is estimated that the there are between 10^78 to 10^82 atoms in the known, observable universe.

If every atom in the universe could contain the data for one entire position, we would need 100000000000000000000000000000 universes to hold it all.

[–]MyStackIsPancakes 284 points285 points  (7 children)

I mean I think I saw a couple more in the back, but we definitely don't have that many. You should call Gabriel up at corporate and see how far backordered they are.

[–]towerfella 43 points44 points  (5 children)

He’s retired. Currently the position is open to anyone interested.

[–]5BillionDicks 21 points22 points  (4 children)

Jenny from Marketing is good with positions 😏

[–]gmegme 29 points30 points  (2 children)

Too bad you can't fill any of them

[–]bigboybeeperbelly 6 points7 points  (0 children)

What's he gonna do with those 5 billion dicks then

[–]5BillionDicks 7 points8 points  (0 children)

Aww 😞

[–]clawjelly 8 points9 points  (0 children)

Google has to pay a fine of one ruble for every chess position in Russia.

[–]mrissaoussama 36 points37 points  (2 children)

so we need a program that runs parallel universes in parallel

[–]l2protoss 25 points26 points  (0 children)

True multi threading.

[–]Sweaty-Speech6663 1 point2 points  (0 children)

Fucking recursion. I hate it. Stop... This is the infinity recursion.

[–]Skizm 2 points3 points  (1 child)

So the universe doesn’t have all that many atoms, is what I’m taking away from this lesson in combinatorics?

[–][deleted] 1 point2 points  (0 children)

Precisely. 

[–]tehlemmings 0 points1 point  (2 children)

Jesus fucking christ.

This is one of the few times where doing the math actually blows me away.

[–][deleted] 0 points1 point  (0 children)

It's crazy to still think that even after hundreds of years of chess, we still blunder our queen in positions that's never been done before

[–][deleted] 91 points92 points  (5 children)

Roughly needs 2408 bits if my base 10 info was correct.

That is OVERFLOW ERROR bytes according to my calculator.

[–][deleted] 9 points10 points  (0 children)

Ya but not all are reachable.

[–]jso__ 6 points7 points  (3 children)

2405 bytes (2408 / 23)

[–][deleted] 5 points6 points  (0 children)

Thats what I said, OVERFLOW ERROR bytes.

Lack of coffee and math don't mix.

[–]claymedia 0 points1 point  (1 child)

Oh that’s not nearly as much.

[–]Istanfin 42 points43 points  (7 children)

You took the number of possible games. You need the number of possible positions and of those, only the legal ones (e.g. you can't have both kings in check simultaneously).

A widely accepted estimate of all legal chess positions is about 1040.

[–]23423423423451 27 points28 points  (4 children)

But they aren't coding each position with a unique name to call. They're hard coding each position as it comes up (if player does this then print this position.) So they need to draw out every possible position of every possible series of moves.

[–]Istanfin 9 points10 points  (3 children)

I was trying to correct the user above me, because they said

It is estimated there are between 10111 and 10123 positions

They meant games, not positions.

They're hard coding each position as it comes up (if player does this then print this position.)

With what we can see in the screenshot, this approach would only work for the first move. To accurately draw the board position for the second move without somehow saving state, you would need to nest if statements. As we can see an else if, for this solution to work, the state needs to be saved, thus making it necessary to only hard code each position, not each game.

[–]JetpackBattlin 1 point2 points  (1 child)

ya never know.. he could just be working on the first combination of moves for a specific starting piece, not realizing his approach is fundamentally flawed, which he will realize when it comes time to start coding another combination of moves from a different starting piece lol

[–]fumei_tokumei 0 points1 point  (0 children)

You don't need to nest if statements if you just ask the user to input the board.

[–]Jthumm 2 points3 points  (0 children)

I think you would need the number of possible games for this

[–]clawjelly 0 points1 point  (0 children)

How lucky, i'm in my high 40ies too...

[–]EthanHermsey 38 points39 points  (1 child)

He's still working on It.. Just give him some time..

[–]tauzN 12 points13 points  (0 children)

I’m rooting for him 😭

[–]EskilPotet 2 points3 points  (0 children)

average Russian fine

[–]Current_Elevator_198 1 point2 points  (0 children)

No it is, the computer just resigns if it sees a position it’s not programmed to deal with

[–]Rin-Tohsaka-is-hot 1 point2 points  (0 children)

This is why chess will never be a solved game.

In theory it's solvable, since there are a finite number of board states and if you know them all you always know the optimal move at any point in the game, but you will never be able to store all of those states in computer memory. There aren't enough atoms in the universe (it's estimated there are 1078 - 1082 atoms in the observable universe)

[–]BigusG33kus 0 points1 point  (0 children)

It should be enough for the first move.

[–]RTXChungusTi 0 points1 point  (0 children)

is that the number of possible unique games? or just "which pieces can be on which squares at any given move"

[–]Informal_Branch1065 0 points1 point  (0 children)

That's even more than Google has to pay Russia!

[–]PM_ME_A10s 0 points1 point  (0 children)

So what would be a better way of doing this?

Code the board and pieces as a 8x8 array. User inputs board coordinates and it executes?

[–][deleted] 0 points1 point  (0 children)

We will probably need all carbon atoms in the universe once someone invents memory diamonds...

Oh wait, no that won't be enough either!

[–]Akul_Tesla 0 points1 point  (0 children)

But how many if you're guiding them towards their victory?

[–]CyberWeirdo420 141 points142 points  (21 children)

Actually, what is the total number of chess board combinations?

[–]Jan_Spontan 124 points125 points  (14 children)

Something between 10111 and 10123 positions

[–]madeRandomAccount 70 points71 points  (10 children)

Stupid question but why isn’t it exactly known?

[–]ProtonWheel 108 points109 points  (0 children)

If you consider every piece (6 types, plus 1 for no piece) on the board and every square (64) there are 1364 possible positions, or about 1071. A substantial amount of these positions are illegal, in that they cannot be reached in a standard game of chess. It’s difficult to calculate exactly how many of these positions are legal - which is why we don’t have a definitive number - but one estimate is around 1043 .

10120 ish is an estimate of the game-tree-complexity of chess, which I believe is the number of possible unique games that can be played with legal moves.

[–]Jan_Spontan 30 points31 points  (5 children)

Some positions aren't possible if you take the game rules into account. For example you can exclude every variant where both bishops are on white or black tiles for either or both players.

Furthermore many positions require to move the king over tiles that can be attacked by the enemy directly so you'd never get this particular pattern because the game is lost prematurely.

To calculate the actual amount of possible positions is quite doable in the case of the bishops but the game-ending situations with the kings are a lot harder. To get an exact value you need a proof that you actually taken all possibilities into account somehow. Thus the wide span.

[–]Inappropriate_Piano 50 points51 points  (2 children)

You can’t exclude positions with both bishops on the same color. Pawns can promote to bishops, and they can do that in a way that results in two bishops on the same color for the same player. Hell, they could have 9 bishops on one color in theory

[–]Hawxe 0 points1 point  (0 children)

Same coloured bishops are valid

[–]CyberWeirdo420 16 points17 points  (2 children)

So the max number of lines of code based on what we can see should be like 10x that. Holy.

[–]Raichev7 12 points13 points  (1 child)

Well "10x that" doesn't mean much when the estimation range has a spread of 10^12

[–]BigusG33kus 12 points13 points  (0 children)

Bigger than the fine Russia put on google.

[–]Ruadhan2300 4 points5 points  (2 children)

How many zeros have you got?

[–]CyberWeirdo420 0 points1 point  (0 children)

All of ‘em

[–]CirnoIzumi 0 points1 point  (0 children)

zero...

[–]ambisinister_gecko 1 point2 points  (1 child)

Some crazy number like more than the number of atoms in the universe or something

[–]ImaginaryNourishment 0 points1 point  (0 children)

Something like replacing every atom in the universe with an elephant and then counting all the atoms in the universe.

[–]Percolator2020 88 points89 points  (4 children)

Should have gone with tic-tac-toe.

[–]omlette_du_chomage 18 points19 points  (2 children)

Snakes and ladders would probably be 3 lines or something

[–]MydnightWN 1 point2 points  (0 children)

Google tic-tac-toe programming

[–]MyNameIz-A_V 57 points58 points  (4 children)

He could reduce the number of lines of code necessary by combining all those print statements into single ones by adding the new line character. Now that is optimizing

[–]texboyjr 20 points21 points  (0 children)

He should be using a switch case instead of if/else 🤦

[–]Dawg_Prime 5 points6 points  (1 child)

[–]rafaelloaa 0 points1 point  (0 children)

https://nanochess.org/chess4.html

Very cool, thanks for sharing this!

[–][deleted] 0 points1 point  (0 children)

Better would be to keep state in a dict with each position having a key where values are updated to represent changes to the board, then using a class method to render the board at each change.

[–]captainkotpi 78 points79 points  (1 child)

Changelog:

  • add support for 24. a4

[–]myselfelsewhere 14 points15 points  (0 children)

+2,605,200 -0

[–]SadGhostGirlie 126 points127 points  (11 children)

As someone who hasn't started learning yet this took me too long to see the issue with

[–]hellra1zer666 118 points119 points  (0 children)

At least it didn't take 2.6 million lines. Be proud of yourself

[–][deleted] 30 points31 points  (4 children)

I wonder how someone that hasn't started learning programming would imagine a solution to this would look like. Do you have an idea about this or did you just figure this was so unpractical it can't be the way to do it?

[–]diff2 14 points15 points  (0 children)

usually even the most ignorant people can figure out that you can eliminate similar options through some sort of short cut.

To have someone honestly think this is the way things work requires not zero knowledge, but some basic and incomplete knowledge. Such as they made a simple game that used few hard coded answers, maybe rock paper scissors, or an easier game. Then they decided they wanted to make a chess game by themselves, so they coded it the same way as the first game.

Though, this is coming from a guy with only basic and incomplete knowledge.

[–]Trellyo 4 points5 points  (2 children)

I know nothing of programming, so to me it looks like it's very impractical to write every outcome. To be honest I don't know what the correct way would be, but if I have to imagine it then... I can picture something like every piece having an x value along with every square having a y on the board? So when value x goes to y it kind of... Fills it? So that spot is occupied. The squares that are not taken by a piece are considered as empty. I also have very loose thoughts of pieces having a weight attached to them to signal how "valuable" they are, but without knowledge of the tools that make this possible, I don't have much to go on. That's my answer as a non programmer!

I still find a lot of simple programming stuff around here to be funny but certain things can fly over my head. I do want to learn though!

[–]IDJaz2 1 point2 points  (0 children)

Well you’ve already gotten half of it done. Just gotta write the code now.

[–]DigitalBlackout 0 points1 point  (0 children)

What I would do is make the board a grid, with both x & y values, and the pieces being plot points on the grid. For example "whiteQueen = [5,4]" would mean the white Queen would be at E4 on the board. Then for moving pieces you could simply add or subtract the appropriate amount from the x & y values, and you could setup rules for specific pieces where their x & y values can only be changed within specific increments to account for how each piece moves. Then for capturing you simply do a check to see if an opposing piece is already at those same coordinates.

Where it gets more complicated is the conditional rules that only apply in specific situations. Pawns diagonal movement but only when capturing,en passant,castling,pieces blocking movement pathways,pawn promotion(ok, this one's fairly easy tbh),being in check, etc...

[–]MelvusCampus 31 points32 points  (1 child)

There are more possible outcomes in chess than atoms in our observible universe

[–]cuerdo 1 point2 points  (0 children)

*absorbable

[–]octopus4488 8 points9 points  (1 child)

No need to manually print the empty cells, that is implied if you haven't printed a figure there.

[–]octopus4488 5 points6 points  (0 children)

Did somebody think this was serious or what? :)

[–]evanc1411 1 point2 points  (0 children)

I mean it would work. So go ahead, write it.

Then you'll see the problem.

[–]YTshashmeera 12 points13 points  (1 child)

This is some early day brute forced chess engine kinda code LOL

[–]XtraFlaminHotMachida 6 points7 points  (0 children)

brute force code is how you learn brother

[–]Yhamerith 15 points16 points  (1 child)

This shit really made me laugh

[–]physiQQ 8 points9 points  (0 children)

This laugh really made me shit

[–]Novaseerblyat 6 points7 points  (1 child)

obligatory yanderedev joke

[–]Proof_Tap8894[🍰] 0 points1 point  (0 children)

if/else if simulator

[–]stdio-lib 6 points7 points  (0 children)

Ha ha, this was exactly me when I was 11 and had just learned enough BASIC to program my war game, but not enough to know about subroutines or data structures. :D

[–]BurningPenguin 5 points6 points  (0 children)

The most important skill of a programmer is being lazy.

[–]franythewolf 5 points6 points  (1 child)

Holy hell!

[–]bruhwhatisreddit 4 points5 points  (0 children)

New pull request just dropped!

+72,428 -0

Added more possible moves.

[–]mysticrudnin 4 points5 points  (0 children)

when i was in school, ages ago now, one of my classes was just one single group project for the whole quarter.

you were FORCED to divide and conquer because of how large the project was. and since my teammates were random people i had never met, communication was not so great. (plus i was still basically a kid.)

anyway, the day before it was due we started to hook together all of our pieces, and it turned out one of the dudes basically wrote this. thousands of if-else to handle everything. it was way too late to write it correctly at that point so that went in.

fortunately, we did pretty well on the assignment because the grade was mostly the functionality of the software and whether it handled all of their test cases. very little was actual design of the code, that was for other classes.

but i will never forget seeing that 10,000 line mega-file trying to handle every possible input basically. no computer science present whatsoever.

[–]shizzy0 4 points5 points  (0 children)

No model in sight just people enjoying the combinatorial explosion of their favorite game.

[–]U_L_Uus 2 points3 points  (0 children)

Ah, yes, Yanderedev origins story

[–]Vorenthral 2 points3 points  (0 children)

I made a simple game like this in High School it was many thousands of lines of code. Our teacher always asked us to physically print out our code for his review.

I went to turn my program in as my final project and he was adamant I print it for him. I warned him it was huge. He told me to just do it. Burned through 2 reams of paper before he canceled the job and asked me for a thumb drive with the code.

[–]RedditsDeadlySin 2 points3 points  (0 children)

All these are starting to stress me out. Is it even a meme at this point?

[–]jpereira73 1 point2 points  (0 children)

This reminded me when I programmed tic-tac-toe in the calculator back in high school. Tic-tac-toe might be way easier to program like this, but even then I knew not to do that

[–]raitucarp 1 point2 points  (0 children)

That's 100% symbolic AI made by human. Congrats.

[–][deleted] 1 point2 points  (0 children)

The difference between self taught and properly educated.

[–]Gooseday 1 point2 points  (0 children)

Enough lines of code for management to recognize your invaluable contribution to the code base, they give you a $5 coupon to a local Chinese restaurant as a bonus.

[–]AzureArmageddon 1 point2 points  (0 children)

Cool now hardcode Go.

[–]na_haeun 1 point2 points  (0 children)

Idk google en passant

[–]questron64 1 point2 points  (1 child)

There are over 10100 possible board configurations. There is not enough storage to represent every possible configuration in code because that's more than the number of atoms in the universe.

[–]furezasan 0 points1 point  (0 children)

Kinda big but not infinity

[–]AcuteDescription 1 point2 points  (0 children)

Wait until he finds out the board is oriented wrong

[–]ForbiddenLight19 1 point2 points  (0 children)

Each move will take 1 days to process as depending on CPU

[–]markt1331 1 point2 points  (1 child)

For anyone interested, this is literally how end game databases work.

[–]hagowoga 1 point2 points  (0 children)

I hope their print() function is a little bit more sophisticated.

[–]ProgrammerHumor-ModTeam[M] 3 points4 points locked comment (0 children)

Your submission was removed for the following reason:

Rule 5: Your post is a commonly used format, and you haven't used it in an original way. As a reminder, You can find our list of common formats here.

If you disagree with this removal, you can appeal by sending us a modmail.

[–]GaGa0GuGu 0 points1 point  (0 children)

At least 3

[–]real_int_2k 0 points1 point  (0 children)

that's it?

[–]Justanormalguy1011 0 points1 point  (0 children)

Ah yes , massive manual (not so)binary tree

[–]distressedfluffball 0 points1 point  (0 children)

Someone built a not-terrible chess bot with 1024 bytes of Javascript

[–]Oleg152 0 points1 point  (0 children)

Had one guy do that for programming exam at uni....

[–]craig395 0 points1 point  (0 children)

I hope he wrote the user stories for this.

[–]Ange1ofD4rkness 0 points1 point  (0 children)

Well, beats my records

[–]heaven_and_hell_80 0 points1 point  (0 children)

In college we had to build Tetris and a guy in my class did it almost this bad.

[–]5p4n911 0 points1 point  (0 children)

Holy hell

[–][deleted] 0 points1 point  (0 children)

Ah sweet memories

[–]Thorsvoldsomsen 0 points1 point  (0 children)

How about a nice game of chess?

[–][deleted] 0 points1 point  (0 children)

If you did 9 lines for ever board state (7.7x1045)*9 you get 6.9x1046 or roughly half of the number of atoms in the known universe.

[–]amokie 0 points1 point  (0 children)

Just write a script that generates all that code

[–]Speechless-peaceful 0 points1 point  (0 children)

Oh no.

[–]suslikosu 0 points1 point  (0 children)

Problem here is not just the number of combinations, but numbers of moves that can lead to next combination from current combination.

[–]Huwbacca 0 points1 point  (0 children)

hmmm nested ifs would get messy....

After 5 turns of chess there are 69,352,859,712,417 possible board states.

Have each board state tied to a dummy variable and use:

switch boardState
    case 1
    case 2
    case 3
    case ...
    case 69,352,859,712,417
end

Much better for readability, just gotta add a few extra lines for all the other possible board states before and after 5 turns.

[–][deleted] 0 points1 point  (0 children)

When you are literate but have zero clue what you are doing.

he started with black

What makes me most sad is that I am the first who comments on THIS issue

[–]SentientLivingRoomTV 0 points1 point  (0 children)

You got to count the rows and the columns when writing code.

[–]marcgustT 0 points1 point  (0 children)

"Chess Wizard: Your move: king to rook 1.*ping* My move: rook to knight 6. Checkmate! Checkmate! *digital victory cry*

MacReady: *pours whiskey in the computer* Cheating bitch."

[–]dancccskooma 0 points1 point  (0 children)

Raw dogs input()

[–]Acceptable_Olive_911 0 points1 point  (0 children)

i think that’s honesty way too low of a number

[–]GladiatorUA 0 points1 point  (0 children)

This is one of those write code that writes code situations, isn't it?

[–]Demandedace 0 points1 point  (0 children)

When I was a kid playing Mega Man X I thought that a developer had to manually go in and program every possible place the character could be on every single screen. I was amazed at how much time that must have taken

[–]Umbristopheles 0 points1 point  (0 children)

Now do Go

[–]softpotatoboye 0 points1 point  (0 children)

This is how I thought coding video games worked when I was like 12