6 ms·
"To win, you simply need to capture the opponent's king. This is mainly because stalemate is basically impossible, as the king can always move an infintesimal a
by andrewfromx 4y ago
"To win, you simply need to capture the opponent's king. This is mainly because stalemate is basically impossible, as the king can always move an infintesimal amount, and also because implementing check/checkmate would destroy the last ounce of sanity I have left."
- timerol 4y ago"Warning: This code is fucking awful. Do not expect the code to be stable under any modifications, but you can try if you want I guess. Also there are barely any comments sorry. I am in Electrical Engineering and I like writing shitty code to piss off my Computer Science friends." I appreciate this README's sense of humor
- remram 4y agoThe fact that he released it is awesome. So many people never released their code because "it's not ready" or "I want to clean it up" or whatever. Fucking awful barely-functioning open source code is better than no code available, every time.
- bunnie 4y agoI can relate to this!
- knodi123 4y agolol, "Run the .py file with the highest number, because I can't figure out version control." Says the guy who posted it to github.
- felixworks 4y agoGitHub becoming Pastebin would be a hilarious turn of events.
- Kamq 4y agoIt's kinda close already. I've gotten several pdfs of books by cloning repos.
- _Algernon_ 4y agoYou can upload files to github with drag and drop. They are not mutually exclusive.
- tluyben2 4y agoMy father (quantum mechanics) would sometimes submit awful but working code to Dijkstra without proofs just to piss him off. Dijkstra didn't like the looseness of the physics students when it came to software development, while physics students didn't like the software proofs for things in physics that were experimental and needed a 'quick' (nothing was 'quick' then compared to now of course) set of calculations/simulations and not waste time on writing formal proofs for them.
- bertil 4y agoThere’s something profound here about how the very natural conventions in Chess (“If you did that, you’d lose, so I’d rather we continue playing”) have redefined “valid” in a way that is surprisingly hard to re-implement with code.
- cmeacham98 4y agoIt is very easy to implement with code. Chess computers are some of the first well-known computer programs (see, for example, Deep Blue). What is difficult is adapting chess's rules to this analog environment. It would be similarly difficult if you played this way with a real chess set in the real world, has nothing to do with code.
- ummonk 4y agoYou don't actually have infinitely many moves available in analog chess since you can only click on a pixel. But while check should be doable in reasonable time, checkmate / stalemate would be expensive to compute since you have to check every possible move of yours (not just with the king, but with other pieces that could interpose as well) and then check every possible opponent's move in response to each of your moves to see if the king will be in check in the resulting positions.
- cmeacham98 4y agoYou'll find that with some applied math you do not need to check every single possible move of the King.
- ummonk 4y agoPlease elaborate.
- AstixAndBelix 4y agoyou can’t represent the real plane on a computer. you can only have a limited amount of precision that effectively results in very dense grid, but a grid nonetheless
- logicallee 4y agoIn chess, you win when you are "about to" capture the opponent's king on your next move, which is called putting them in check, and there's no way for the other side to avoid it (block or move out of check). So I've always found it very bizarre that if it's a player's move, but any possible move would put their own king in check, then it is a draw (rather than a loss). This leads to a situation where one side can have almost no pieces left, perhaps only the king, but still somehow draw since the king can't move anywhere where it wouldn't be captured. I imagine a king all by himself peeping his head out out for a place to move, but everywhere is covered by snipers, so, since he can't move anywhere without getting captured, despite being overwhelmed by enemy forces he yells out a la monte Python "So we'll call it a draw then!"
- hgsgm 4y agoIt's because chess was invented by programmers, and stalemate means "the game is broken because there are no legal moves so it's impossible to continue", so we call it a draw.
- a_cardboard_box 4y agoYou can also tell it's made by programmers because of the en passant "feature", which clearly only exists due to the programmers' incomplete implementation of the 2-square first move.
- barakm 4y agoYour post and air quotes for “feature” are hella snide. In chess code, en passant is an edge case that takes a lot of code to cover, and not just some bug due to incompleteness. Check yourself before you wreck yourself. And yes, check pun intended.
- pbhjpbhj 4y agoMaybe if you think of it in terms of the opposition falling to put you in check despite you only having a king left? Your army chased the opposing king to the forest but failed to defeat him, be gets to live out his days as a hermit. You are denied 'satisfaction'. ? In my family, against my children, it's a running joke that I'll almost always fail to win, and stalemate them.
- bspammer 4y ago> the king can always move an infintesimal amount I don't think this is true, it should be perfectly possible to cover the opponent's king's entire movement area with your pieces. I'd love to see a version of this game that actually implements this :D
- gmoot 4y agoThen it's checkmate, not stalemate. For a stalemate you need a situation where the king is not in check, but there are no legal moves. It seems impossible in practice, if not in theory.
- Someone 4y agoYou can have stalemate with two rooks or two bishops enclosing a square just large enough to contain the king. A queen and a rook or bishop also can enclose a triangular area that is just large enough to contain the king. (Talking of bishops: should this game require bishops to stay on squares of their starting colour?)
- mythas 4y agoHow close to the king are they covering? .0000001 units? The king can move .00000009 units. You can always make a smaller real number.
- deleted 4y ago[deleted]
- NineStarPoint 4y agoIn theory yes. In practice, python uses floating point numbers for decimals so there is actually a minimum possible move and a finite number of allowed decimals.
- ehulinsky 4y agoAlso the game only has a resolution of 640x640 pixels, and you cant move the mouse a half pixel. But anyways, stalemate basically requires very precise positioning by the attacker, so it is VERY unlikely to actually happen, especially since they are trying to avoid stalemate.
- masswerk 4y agoChess meets Tablut / Hnefatafl… (I guess, Vikings would appreciate the constraints arising from infinitesimal granularity movement.)