Live data from Hacker News

Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

chessboardjs.com

81–90 of 131 posts

Re: Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

#82

Never thought this comment would end up on HN when I wrote it ;) 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 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.

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.

Re: Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

#83
post #76

Earlier quoted context omitted.

Does it matter if there is an advantage to playing white vs black if both players are playing completely randomly? It should only really matter if there is an advantage when both players are playing optimally.

if completely random, you may prove that there is an empirical advantage to starting the game without taking in account the level of any player, because two players playing randomly should be equivalent. I'm not entirely sure, though.

This is technically correct, but does not result in a very useful information, as P(A|B) can be a very different beast than P(A).

Re: Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

#84
post #48

One thing that is on my (way too long) list of things to try is n-gram chess. 1-gram chess would, for every move from black, have a dictionary of (following move, win probability) pairs, and it would pick one that is legal using the win probabilities to generate a distribution (if there is a sure win, almost always pick it; if there is a move that always lost before, pick it very rarely) You can start this of with em…

How is this different from an opening tree?

It would be agnostic of how far the game has progressed (if 1. …c5 is a good reply to 1. e4, it also would be considered a good reply to 75. e4)

It would also be used in end games.

Re: Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

#85
post #46

Earlier quoted context omitted.

It's not just random vs random. Two extremely weak players will take hours to finish a won game, because the player with the major material advantage does not know how to win! 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 opportunit…

I still don't know how to checkmate with two bishops. I mean, I've read how to do it, but if you stuck me in an endgame situation, I'd probably draw. Luckily, I have never actually had an endgame with a king and two bishops versus a king. Same thing with king, knight, and bishop.

More interesting is checkmate with two knights which is only possible if the other king makes a mistake. You cannot force it so if two good players end up in this situation, they mostly agree on a draw.

Re: Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

#86
post #7

Because check mate is a very small subset of possible moves at the end game, I'm guessing the vast majority of games will end(?) with 2 kings moving around randomly for all of time. 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…

The program stops when nobody has enough pieces to force a checkmate. In three tries, I've seen that twice, and one rook/pawn checkmate. It's a nice Javascript demo.

Re: Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

#87
post #6

I found myself getting mad at Math.random() pretty quickly. "Argh, you just got to promote two pawns, and you made them both black bishops!?!? I oughta fire you and hire an LFSR!"

Yeah, now just plug a genetic algorithm to it, and let it evolve.

Re: Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

#88
post #76

Earlier quoted context omitted.

Does it matter if there is an advantage to playing white vs black if both players are playing completely randomly? It should only really matter if there is an advantage when both players are playing optimally.

if completely random, you may prove that there is an empirical advantage to starting the game without taking in account the level of any player, because two players playing randomly should be equivalent. I'm not entirely sure, though.

Imagine a really simple game where there are only 2 moves: saying 1 and saying 0. The player who first says 1 wins. So of course the player who has the first turn will in practice always win, but when both players move randomly it's 50/50.

Re: Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

#89
post #79

Earlier quoted context omitted.

This is a drawn game according to the rules of chess, since checkmate is impossible. 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 + stat…

As I understand it, the threefold repetition rule does not mandate a draw, it just allows either player to claim a draw upon occurrence.

I believe 50 moves rules is the same. But in that case, one player is more interested in the draw than the other. In the case of repetition, both players are avoiding a move that gives the other the advantage. It's not so much a mandatory or not question, but if one of them is more willing to try a different move than to draw.

Re: Chess: Who will win in this riveting game of Math.random() vs. Math.random()?

#90
post #46

Earlier quoted context omitted.

It's not just random vs random. Two extremely weak players will take hours to finish a won game, because the player with the major material advantage does not know how to win! 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 opportunit…

This feels almost like a metaphor for teaching young people about anything... step 1:learn to play a game and the rules. Step 2: learn the implied rules for winning, and how to know when you are winning.

It's a vague outline for anyone learning anything, really.
Post reply on HN