简体   繁体   中英

how to Slow down AI?

So i'm writing an app for android where you play a game similar to Dutch Blitz. Its a pretty simple game, and I have it basically finished, I'm mostly looking for advice for how to handle my AI opponents, right now they win the game in about 2 seconds, I was wondering what i should do to get them to "pause" mid loop or how to slow them down some how so that the user has a chance to actually win.

I just don't want my way to slow them down dependent on the processor speed of the phone used...

I'm not familiar with the game Dutch Blitz, but this logic should apply. You can create your turn functionality triggered by a Count Down Timer . That function repeated (think of this as a turn) will eventually equate to a win condition. Causing your AI to prevale eventually, but not right away. You can then set the rate of how often a turn happens, thus controlling the rate at which your AI will win. Also this makes it easy to set difficulty levels by increasing the time it takes your AI to complete a turn.

Your game may work with different rules, but some kind of interval per turn would probably be the simple way to control the speed of your AI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM