Analog Chess
github.com
github.com
> 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.
Doesn't the legend have it that he scribbled a lot of his ideas down hastily the day he though he was going to die?
When having two pawns adjacent one of them can still defend the other by having it only slightly behind. They can also alternate defending each other with a single move. Pawns can also attack/defend things directly in front of them by pushing up against them. These things combined mean that it's almost impossible to have any pawn weaknesses, other than having a singled out pawn with no neighbors. In general pawns are the most improved piece with this ruleset.
The ability to move directly forward makes knights significantly stronger. Knights ability to move through other pieces is also particularly strong versus pawns which can now block most pieces from moving around quite easily.
Since pawns generally mainly move along one axis, it is easier to control the distance between pieces in the forward-backward axis than in the left-right axis. This makes it harder to utilise Rooks to capture two adjacent pieces. Bishops on the other hand have an easier time capturing two adjacent pieces, if positioned correctly. I'm not sure this compensates for the fact that bishops now have a much harder time penetrating positions, they are the most easily blocked of all the pieces.
Overall it is very interesting as a chess variant, it plays so very different from chess. It's hard to even figure out reasonable openers.
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
Fucking awful barely-functioning open source code is better than no code available, every time.
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!"
Check yourself before you wreck yourself. And yes, check pun intended.
?
In my family, against my children, it's a running joke that I'll almost always fail to win, and stalemate them.
Note that it can be discovered during a game that a move several turns ago was actually illegal, and the board should be returned to that position (and times adjusted). I had this happen to me once.
Additionally, there are many contradictory rules that can't all be applied, so there is a lot of room for the tournament director to apply the rules according to the spirit of the game rather than the word of the law.
https://www.chessgames.com/perl/chessgame?gid=2024861.
White castled short on move 10 and long on move 33. That didn’t help, though. White lost the game.
Also, it seems that site’s software doesn’t allow entering the full game.
Resolving irregularities does require your opponent to notice the irregularity and bring it to the attention of the referee.
Not sure about Blitz.
When I was in school, we used to play blitz like that. You lost track of your king, boom, you're dead
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.
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
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?)
Given how captured work and how you'd probably define "on a square" with white a bit of freedom (perhaps the center of the piece has to be within the square?) I doubt it'd matter much either way.
(I guess, Vikings would appreciate the constraints arising from infinitesimal granularity movement.)
I made a post to this effect: https://news.ycombinator.com/item?id=34377233
For example, "Not Tetris" is an analog-Tetris. https://stabyourself.net/nottetris2/
I certainly enjoy these games. So hopefully more people are inspired to find analog-versions of other discrete or turn-based games, lol.
I guess a more "serious" version of analog Tetris is perhaps Tricky Towers, which is an excellent party game. https://www.trickytowers.com/
They probably meant to play golf in some kind of grid system and using only a few different strengths and angles.
But interestingly, most complex games have some kind of mixture of both: basket ball having discrete points, but fouls are remedied with a free shot on a continuous plane.
Ice hockey, on the other hand, has only a discrete set of places where the game can continue after a foul.
"To run the code you will need to install Python and the PyGame library, and then run the latest .py file because I can't be bothered to actually use version control."
"I am in Electrical Engineering and I like writing shitty code to piss off my Computer Science friends." -- https://github.com/ehulinsky/AnalogChess/blob/main/README.md...
Or just clone the same repo multiple times, or have some releases unpacked outside of version control.
Can you run two or more versions and compare their behaviour simultaneously, even debug them side-by-side? I'm sure there's some sort of plugin and IDE ecosystem that you can spend tons of time learning how to configure just to be able to do that, but if all I need to do is to copy the files and rename them, why not?
Do some people really love excess complexity so much?
I would say that this is a bit of an exception though. Most projects are spread across many files and dependencies, so it would be a huge mess trying to manually version those by renaming files all the time. I also rarely want to compare several different versions of my code side by side, so I prefer having all of the old stuff 'hidden away' in git by default.
That's cool. I like using 24 gauge wire for everything to piss off my EE friends.
> One interesting side effect of this is that you can capture multiple pieces at once. :)
Wouldn't it make more sense if it moved until it touched another piece and thus capture it without overlapping?
/r/anarchychess will hate this
Also, knights jump, so for them you definitely need the rules as stated.
This also makes sense when you put any given piece in the middle of an empty board and plot all of its potential moves— for every piece but the knight, "joining up" their possible landing sites gives continuous distances from the starting point, but if you join up a knight's landing sites, you get a circle of r=√5.
So in short, I agree with the OP's decision on how to handle knights.
holy hell.
But sadly I don't think I'm up for it: Do not expect the code to be stable under any modifications, but you can try if you want I guess.
I swear he thought I was cheating. I had to explain the term and have him Google it.
Plus the general topic of how to use clocks.
Chess is so popular that most people first learn to play from parents, relatives, etc., so they might not have learned the full rules if they aren't interested in learning the game more seriously.
I always use an upside down rook, somehow there's always one available by then.
I've taken to asking players who are unfamiliar with the game if their familiar with it on occasion, at least ones who I expect will be more frustrated than amused.
Reading about Lloyd Shapley (2nd in Game Theory after von Neumann) I discovered that he was supposed to be master at:
https://en.wikipedia.org/wiki/Kriegspiel_(chess)
Basically chess with Fog of War.
Both chess.com and lichess allow you to view attacks in the analysis, but I don't think it should be available in-game. Low-level or casual play in any setting is going to be characterized by blunders, that's what makes it low-level and casual.
For me, I'm quite confident it would negatively impact my skills as I would naturally start trying to offload that mental load to the computer and forget how to do it.
I bet it's possible to use the same approach as chess engines for traditional chess. You might run into problems with the search space being a tiny bit larger, though.
Just "enlarge" the Pawn whenever it moves more than 1 square.
Ex: if the pawn moves 2 squares, it is now a 2x1 piece. It will return to size 1x1 after its next move. If you wanna be "only" Pawns participating, ensure that the enlarged region can only be affected by other pawns.
Ex2: If the pawn moves 1.5 squares, it is now a 1.5x1 piece.
It shouldn't be too hard to have Pawns only be able to capture in this manner. And if you wanted to "reset the size" at the beginning of each player's turn. (Ex: White's pawns reset from 1.5x1 size into 1x1 size at the start of White's turn), then that basically covers en-passant.
The rule only punishes players that use the 2-square move to "block" an advancing pawn. This is a very specific situation!
I think you need to study En Passant a bit more. E2 to E4 is _not_ captured by the E5 black pawn, but instead by the D4 or F4 black pawn.
The E-black pawn is meaningless in regards to the En Passant rule. All that matters is that E2 (original location of white pawn) "passes through E3" on its way to E4, so F4 and D4 black pawns have an opportunity to kill it.
So you have two regions. The 1x1 region of the pawn, and the 1.5 x 1 "en passant" region of a pawn that moved 1.5 squares as its first thrust. The 1.5x1 region can only be targetted by enemy pawns. If an enemy bishop lands in the 1.5x1 region, it still needs to check if its the 1x1 "original pawn" region to have the pawn captured.
Also, to the extent there is a benefit, does the full set of floating points (presumably) get more advantage than just the positions located midway between regular adjacent positions? And how big an advantage does it offer? Could someone with access to the floats beat someone ranked 500 points higher who doesn't?
A more interesting question is how do you search the infinite state space. Intuitively, many states that are formally different aren't meaningfully different from each other and can be assimilated.
Any bisimulation expert on HN? :D
one of my late mentors, dr mick bazin (university of london, 1980s), used to demonstrate programming bacterial population dynamics on an analog machine - plug-boards, dials and god knows what. as a pretty good digital computing person, i found it all baffling.
but nowt to do with the post, i guess.
From Yorkshire or a typo?
> that would be impressive
:(
This has interesting implications when you start to consider pieces that could move all the way to infinity, such as a rook. Would a rook that is the first to move to infinity be able to consume any other piece that also goes out to infinity by moving horizontally or vertically? So do you have to specify that you are only moving a piece within a certain amount of squares from infinity, to not be placed in a vulnerable spot?
but I am perplexed by the assertion that confirming or checking-for `check` (as opposed to mate) is difficult.
Why is it not simply checking the attack surface of each piece from its current position? I understand there is occlusion, but that should be well-defined for collision-checking for taking already.
I.e. is this not the rule: "if none of the opposing 16 positions has the king's [prospective] position in their range of attack, the position is clear." Where range-of-attack are already defined.
If there is a problem with determining if a given range is subset by occlusion, that would seem to make preclude determining capture?
I must be missing something...
* again, straightforward if you have experience with computer rendering, CV, or similar domains, but less so in other domains.
Knight is the easiest, that's just checking (lol) the distance to see if 5-r/2 <= d < 5+r/2.
That's ... straighforward enough, I think? En passant exists because it feels unfair that a pawn could use its double-move (here, >1.0 move) to bypass another pawn's capture.
So, in analog chess, the en passant rule would be "if a pawn move of >1.0 passes through the capture zone of the other side's pawn, that pawn retains the right to capture (on the next move) as if it (the former pawn) had moved to a point within the capture zone".
Still don't see why analog chess would be interest rather than just frustratingly complex?
It's effectively how you explain en passant to a new player.
You would also not be allowed to move the king anywhere where the opponent can capture it.
What drives you internet stranger?
> One interesting side effect of this is that you can capture multiple pieces at once. :)
Which way is "past"? Can only knights milti-kill, since they can "jump" past the first point of contact?
In this version, the pieces are no longer constrained to having integer coordinates. A pawn can be "halfway" between, say A2 and A3, or a queen could be sitting roughly in-between several squares at once. In regular chess, pieces are captured when an enemy piece moves to the same square as them. In this version, since the grid doesn't exist any more, pieces are captured when an enemy piece physically overlaps them.
It's kinda like normal chess is a low-resolution game with only 64 possible locations, and this is a higher resolution version of it where you aren't limited to just those 64 locations and can slide continuously all across the board.
In this analog version, locations are defined continuously, the checkerboard they move over is meaningful only to establish starting positions, and then is purely aesthetic.
https://github.com/ehulinsky/AnalogChess/blob/main/analogche...
Challenge accepted.
It's analog because you can move any continuous distance. Not just a discrete number of tiles.
Digital is the study of (usually) binary circuits.
--------
Ex: an OpAmp is called an analog computer sometimes, because you can do things like Add, Subtract, Multiply, Divide, exponent, differentiate, or integrate voltages. (ex: 0.543V + 1.1V == 1.643V output). This is troublesome in practice because a bit of noise (ex: +.05V error) propagates.
This is in contrast to a digital computer, which encodes data into 0 or 1. There are things like PAM4 which encodes data as 0, 1, 2, or 3 (2-bits per signal), or other such "discrete steps". But the overall concept of "snapping" data to specific voltage levels allows you to fix noise issues.
A dumb thing I found - If you move the knight's pawn, it's just barely possible to, over the course of many moves, slip your rook diagonally through to that pawn's former space.
If they could do StarCraft, I don't see why they can't do this.
I love this.
> #fucking awful global variable that is is changed by the confirm() function of the pieces
> #math shit
> #i don't know what im doing
Or maybe his CS friends helped put it on github.
Or maybe he's just to piss us off :)
usually I end up with old/try1 old/try2 ... old/tryn
once I've worked out the way I really want to go, then I nuke old.
lol