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?

6
  • 1
    Nice question. A chess program that errs like a human ... Commented Dec 8, 2015 at 8:10
  • Why would you want that? For learning it's better to play against decent players / AI. Commented Dec 8, 2015 at 9: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
    Commented Dec 8, 2015 at 9:08
  • 1
    Find one that drops pieces on move 8. It will mimic me!
    – Tony Ennis
    Commented Dec 8, 2015 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
    Commented Dec 20, 2015 at 6:12

1 Answer 1

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.

4
  • 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
    Commented Dec 8, 2015 at 9: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
    Commented Dec 8, 2015 at 9:20
  • @201044 Remember, most of possible moves in chess are nonsense, like giving up the queen and pieces.
    – SmallChess
    Commented Dec 8, 2015 at 9:23
  • 1
    Well I should have said a randomly implemented poor yet not game-losing move. Mixed with randomly implemented brilliant moves.
    – 201044
    Commented Dec 8, 2015 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.