Chess: Who will win in this riveting game of Math.random() vs. Math.random()?
chessboardjs.com
chessboardjs.com
This assumes most games will make it past the hump of mid game where its possible the king's motion will be limited and a checkmate can erroneously happen, I suspect this is a rare case as well.
On a side note I wonder what kind of useful information could be mined from a huge set of random-random games. Maybe the relative power of each piece in terms of the number of pieces it captures on average? Also with some heuristic tweeks you could probably start exploring the power of various openings. Of course then its no longer random-random.
edit: forgot you can checkmate with just a king and a queen
I think it's also possible to checkmate with a rook + king (if you corner the king and have your king cover the escape route from check).
while no checkmate:
If your rook is about to be taken, move it to the other end of the current rank.
If the enemy king is on rank n and your rook is anywhere but rank n-1, move your rook to rank n-1 (unless it can then be taken, in which case move it to the end of its current rank.)
If your king is anywhere but rank n-2, move towards there.
If your kings are on the same file, advance the rook to rank n (unless it can be taken...)
If |file of your king - file of opponents king| is odd, make a wasted move with the rook (keeping it on the same rank).
If you've gotten this far, move your king towards the opponent's king (staying on the same rank n-2).In rare circumstances you can checkmate with a king and a single bishop: http://www.chess.com/forum/view/more-puzzles/mate-with-one-b...
Even with that advantage, black couldn't randomly stumble across checkmate.
That's what I got and I think once you get to the end, a stalemate with an imbalance of pieces on one side may be the most likely.
edit: missing pawn from sentence
You didn't quite state that right--every move something moves, so it is not possible to go 50 moves without moving anything. :-)
The rule is 50 moves without a pawn moving or anything being captured.
Also, it can be a draw, but it does not have to be. When the last 50 moves have been without a pawn move or a capture, the player on the move can claim a draw if he wishes, but does not have to do so.
Recently, FIDE added a 75 move rule. It is similar to the 50 move rule, except that it is a draw even if both players wish to continue the game. (They also did a similar thing with the 3-fold repetition rule, which like the 50 move rule is only a draw if a player claims it. There is now a 5-fold repetition rule that draws even if neither player wants to claim a draw).
In fact, the only irreversible move that doesn't reset the 50 move rule is castling (or losing the right to castle), as having the ability to castle technically changes the position.
Hah, that's what I got on my second run: http://i.imgur.com/joLf3BX.png
The game stopped right there, though.
Edit: Hah! Again! http://i.imgur.com/2ItU89S.png
Other draw conditions include:
* Stalemate (=The side to move has no legal moves)
* 50 moves in a row without any permanent changes happening ("permanent changes" means a pawn moving or a piece being captured)
* Exactly the same game state occurs for the third time ("game state" is whose turn it is + status of castling ability + status of en passant possiblity + which pieces are where)
* Agreed draw
Fun fact: In normal time controls (not blitz) at competitive levels, chess games virtually never end in one of the termination conditions. I don't have statistics on hand but I would expect resignations and agreed draws account for 98%+ of grandmaster-level games.
When teaching kids, it's not uncommon to, after teaching them how to move all the pieces, spend time teaching them how to perform the most basic of mates: KQ vs K, KRR vs K, KR vs K. Only after those three are mastered we have a good opportunity of having beginner games ending in anything other than a stalemate.
More interesting is that the position is actually winnable if the losing side has an extra piece (a pawn that isn't too advanced up to board).
The general trick is to block the pawn with one knight, force the king into a corner with king and other knight, and then bring in the second knight for the checkmate so fast that the pawn cannot promote to a queen and then make another move (promotion to a queen is OK if the checkmate immediately follows)
What I don't want to find is queen vs. rook. I played once queen and pawn vs. rook and won, but it was painful. It seems there are some masters that are specialists in drawing in this positions, even if it should always be a win. Computers with end tables have not this problem.
From a random position on the keyboard, you typically need around 20-25 moves to achieve it, and there is a rule that draws a game after 50 moves without any pawn moves.
I've seen an International Master offer draw to his opponent in KNB + K game because he didn't remember what the winning method was (I suposo that after 5+ hours playing your eroded mindset also plays a role.
Bishop and knight is nontrivial to do in the 50 moves you have, but almost never comes up.
Really wonderful and insightful book. There's a small part about his vision in how to teach chess and in that part he also shares why he believes it's better to avoid the "learn all the rules than play" but instead to learn the rule incrementally by using actual pieces on the chess table in the most simple situations (2 or 3 pieces max). Then increase the complexity by adding pieces.
Obviously I'm going by memory so I might be a little incorrect into the explanation, but if you love the subject of learning and the subject of chess, the book is worth a look (in fact I'd advise to read the book to almost anyone).
1) Yes, most games will end in stalemate. 2) Most wins would occur when one side has enough passed paws such that they chance upon promoting to a few queens.
3) The random-promotion significantly lowers the chances for checkmate. Promotion to a queen is so common that many players who play online chess set paws to automatically promote to queens, so they don't waste the 2 or so seconds it takes to click the "Queen" button.
The first is if promoting to queen would cause stalemate. In that case, you would probably promote to bishop instead, because rook would cause the same problem as queen, and knight is harder to force mate with. In the rare case where a bishop would cause stalemate, you promote to rook instead.
The second is if promoting to knight would force checkmate faster or more surely than queen, which is so rare you practically need to play with the intent of making it happen.
Either one is trivial to determine in a chess-playing program.
Check 1: would a knight promotion cause immediate checkmate? If yes, then promote to knight.
Check 2: would a queen promotion cause immediate stalemate? If no, then promote to queen.
Check 3: would a rook promotion cause immediate stalemate? If no, then promote to rook.
Check 4: would a bishop promotion cause immediate stalemate? If no, then promote to bishop.
Check 5: would a knight promotion cause immediate stalemate? If no, then promote to knight.
Otherwise, promote to queen and take the stalemate.
Or you could simply make queen promotion the automatic default unless you advanced the pawn using a context menu to promote to a different piece.
By far the second most common piece to promote to is a knight, simply because a knight moves in a way a queen cannot. In my 10 years of playing chess, I have probably seen about 5-10 tournament games where promoting to a knight is the correct choice.
Here is a FEN of an example where the only saving move for Black is to play 1...e1=N+: "8/8/8/8/8/3K4/R3p3/3k4 b - - 0 1"
You are right in that the only reason to ever promote to a bishop or rook is to avoid stalemate, yet there is only one practical example of such, here: "8/2P5/8/8/3r4/8/2K5/k7 w - - 0 1".
White must promote to a rook, since if they promote to a queen Black will play 1...Rc4+, forcing 2...Qxc4, which is stalemate. I cannot even find a practical example of when promoting to a bishop would the best choice.
Whether there is a real advantage to start with white instead of black ?
This has the randomness but without any bias or evaluation of effectiveness.
But really, Monte Carlo in Go can basically be thought of as a lazy, intelligent brute-forcing method.
I remember writing this example and being mesmerized watching the games progress. I think I made an alternate version that speed up the time and opened a handful of browser tabs to watch the games. Most of them do end up in insufficient piece draws or the 50-move rule.
Glad to see others are enjoying it :)
I also made an alternate version which runs faster, and I added some code to count games. About an hour on Chrome got me to this point:
44 white wins.
415 ties.
41 black wins.
500 games played.
EDIT: Another hour, and the stats are now: 74 white wins.
847 ties.
79 black wins.
1000 games played.I would expect that white/black position would be very similar in results (for random games only, of course).
You can start this of with empty dictionaries, and have the thing learn after each game (let two copies play for a few days to get let them teach each other how to play chess)
2-gram chess would improve on this by using (white move, black's reply) as the key in such a dictionary.
I think that would make for better chess than this. For some N, N-gram chess might even superficially look like the real thing at times.
[1] https://chessprogramming.wikispaces.com/Killer+Heuristic
[2] https://chessprogramming.wikispaces.com/History+Heuristic
It would also be used in end games.
I'm curious if other people had the same visceral reaction.
In the endgame black had only a king and a pawn and the pawn was hung up on another pawn in the g column. Black's king was trapped in column a by two white rooks in the b column. White managed to create a stalemate with black king at a5 and white rooks at b4 and b6.
Here's a breakdown.
* 446 losses by checkmate
* 23 wins by time forfeit
* 18 wins by resignation
* 5 wins by disconnection forfeit
* 15 stalemates
* 5 draws by insufficient material
* 2 draws by repetition
Obviously it never won by checkmate. The rest basically came down to whether the human opponent figured out that it was playing against a bot.
We imprint our own flawed notions of randomness on everything.
see it here
https://barronwasteland.wordpress.com/2014/08/04/random-move...
https://barronwasteland.wordpress.com/2014/12/13/infinite-mo...
ChessPeace says "Draws by insufficient mating material is not available because of insufficient theory dealing with the non-standard pieces".
"Play with many new pieces with new abilities not seen in standard chess"
It seems that if the board is currently limited to standard pieces, it should use the standard rules for draws by insufficient mating material. How hard is that? No pawns, no non-standard pieces, no queen, no rook, less than two bishops, and no knight + bishop.
It combines the fun of steamrolling the opponent with the strategy of planning captures that leave your piece perfectly safe, or managing the board so that the computer could take your piece but probably won’t.
I don't play chess beyond knowing the rules, but this is a lot more fun than watching a tournament!
I guess the next thing to do is instead of random: if you can capture a piece of equal or higher value: do so. This is, of course, not a particularly good chess strategy, but would probably be less painful to watch.
I'm also curious how rare a victory is here, and if it can be modeled with math.
The two queens got very friendly before the white king killed the black queen in a fit of jealousy.
Meanwhile one black knight just stood off in the corner watching. Waiting.
Near the end of the game the probability of something interesting happening decreases. Maybe in the end it could at least prune out some moves and choose randomly only amongst those that make pieces go closer to each other?
https://chess.stackexchange.com/questions/8066/is-it-possibl...
I guess you would want to program it to only play against other bots, and many of the other ones are probably quite strong (since they're based on relatively advanced chess software). So maybe that's not the ideal environment for starting from zero.
* host a tournament of many different PRNG seeds.
* generate long strings of moves (random numbers) up front and then use a genetic algorithm to breed and mutate the winning strings.
I've heard several poker players saying that it's hard to play against novices, because they do nonsense.
Surly there is some game theory that says something about this. Anyone?
(Global consciousness project is a bunch of computers generating random numbers all over the world that seem to spike when catastrophes occur http://en.wikipedia.org/wiki/Global_Consciousness_Project )