Comment by Telemakhos

Comment by Telemakhos 19 hours ago

8 replies

Something similar happened to the macOS chess game, which has always been bundled with OSX/macOS. Once upon a time it was easy to beat in easy mode, which restricted how long it could thing in advance.

When Big Sur rolled out around 2020, Apple introduced a bug which disabled the difficulty slider: no matter what it was set to, it was hard or impossible to beat. In macOS Sequoia, the Chess app got updated again, and supposedly they fixed the difficulty slider, but in the interval silicon improved so much that the old restraints (like think for only a second) mean little. The lowest levels play like a grand master.

mh2266 17 hours ago

is there some reason to implement it as a time limit instead of iterations or something else deterministic? it being affected by CPU speed or machine load seems obvious.

or whatever makes sense if “iterations” isn’t a thing, I know nothing about chess algorithms

  • twoodfin 17 hours ago

    It’s simpler. Chess is a search through the space of possible moves, looking for a move that’s estimated to be better than the best move you’ve seen so far.

    The search is by depth of further moves, and “better” is a function of heuristics (explicit or learned) on the resulting board positions, because most of the time you can’t be sure a move will inevitably result in a win or a loss.

    So any particular move evaluation might take more or less time before the algorithm gives up on it—or chooses it as the new winner. To throw a consistent amount of compute at each move, the simple thing to do is give the engine consistent amounts of time per move.

    • TheDong 13 hours ago

      > To throw a consistent amount of compute at each move, the simple thing to do is give the engine consistent amounts of time per move.

      The simple thing to do is give it a limit on the total number of states it can explore in its search.

      If your goal is consistency, wall-clock time makes no sense. If I run 'make -j20', should the chess computer become vastly easier because the CPU is being used to compile, not search? Should 'nice -n 20 <chess app pid>' make the chess computer worse?

      Should my computer thermal-throttling because it's a hot day make the chess computer worse, so chess is harder in winter?

      If the goal is consistency, then wall-clock isn't the simple way to do it.

      • shadowpho 13 hours ago

        >If the goal is consistency, then wall-clock isn't the simple way to do it.

        It’s simpler than doing a limit on number of states, and for some applications consistency isn’t super important.

        Doing a time limit also enforces bot moving in a reasonable time. It puts a nice limit to set up a compromise between speed and difficulty.

        Doing state limit with a time limit might be better way to do it, but is harder.

        • Dylan16807 8 hours ago

          > It’s simpler than doing a limit on number of states

          According to who?

          A counter that you ++ each move sounds a lot easier to me than throwing off a separate thread/callback to handle a timer.

          > Doing a time limit also enforces bot moving in a reasonable time.

          It's designed for specific hardware, and will never have to run on anything significantly slower, but might have to run on things significantly faster. It doesn't need a time cutoff that would only matter in weird circumstances and make it do a weirdly bad move. It needs to be ready for the future.

          > It puts a nice limit to set up a compromise between speed and difficulty.

          Both methods have that compromise, but using time is way more volatile.

  • microtherion 16 hours ago

    A time limit is also deterministic in some sense. Level settings used to be mainly time based, because computers at lower settings were no serious competition to decent players, but you don't necessarily want to wait for 30 seconds each move, so there were more casual and more serious levels.

    Limiting the search depth is much more deterministic. At lower levels, it has hilarious results, and is pretty good at emulating beginning players (who know the rules, but have a limited skill of calculating moves ahead).

    One problem with fixed search depth is that I think most good engines prefer to use dynamic search depth (where they sense that some positions need to be searched a bit deeper to reach a quiescent point), so they will be handicapped with a fix depth.

    • Dylan16807 7 hours ago

      > One problem with fixed search depth is that I think most good engines prefer to use dynamic search depth (where they sense that some positions need to be searched a bit deeper to reach a quiescent point), so they will be handicapped with a fix depth.

      Okay, but I want to point out nobody was suggesting a depth limit.

      For a time-limited algorithm to work properly, it has to have some kind of sensible ordering of how it evaluates moves, looking deeper as time passes in a dynamic way.

      Switch to an iteration limit, and the algorithm will still have those features.