3.0k
Apr 10 '23
I see you get paid per hour
1.1k
6
→ More replies (1)5
8.3k
Apr 10 '23
r/anarchychess truly is leaking everywhere
2.0k
u/rtakehara Apr 10 '23
the "anarchy" part makes it hard to contain
→ More replies (3)628
u/Grumplogic Apr 10 '23
Wouldn't anarchy Chess just be Chess without the King and Queen?
→ More replies (52)207
46
33
11
u/FlyingCashewDog Apr 10 '23
lmao I thought we were on anarchychess, didn't check the sub name but it fits here too
EDIT: I mean holy hell
11
8
21
6
u/Vongola___Decimo Apr 10 '23
I have literally seen anarchy chess meme References on so many different subs that have literally nothing to do with chess
4
→ More replies (14)4
5.1k
u/CozyTheTeddyBear Apr 10 '23
Are you YandereDev by any chance?
1.8k
171
Apr 10 '23
I don’t know shit about that guy so can you explain what he did?
437
→ More replies (4)166
u/MostlySoberBro Apr 10 '23
The source code for Yandere Simulator was leaked, and certain gems like this can be found in this sub and around the internet
→ More replies (64)68
u/SomeGuy6858 Apr 10 '23
Cum chalice moment
33
u/TumblrInGarbage Apr 10 '23
I wonder what the world record for getting banned in his Discord is down to now.
→ More replies (2)8
u/bumpkinspicefatte Apr 10 '23
‘You guys don’t get it, I have the power of Unity Profiler on my side!’
→ More replies (2)→ More replies (10)12
11.2k
u/Adityamk Apr 10 '23
Oh my fucking god...
3.4k
1.1k
u/Lucky-Citron-8269 Apr 10 '23
If this is really the route that you want to go, then I think this is one of the cases were it’s easier to write code that will write the code for you.
→ More replies (9)680
u/powerman228 Apr 10 '23
Good luck storing and compiling all that…aren’t there more possible games of chess than stars in the universe or something?
→ More replies (142)358
u/CoffeeDust_exe Apr 10 '23
2 down, 10120 to go
185
u/bjandrus Apr 10 '23
Yeah I don't think we're delivering chess this sprint, or the next one, or the next one...
→ More replies (13)→ More replies (2)24
113
u/ProbablyGayingOnYou Apr 10 '23
...
case 7263849503928374637284637584938273650302:
...
Better break out the energy drinks, this could be an all-nighter...
→ More replies (3)28
48
→ More replies (35)18
1.3k
u/C10ckwork Apr 10 '23
Most sane high school python student:
→ More replies (8)712
u/OMGItsCheezWTF Apr 10 '23
When I was at college in the 90s one person in my tutor group didn't quite "get it"
We were supposed to be building a CLI calculator for DOS using Borland turbo C++.
Most of us finished pretty quickly and spent time refining it, and then one guy got a weird error about his program executable exceeding 500kb that he didn't understand.
So I offered to help him and it was essentially this. Every possible combination of inputs accounted for, using variables for values at least but if you entered an addition and a multiplication it would use a code path different to an addition followed by an addition etc.
His codebase was enormous. Thousands of lines long, much of it copy pasted, unimaginably hard to maintain or make changes to, the whole thing driven by an enormous if / else
If you entered a combination of commands it wasn't coded to handle it would just explode.
He didn't last the first year
→ More replies (13)175
3.6k
u/BestNick118 Apr 10 '23 edited Apr 10 '23
did you code en passant
938
46
157
u/Lagger625 Apr 10 '23
I'd rather get a brick to the pipi than coding this shit
→ More replies (4)124
u/KrozJr_UK Apr 10 '23
Are you kidding ??? What the **** are you talking about man ? You are a biggest looser i ever seen in my life ! You was doing PIPI in your pampers when i was beating players much more stronger then you! You are not proffesional, because proffesionals knew how to lose and congratulate opponents, you are like a girl crying after i beat you! Be brave, be honest to yourself and stop this trush talkings!!! Everybody know that i am very good blitz player, i can win anyone in the world in single game! And "w"esley "s"o is nobody for me, just a player who are crying every single time when loosing, ( remember what you say about Firouzja ) !!! Stop playing with my name, i deserve to have a good name during whole my chess carrier, I am Officially inviting you to OTB blitz match with the Prize fund! Both of us will invest 5000$ and winner takes it all! I suggest all other people who's intrested in this situation, just take a look at my results in 2016 and 2017 Blitz World championships, and that should be enough... No need to listen for every crying babe, Tigran Petrosyan is always play Fair ! And if someone will continue Officially talk about me like that, we will meet in Court! God bless with true! True will never die ! Liers will kicked off...
→ More replies (3)54
u/davididp Apr 10 '23
It causes me so much pain when coding chess engines. However I know I will be crucified in r/AnarchyChess if I don’t have it
→ More replies (1)169
u/GuevaraTheComunist Apr 10 '23
I always forget if that is real thing or just some random move guys from r/AnarchyChess made up
191
→ More replies (8)33
→ More replies (3)28
u/Taclis Apr 10 '23
Deep Blue even had problems accounting for en passant when it beat Kasparov. They had to fix last minute bugs retaining to it between matches.
33
u/Xatraxalian Apr 10 '23
And then you realize that Deep Blue would now be shoveled under the rug and danced upon by a current-day phone running Stockfish. LOL.
→ More replies (2)
243
u/Mua3d Apr 10 '23
Why is my chess game taking 100GB space
→ More replies (3)90
u/Oraion18 Apr 10 '23
That's gonna take entire space available on the earth and still won't run.
22
u/SHOTbyGUN Apr 10 '23
You can optimize the code to not include all edge cases.
UnhandledMoveException("Please program your current move") click here to open live debug window.
→ More replies (1)11
u/DorfPoster Apr 10 '23
There aren't enough atoms in the universe to store all the board states
→ More replies (1)
1.1k
Apr 10 '23
Oh, YandereChess.
0
Apr 10 '23
[deleted]
700
u/Teegeetoger Apr 10 '23
Yandere sim game had source code leaked? not sure what happened. What people found out is that the game is basically all if/else nested spaghetti which resulted in massive tech debt.
→ More replies (65)64
u/KKLC547 Apr 10 '23 edited Apr 10 '23
yanderedev uses so much else if statements and his code also has terrible job of managing resources on his game called yandere simulator. You can try the game itself and see how bad is the slowness
→ More replies (8)→ More replies (6)40
u/Alissah Apr 10 '23
Basically he uses gigantic if/else statements, just like chains of 20+... seems like hes allergic to switch statements, lol. Everyone made fun of him (as they should) when the source code got leaked.
→ More replies (6)
204
u/mynewaccountagainaga Apr 10 '23
Fun fact: if you coded it this way with every possible board state hard coded in then you would run out of memory.
"But what if I had all of google's storage available to me??"
You would run out of memory. If you had every single storage device that humans have ever created in your possession, you would run out of memory.
There are more than a googol unique board states in chess.
If you could record a board state on an individual atom and use every atom in the universe as your memory, you would run out of memory.
→ More replies (15)109
1.1k
u/Cwmagain Apr 10 '23
How big would a program be with , how much is it again, 10^40 of those else if loops?
1.0k
u/BestNick118 Apr 10 '23
The number of distinct chess positions after White’s first move is 20 (16 pawn moves and 4 knight moves). There are 400 distinct chess positions after two moves (first move for White, followed by first move for Black). There are 5,362 distinct chess positions or 8,902 total positions after three moves (White’s second move). There are 71,852 distinct chess positions or 197,742 total positions after four moves (two moves for White and two moves for Black). There are 809,896 distinct positions or 4, 897,256 total positions after 5 moves. There are 9,132,484 distinct positions or 120,921,506 total positions after 6 moves (three moves for White and three moves for Black). The total number of chess positions after 7 moves is 3,284,294,545. The total number of chess positions is about 2x10 to the 46 power, so pretty long
958
→ More replies (30)10
27
u/Avamaco Apr 10 '23
You can reduce it to like 100 if you only register moves that are not throws. In any other case the program can just print out "That's a stupid move. You lost, you dumb idiot."
/s
→ More replies (1)→ More replies (3)9
u/T-T-N Apr 10 '23
You only need to account for white moves. I assume black will have a fix response
289
u/smrtfxelc Apr 10 '23
Jesus christ. I'm right in thinking there are 10some big fucking number moves in chess, aren't I?
→ More replies (4)189
u/JonIsPatented Apr 10 '23
2 × 1046 possible board states, yes.
→ More replies (11)158
u/pappapirate Apr 10 '23
if you're coding it this way you would have to code every possible sequence of moves that result in each position, not just the positions.
→ More replies (28)
120
u/CanICanTheCanCan Apr 10 '23
When I was in elementary school I thought that every video game frame was edited by hand and I tried to figure out how they knew how to go from frame to frame.
31
12
u/lebron_girth Apr 10 '23
That level of curiosity is still really impressive for an elementary school kid
15
u/CanICanTheCanCan Apr 10 '23
Tried to make a mario game in Powerpoint. Got exhausted after about 25 frames! Still, it got me into actual coding which has been my passion ever sense.
→ More replies (2)
198
u/4chananonuser Apr 10 '23
Rip. Queens are misplaced
114
Apr 10 '23
Nah it's okay they are trans.
→ More replies (2)92
u/Tzeme Apr 10 '23
Chess is the oldest trans supporting game, any soldier can become a queen or a knight! Or even a tower (for enby representation)
→ More replies (10)→ More replies (8)6
u/LUV_2_BEAT_MY_MEAT Apr 10 '23
Board is turned 90 degrees too. Bottom right would not be white
→ More replies (3)
108
42
38
29
26
u/Laxwarrior1120 Apr 10 '23
Forcing someone to code like this would constitute a war crime.
→ More replies (1)
50
u/Sexy_McSexypants Apr 10 '23
hardcoding every game of chess… sure love to see the file size
→ More replies (6)9
u/jbrains Apr 10 '23
Well, the endgame table bases are in the single digit of TB, and that's just data in a reasonably compact notation....
39
u/JonIsPatented Apr 10 '23
There are 2 × 1046 possible board states. If they each are coded with their own 8 × 8 board of unicode characters, and each of those characters is 2 bytes, that's 8 × 8 × 2 × 2 × 1046 bytes of information to be stored in that program just to hold the characters to draw the possible board states. That's 256 × 1046 bytes, or 2.441406 × 1042 megabytes, or 2.3841855 × 1039 gigabytes. We're looking at over 2.2204 × 1030 exabytes. That's over 2.2204 NONILLION, which is like 2 million trillion trillion EXABYTES. In yottabytes, that's 2.1175 × 1024. That's over 2 septillion, or 2 trillion trillion, yottabytes. The entire internet contains only around 5 exabytes of data. A single yottabyte is 200,000 times that much, and this guy's chess game needs to be over 2 septillion times larger still than that.
→ More replies (4)14
Apr 10 '23
Chess configurations =! How many of statements you will need. You would need many magnitudes more if statements because every configuration would have a dozen or so moves
→ More replies (2)
71
16
12
11
u/StarkillerX42 Apr 10 '23
There's nothing wrong with your code, have you tried using a computer larger than the observable universe?
9
15
u/luenix Apr 10 '23
Board isn't set up correctly. Queens should be opposite ends of the same file :)
6
u/mikeyj777 Apr 10 '23 edited Apr 11 '23
From the responses, I'm imagining there's an easier way
Edit: Just stating the obvious that I was joking. Given the responses, it may not have come across.
14
→ More replies (3)7
u/Alevo Apr 10 '23 edited Apr 10 '23
When I made a chess game in uni I used mostly maths to decide where the pieces could move.
King: difference in x + difference in y = 1 or 2 Knight: sqrt(difference in x)2 + sqrt(difference in y)2 = 3
Etc.
6
u/patiofurnature Apr 10 '23
Project manager: How's your progress on the chess app?
Programmer: Great! It's working perfectly for the first move; just need to adjust the algorithm to support continuous play.
5
6
u/ejuliol Apr 10 '23
Huh. This is awesome (in its own way). I wonder if you can make a program to code all the posible moves to make it “playable”. Chess is out of question with so many moves. But let’s say: checkers.
6
u/realmuffinman Apr 10 '23
Chess is indeed out of the question (as someone else pointed out, the file size would be several septillion times the size of the entire internet's data). Checkers would also have this complexity issue.
It would be possible to do this for a far simpler game, such as tic-tac-toe or rock-paper-scissors, as there are fewer board states.
→ More replies (1)
5
5
4
u/urbanhawk1 Apr 10 '23
I did that exact same thing on my graphing calculator back in high school except I made pong instead of chess. It was a nightmare to build but I had no idea how to make actual graphics at the time. Managed to finish it too.
4
u/-non-existance- Apr 10 '23
Oh boy I can't wait to see the rest of the 10112 or so lines of this project!
4
4
4
8
u/thesuperzapper Apr 10 '23 edited Apr 10 '23
I asked GPT-4 to make a basic chess program, it says that this won't handle castling, en passant, or detecting check/checkmate.
class ChessBoard:
def __init__(self):
self.board = [
["♜", "♞", "♝", "♛", "♚", "♝", "♞", "♜"],
["♟"] * 8,
[""] * 8,
[""] * 8,
[""] * 8,
[""] * 8,
["♙"] * 8,
["♖", "♘", "♗", "♕", "♔", "♗", "♘", "♖"],
]
def __str__(self):
rows = []
for i, row in enumerate(reversed(self.board)):
row_str = []
for j, cell in enumerate(row):
if cell == "":
cell = "□" if (i + j) % 2 == 0 else "■"
row_str.append(cell)
rows.append(" ".join(row_str))
board_str = "\n".join(rows)
return f" a b c d e f g h\n{board_str}"
def move_piece(self, start, end):
sx, sy = start
ex, ey = end
piece = self.board[sy][sx]
self.board[sy][sx] = ""
self.board[ey][ex] = piece
def is_valid_move(self, start, end):
sx, sy = start
ex, ey = end
piece = self.board[sy][sx]
if piece == "":
return False
if self.board[ey][ex] != "" and self.is_same_color(start, end):
return False
if piece in "♟♙":
return self.is_valid_pawn_move(start, end)
elif piece in "♜♖":
return self.is_valid_rook_move(start, end)
elif piece in "♞♘":
return self.is_valid_knight_move(start, end)
elif piece in "♝♗":
return self.is_valid_bishop_move(start, end)
elif piece in "♛♕":
return self.is_valid_queen_move(start, end)
elif piece in "♚♔":
return self.is_valid_king_move(start, end)
return False
def is_same_color(self, start, end):
sx, sy = start
ex, ey = end
return self.board[sy][sx].isupper() == self.board[ey][ex].isupper()
def is_valid_pawn_move(self, start, end):
sx, sy = start
ex, ey = end
dy = ey - sy
dx = abs(ex - sx)
if self.board[sy][sx].isupper():
dy *= -1
if dx == 0 and dy == 1 and self.board[ey][ex] == "":
return True
if dx == 1 and dy == 1 and self.board[ey][ex] != "" and not self.is_same_color(start, end):
return True
if dy == 2 and sy == 1 and self.board[ey][ex] == "" and self.board[sy + 1][sx] == "":
return True
if dy == -2 and sy == 6 and self.board[ey][ex] == "" and self.board[sy - 1][sx] == "":
return True
return False
def is_valid_rook_move(self, start, end):
sx, sy = start
ex, ey = end
if sx != ex and sy != ey:
return False
step_x = 0 if sx == ex else 1 if sx < ex else -1
step_y = 0 if sy == ey else 1 if sy < ey else -1
y, x = sy + step_y, sx + step_x
while y != ey or x != ex:
if self.board[y][x] != "":
return False
y += step_y
x += step_x
return True
def is_valid_knight_move(self, start, end):
sx, sy = start
ex, ey = end
dx, dy = abs(ex - sx), abs(ey - sy)
return (dx == 1 and dy == 2) or (dx == 2 and dy == 1)
def is_valid_bishop_move(self, start, end):
sx, sy = start
ex, ey = end
dx, dy = abs(ex - sx), abs(ey - sy)
if dx != dy:
return False
step_x = 1 if sx < ex else -1
step_y = 1 if sy < ey else -1
y, x = sy + step_y, sx + step_x
while y != ey and x != ex:
if self.board[y][x] != "":
return False
y += step_y
x += step_x
return True
def is_valid_queen_move(self, start, end):
return self.is_valid_rook_move(start, end) or self.is_valid_bishop_move(start, end)
def is_valid_king_move(self, start, end):
sx, sy = start
ex, ey = end
dx, dy = abs(ex - sx), abs(ey - sy)
return dx <= 1 and dy <= 1
def parse_move(move_str):
if len(move_str) != 4 or not move_str.isalnum():
raise ValueError("Invalid input")
start, end = move_str[:2], move_str[2:]
sx, sy = ord(start[0]) - ord("a"), int(start[1]) - 1
ex, ey = ord(end[0]) - ord("a"), int(end[1]) - 1
if not (0 <= sx < 8 and 0 <= sy < 8 and 0 <= ex < 8 and 0 <= ey < 8):
raise ValueError("Coordinates out of range")
return (sx, sy), (ex, ey)
def main():
board = ChessBoard()
player_turn = "White"
while True:
print(board)
print(f"{player_turn} to move")
move = input("Enter your move (e.g. e2e4): ")
try:
start, end = parse_move(move)
if board.is_valid_move(start, end):
board.move_piece(start, end)
player_turn = "Black" if player_turn == "White" else "White"
else:
print("Invalid move")
except ValueError as e:
print(e)
if __name__ == "__main__":
main()EDIT: apparently old reddit is borked for multi-line code formatting, so I had to extra-indent every like by 4 spaces.
→ More replies (4)
3
u/gtc26 Apr 10 '23
As a programmer, I feel your pain
6
u/gtc26 Apr 10 '23
Update: I specified programmer because I thought I was still on the AnarchyChess subreddit. My bad
→ More replies (1)
3
3
u/MrCubie Apr 10 '23
The board is wrong. Queens are supposed to face each other (or kings). Rest looks good to me
→ More replies (1)
3
u/Visual-Ad-6708 Apr 10 '23
I don't get a lot of these programming memes since I'm a beginner and now y'all are using chess. I'm too dumb for these memes😢
→ More replies (2)
3
u/Educational-Lemon640 Apr 10 '23
I, too, like creating programs that end up larger than the known universe if printed at human-readable scales.
3
3
u/Muritavo Apr 10 '23
lol, when I was little, I thought that when a game crashed, that frame wasn't possible because that frame wasn't drawn by the devs...
This sums up how I thought a game was developed
I was not a smart kid
3
3
3
3
2
2
2
u/Dismal-Square-613 Apr 10 '23 edited Apr 10 '23
ChatGPT "show me the most inefficient way to represent a chessboard and a tree of possibilities for each move in python".
2
2
2
u/RegularOps Apr 10 '23
When I was a child I honestly thought this was how video games were made.
Like the video game makers had to produce a screenshot of every possible outcome or situation.
2
u/juvees Apr 10 '23
This is how I programed tic-tac-toe after I missed the class in which we were taught how to
2
2
u/lonelyWalkAlone Apr 10 '23
There are more possible variations of chess games than there are atoms in the observable universe.
Good luck printing 10¹²³ moves.
2
2
u/NameLips Apr 10 '23
Just one picture for every possible piece layout in the game. What's so hard about that?
2
2
2
2
Apr 10 '23
World's largest computer program with 10x21⁶ lines of code and all it does is print chess layouts. Absolutely beautiful.
2
2
u/Unicorn_A_theist Apr 10 '23
We had to code tic-tac-toe in MIPS and my group did something like this for the computer logic. Except in this case it would be impossible to make all the possible combinations.
2
2
2
2
u/easilyconfusedwhat Apr 10 '23
Only about 10 to the power of 40 possible combinations to output. Yes, I think I’ll hard code each one. Much easier than formulating a complicated algorithm.
2
2
u/ZenBacle Apr 10 '23
When you're payed by the line, everything becomes an else if switch case printout.
2
Apr 10 '23
Out of curiosity, what would be the approach to code a game like chess? (I‘ve got very, very limited experience in coding)
2
2
u/jasper_grunion Apr 10 '23
You just need a dictionary with the locations of all 32 pieces. It is initialized to the starting board state. Each move updates the dictionary. When a piece is taken it’s position becomes null and the piece is no longer drawn. Then you have a single function or method called drawBoard() that takes the position dict as input. I could see another method called resolveMove that determines when a piece has been taken and updates the dictionary. The hard part about real life chess programming is the AI that drives the computer opponent.
2
2
u/Coasterman345 Apr 10 '23
This is how I thought code was written when I was a kid. Like for RCT I thought the devs had pre made what the map would look like for every single possibility 🤦♂️
2
2
2
u/SacriGrape Apr 10 '23
Ignoring file size, would this be faster or slower than just calculating it
→ More replies (1)
2
2
2
2
2
2
Apr 10 '23
Lol it would be interesting to see how well a chess game coded like this would run...
→ More replies (3)
2
2
2
2
2
u/Table_Coaster Apr 10 '23
this is actually a really good way to code a game of chess for me, because as soon as i see 1. d4 i resign
2
u/DasArchitect Apr 10 '23
Man, this is going to be an absolute mess in no time.
You have to clear the screen between each board print.
2
2
2
Apr 10 '23
This reminds me my friend from intro to programming course in college. We were supposed to make some kind of labyrinth solver with if statements and loops, the guy literally wrote lines of code for every possible example case instead of defining functions etc.
2
Apr 10 '23
When your ADHD is so bad you have to write a chess program after learning about unicode text and if conditions. Like, dude, at least let us cover loops first.
2
2
2
2
2
2
u/wooof359 Apr 10 '23
When I was a kid I thought that 2d SNES games were just animated every possible position. And then when like N64/PS1 games came out my mind was blown thinking they had to draw every possible angle in 3d....
2
2
2
2
u/hotairballonfreak Apr 10 '23
Because each one of those character strings should not be hardcoded. They should be lookup function calls so if you change the character in your ico files it will auto update the character images.
2
u/MediumAd3135 Apr 11 '23
You need to learn backtracking that's why you're hardcoding all the values
2
2
2
u/flyingmonkey111 Apr 11 '23
LOL... We use that as an interview question 😁 Describe how you would code a chess game... OK, checkers? A coin toss game? ... Thanks for your time

4.4k
u/MaxMakesGames Apr 10 '23
While you're at it, you can make an amazing AI by coding the best reaction move for each player move !