3

Is there such a thing as a chess program that at random times can vary it's strength of play between say a beginner and an expert? Or maybe a program that a certain random times makes subtle or obvious mistakes?

201044
  • 359
  • 1
  • 8
  • 1
    Nice question. A chess program that errs like a human ... – Sir Cornflakes Dec 08 '15 at 08:10
  • Why would you want that? For learning it's better to play against decent players / AI. – Joshua Bakker Dec 08 '15 at 09:01
  • 1
    The possibility of such programs is a fun diversion. Also it's a great opportunity to approximate how the mind works in beginner or amateur chess playing. We are not after all precisely programmable so learning how a possibly disorganized imprecise cognitive system like human beings can manage to even beat some precisely programmed chess engines is very interesting. – 201044 Dec 08 '15 at 09:08
  • 1
    Find one that drops pieces on move 8. It will mimic me! – Tony Ennis Dec 08 '15 at 12:02
  • Could a chess program be able to make random mistakes yet still be able to win even with a non-beginner? – 201044 Dec 20 '15 at 06:12
  • @JoshuaBakker: Your interesting comment has provoked a question. – thb Jun 05 '16 at 11:54

1 Answers1

2

Of course, and in fact it's very common.

Stockfish

The code for the implementation:

int weakness = 120 - 2 * level;

// Choose best move. For each move score we add two terms, both dependent on
// weakness. One deterministic and bigger for weaker levels, and one random,
// then we choose the move with the resulting highest score.
for (size_t i = 0; i < multiPV; ++i)
{
    // This is our magic formula
    int push = (  weakness * int(topScore - rootMoves[i].score)
                + delta * (rng.rand<unsigned>() % weakness)) / 128;

    if (rootMoves[i].score + push > maxScore)
    {
        maxScore = rootMoves[i].score + push;
        best = rootMoves[i].pv[0];
    }
}

If you ask Stockfish to play weaker chess, it'd randomly choose a weaker move. It does that by drawing from a uniform distribution and linearly relate the level you choose with the random noise (weakness and push in the code).

SmallChess

Other engines adopt other implementations. For example, I prefer a model where I draw a sudden large jump to simulate a gross blunder. The probability depends on the level, and it is related to the number of pieces on the board. When my engine feels it needs to make a blunder, it'd do a quick shallow search. My intention is try to simulate simple tactic errors.

SmallChess
  • 22,476
  • 2
  • 45
  • 82
  • 1
    Can a randomly bad moving chess program still have the ability to play very well, again at random times and in doing so play unpredictably? – 201044 Dec 08 '15 at 09:12
  • @201044 A bad random move is enough to lose the game, no matter how strong you are. I can easily beat Carlsen 1000-0 if he has to make some random moves in a game. I don't think playing randomly would work. – SmallChess Dec 08 '15 at 09:20
  • @201044 Remember, most of possible moves in chess are nonsense, like giving up the queen and pieces. – SmallChess Dec 08 '15 at 09:23
  • 1
    Well I should have said a randomly implemented poor yet not game-losing move. Mixed with randomly implemented brilliant moves. – 201044 Dec 08 '15 at 09:25