GNOME Bugzilla – Bug 707730
Review AI's choice of strategy
Last modified: 2014-09-19 13:25:39 UTC
The AI uses three strategies throughout the game: Best, Perfect, and Victory. Best is used for the majority of the game. Towards the end, it switches to Victory, and then one turn later to Perfect. That can't be right: why should there be a strategy that's used for only one turn? This needs to be reviewed (preferably by someone who understands them). The code in question was recently changed due to Bug #668553, but I kept the original behavior for choosing strategy.
Arnaud, can you sanity-check me on this please?
Created attachment 286567 [details] [review] computer-player: refactor strategies The victory strategy was pointless and just made the AI play worse at the end of the game before the AI could see to the final move. Rename the other strategies to make sense.
No technical problem with the code. I don’t really understand the Victory strategy, it is probably here to make a smooth transition between two “typed” strategies, but I’m not sure. Basically, it would need testing. ^^ Concerning the level 1… I already told my opinion here[1]; it would at least be better if he chooses place at random during a part of the game (we have a function…), and switch to MAXIMIZE_TILES at the same time the other levels. [1] https://bugzilla.gnome.org/show_bug.cgi?id=736938#c3
In fact, concerning the level 1, it would be quite better to just adjust the depth of the search, using the MAXIMIZE_TILES strategy all the game long. Let’s say, `var depth = level * 2;`? That would reduce the time of search of the level 3…
(In reply to comment #3) > No technical problem with the code. I don’t really understand the Victory > strategy, it is probably here to make a smooth transition between two “typed” > strategies, but I’m not sure. Basically, it would need testing. ^^ The point of the Victory strategy was to clamp the heuristic value to simply "I will win" or "I will lose" -- it's harmless if the AI can see all the way to the end of the game, but it makes it play worse otherwise. So I think we should go with it. > Concerning the level 1… I already told my opinion here[1]; it would at least be > better if he chooses place at random during a part of the game (we have a > function…), and switch to MAXIMIZE_TILES at the same time the other levels. > > [1] https://bugzilla.gnome.org/show_bug.cgi?id=736938#c3 The problem is that I'm not sure anything else we do will really make the easy AI easy enough. It's pretty obviously dumb at first, but towards the end of the game even the worst possible move can hurt, and it turns out OK (it loses when I play it, but not by much). Ideally we would have an AI that looks like it's making smart moves while actually setting the human up for a win, but I have no clue how you'd write such a thing. (In reply to comment #4) > In fact, concerning the level 1, it would be quite better to just adjust the > depth of the search, using the MAXIMIZE_TILES strategy all the game long. Let’s > say, `var depth = level * 2;`? That would reduce the time of search of the > level 3… We could try it, but I think that would still be too strong for easy. Another thing we could do once we have libgames-scores hooked up is secretly track how many games the player has won, and offer to change the difficulty level if he's winning a lot. Or simply make difficulty level selection more obvious.
Attachment 286567 [details] pushed as 8bab807 - computer-player: refactor strategies