1 / 13

AI – Week 8 AI + 2 Player Games

AI – Week 8 AI + 2 Player Games. Lee McCluskey, room 3/10 Email lee@hud.ac.uk http://scom.hud.ac.uk/scomtlm/cha2555/. RECAP – SYMBOLIC AI. Representing “knowledge” (rather than just “data”)

keelia
Télécharger la présentation

AI – Week 8 AI + 2 Player Games

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AI – Week 8AI + 2 Player Games Lee McCluskey, room 3/10 Email lee@hud.ac.uk http://scom.hud.ac.uk/scomtlm/cha2555/

  2. RECAP – SYMBOLIC AI • Representing “knowledge” (rather than just “data”) Usually done using “logic” or some other “declarative” language eg using PDDL to represent knowledge about actions • Reasoning – like planning, learning, problem solving, inference Usually done using SEARCH eg nodes contain states of the world, arcs represent action execution. Heuristics can make search feasible.

  3. Games and Leisure applications AI point of view: Feasible application of AI because we can abstract from the “real world” Computer games and virtual worlds point of view: they tend to be more appealing if • they are realistic: their virtual world appears to embody the physical laws of the natural world, eg gravity, lighting. • achieved by good graphics • they are believable: human characters’ behaviour resemble human behaviour, NPC’s are rational • achieved by good AI Eg South Park, Wallace and Grommet, Donald Duck are “believable” animations but not very realistic! People recognise and empathise with characters through the narrative … rather than through their physical characteristics AI techniques can be embedded in opponents, other characters, or the environment to make the game more believable.

  4. Reactive “intelligence” Most current games with virtual environments use programmed behaviour via reactive condition-action rules to mimic intelligence BELIEF/ WORLD STATE SET OF CONDITION- ACTION RULES sensors effectors EXTERNAL ENVIRONMENT (eg real world)

  5. Reactive “intelligence” • Behaviour of NPCs: Use an FSM • State of NPCs: Use a set of attribute-value pairs • Transitions can be random to give the appearance of unexpected behaviour attack Detect enemy Low energy wander Detect enemy Search for food retreat

  6. AI – predictive, deliberative, goal directed • We could us automated planning to help characters appear believable in virtual environments. They could be given goals, and it would be up to them to plan to meet them. However, if the game is adversarial and tightly coupled, planning on its own would be useless! • In adversarial, tightly coupled, turn-based games (chess, draughts, connect-4, card games, strategy games..) AI techniques have been well- developed to enable computer move generation.

  7. AI in Turn-Based, 2-player Games Assume: • Take one turn each • World state is knowable / calculable • Players will always try the ‘best’ move • A world state can be evaluated to decide if it is better than another World state = game state (eg board situation) Action = move a piece Goal = win game, or maximise gains AI move generating program = search tree of possible future board situations to find goal TAKING OPPONENT INTO ACCOUNT

  8. Search in 2-player games: Game Tree A 2 player “game tree” is a tree where • nodes are “boards” (game situations) • uni-directional arcs are “moves” connecting one board to another, and alternative arc layers of the tree represent alternative player’s moves • the route node is the initial board • Each node can be given a value with respect to one of the players, depending how good the board situation is for that player • depth of the tree is sometimes called its “ply”.

  9. Search in 2-player games: Minimax Minimax • Using breadth first search create a “game tree” to a certain depth n (n-ply) • Start at the leaves and evaluate each board. • Find the min or max of each board set depending on who is making the move, and attach this value to the node directly about the leaves. • Continue till the root is reached • Make the move which maximises the values of the nodes connecting the root

  10. Minimax with alpha/beta pruning Minimax + alpha/beta pruning is a good heuristic as it SAVES RESOURCE but always gives the SAME, optimal answer as mini-max Minimax with alpha/beta Change STEP 3: • When evaluating nodes at a layer, check the current value at the layer above. IF continuing to evaluate nodes in the layer is useless, then stop. This happens if • AT A MAX layer: we find a node with higher value than current MIN in the layer above • AT A MIN layer: we find a node with a lower value than the current MAX found in the layer above

  11. Other Heuristics • The minimax has problems if the search is stopped when “there is a lot going on”. If the evaluation function only evaluates piece values, then the minimax can suffer from the Horizon effect: a board is evaluated to be good when in fact the next move proves disasterous. Heuristic: grow the tree when boards are in a state of “flux”. Do not grow boards that are “quiet”. • Minimax with alpha-beta pruning is still very resource hungry for games like chess. Heuristic: at each ply, evaluate the boards FIRST, sort them into order, and search only the ones that are the highest/lowest value (depending on whether it is a max or min ply)

  12. Other types of Games • N-Player: There are N-player versions of minimax, but these have to have assumptions about the other player built in (eg that the other players do not ‘gang-up’ on one). These can be used in Poker etc • Imperfect Information: Some Games (esp card games) players have imperfect world knowledge. In these cases the player/computer can use n-person minimax but has the added complication of using probabilities / constraints to evaluate opposing player’s ‘hands’ • Games that Learn – using AI Games techniques the “deliberation” aspect can be used to support learning by experience.

  13. Summary • AI search techniques have been used in Two Player Games very successfully for years. • The most common techniques are based on games tress, mini-max, and alpha-beta pruning

More Related