News for hackers. Stuff that matters.
Re:Building My Own Chess Engine by nineteen999 on Thursday December 24, 2020 @02:20AM (#25525665)
I once wrote a "chess engine" when I was much younger, however as I'm not much of a chess player, it wasn't very good. I encoded all the movement rules for each piece and then programmed the opponent to choose random valid moves. It would pick a random piece, pick a random square to move it to, and if it was considered valid, it would make the move, or pick another square. I think later I reprogrammed it to select 10 random valid moves, and select the one that allowed it to capture the highest value piece.

The great thing was that it worked, and it could "play chess". The sad thing was, I am such a bad chess player that it could still actually beat me around 50% of the time by choosing random moves.

Re:Building My Own Chess Engine by jsnell on Thursday December 24, 2020 @03:12AM (#25525873)
There are much worse strategies in the game than "random". You might find this article amusing:

http://tom7.org/chess/weak.pdf

Re:Building My Own Chess Engine by dsteinman on Thursday December 24, 2020 @09:23AM (#25527672)
I wrote a chess game using StockFish, and had it play against another computer player that only made random choices. And what surprised me is how long it would take StockFish to beat the random player.
Re:Building My Own Chess Engine by mormegil on Thursday December 24, 2020 @08:26AM (#25527226)
There is a funny chess variant on F-Droid called Open Chaos Chess <https://github.com/CorruptedArk/open-chaos-chess> where the players choose what piece should be played but the move is chosen randomly. The first player to lose all pieces loses the game (there are no checks and mates).
Re:Building My Own Chess Engine by glouwbug on Thursday December 24, 2020 @02:22AM (#25525670)
What's funny is that my strategy for chess is randomly moving pieces as well, given I play a little defense when things get close with the queen or rooks.