1
How hard are computer games?
Graham Cormode, DIM ACS graham@dimacs.rutgers.edu
How hard are computer games? Graham Cormode, DIM ACS - - PowerPoint PPT Presentation
How hard are computer games? Graham Cormode, DIM ACS graham@dimacs.rutgers.edu 1 Introduction Computer scientists have been playing computer games for a long time Think of a game as a sequence of Levels, where each level has some
1
Graham Cormode, DIM ACS graham@dimacs.rutgers.edu
2
games for a long time
each level has some objective that must be carried
random? How much information does player have?
3
ust a puzzle...
make three in a row loses.
player, a draw, a win for the second player?
4
add it to their set.
to 15
for the second player?
B wins: 6 + 2 + 7 = 15
5
randomness -- Game Theory, Nim games, M in-max theorem, Nash equilibrium etc...
randomness -- Economics! Insider trading, Auction theory, mechanism design, internet protocols...
Computer Games (today's topic).
6
7
configuration of pieces that the player can manipulate or interact with, in order to reach some solution.
player: no monsters to shoot
8
— locate the mines but don't click on one!
M inesweeper configuration (board with labels and counts) is it consistent? That is, is there some arrangement
to that configuration?
9
consistent with the input
up 'gadgets' (logic gates) made out of mines. Wires with phase change
10
How to formalize Tetris?
Complete information (1) Current board configuration (2) List of all future pieces.
be cleared?
We must allow arbitrary sized playing area.
11
Hohenberger, Lieben-Nowell, 2003]
initial configuration represents a set of bins, the game pieces in order encode a set of integers in unary.
problem.
12
locations
Is there a strategy that stores all blocks?
solution is polynomial in the level size)
complete: can emulate a finite tape Turing M achine
13
M-x tetris M-x sokoban M-x xmine
in, we must conclude that this is also a hard task, as proved by the students who spend most of their time playing computer games...
14
someone who hasn't played before, will attempt to give a cut-down description.
steel, earth, and air.
15
fall down a hole...
Lemmings that change how they proceed.
temporary (stop under certain conditions), plus two that don't fit into either category...
16
The Lemming Skills are:
17
Formalize: L (a level of lemmings) is a tuple with these entries:
Problem: given L, is there a strategy that gets at least save lemmings to the exit?
18
19
satisfiable
20
in NP: the player provides the "certificate", and computer checks it.
description of what to do) then check this certificate in poly-time: each move is valid, enough are saved.
grid size — then check each step in poly time.
21
to make the encoding.
another lemming for each variable.
22
23
build a bridge over one of the gaps.
24
build a bridge over one of the gaps.
25
Wire lets paths cross J unction forces lemming
We will restrict number of skills availble so there are none spare to change paths
26
at the top, and a bunch of variable gadgets at the bottom right leading to the exit.
literal (3m columns in total), and one row for each variable and its negation (2n rows).
i'th clause is xk
in i'th clause is ~ xk
27
(~ V1 v V2 v ~ V3) ? (~ V2 v V3 v V4) ? (V1 v ~ V2 v ~ V4) ? (~ V1 v ~ V3 v ~ V4) V1 V2 V3 V4
28
29
30
and arguments.
level is a satisfying assignment to the 3SAT instance and vice-versa
Lemmings is NP-Hard Since the certificate can be checked in poly-time: Lemmings is NP-Complete
31
(bashers, diggers and builders) -- what about Lemmings with other skills?
problem is decidable in polynomial time.
32
4 corresponding to a lemming with no skills, with climbing, with floating, and with both. 2 corresponding to facing left or facing right
will go to. (Special node for “ dead” ).
lemming a certain skill.
33
temporary skills to change the board), G is static, the problem reduces to reachability problems on G
to allocate the skills we do have. – Remove all lemmings that reach the exit unaided. – Then see how many exit with only climbing or
– Then (after some calculations) see how many of the remainder make it out if given both skills.
34
under restrictions, it is decidable. Are we done now?
since it needs lot of entrances, and lots of Lemmings.
still NP-Hard?
35
1-Lemmings is also NP-Hard.
it's more detailed and requires more gadgets).
Lemmings that can be saved, up to any factor.
36
the one-way: if the Lemming has come down this gadget, then it cannot later go across it.
down vertically through all
to a variable.
right through clauses.
37
after each vertical descent (setting a variable), and from left to right after each horizontal crossing (satisfying a clause)
nothing too difficult
One way wire Clause J unction
38
(~ V1 v V2 v ~ V3) ? (~ V2 v V3 v V4) ? (V1 v ~ V2 v ~ V4) ? (~ V1 v ~ V3 v ~ V4)
39
40
corresponds to a satisfying assignment to 3SAT and vice-versa
can be saved on any level…
41
usually easier. Is there something deeper here: are most 'good' puzzle games NP-hard? Are there many good puzzles that are known to be in P? (eg sliding block puzzles, 14-15)
42
Turing machines? (details: need to encode bits - might be able to do this using bridges, which can be destroyed).
Doom, etc.? Is your favorite game NP-Hard? Or weaker: does it encode CFG languages?
certain games?
43
draw.
to "mirror" every move the second player makes.
second player already has.
44
Write S as a magic square. Every subset of S that sums to 15 is a row in the magic square. Each player taking an item from S = putting a marker
Game is won when they have three in a row. So game is equivalent (isomorphic) to Tic-Tac-Toe
45
######################################################################### # RSG-SMB-TAB-1.1 # ########################################################################## How to Win "Super Mario Bros" Nintendo Entertainment System WORLD 1 - LEVEL 1 +----------------------------------+ Key: < = Left | | > = Right | ^ | ^ = Up | < > O O | v = Down | v select start B A | B = B button | | A = A button +----------------------------------+ < ------------------------------------------------------------------------ > OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ^ ------------------------------------------------------------------------ v ------------------------------------------------------------------------ B --------------------------OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO A ------------------------------------------------------------------------ < ------------------------------------------------------------------------ > OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ^ ------------------------------------------------------------------------ v ------------------------------------------------------------------------ B OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO A ------------------------------------------------------------------------