Download presentation

Presentation is loading. Please wait.

Published byZaire Cleasby Modified over 4 years ago

1
AE1APS Algorithmic Problem Solving John Drake

2
Coursework 3 due on Thursday at 1pm (i.e. before the start of the tutorial). Submit either hard-copy (including name/student number), or e-mail soft-copy to me. Normal university regulations apply to late submissions Please let me know if you have any problems! Office SEB325 John.drake@nottingham.edu.cn

4
The position in a given sum game is (l, r). A move affects one component (i.e one game) An assignment can either be l := l’ or r :=r’ (i.e. the left or right component is affected) Define two functions L and R on the left and right positions such that; (l, r) is a losing position exactly when L(l) = R(r)

5
L and R must have equal values on end positions All moves from a losing position should result in a winning position satisfying L(l) != R(r) Applying the winning strategy from a winning position, should result in a losing position

6
We require that: For end positions L(l) = R(r) = 0 For every l’ such that there is a move from l to l’ - L(l) != L(l’) For any number m < R(r), it is possible to move from r to r’ such that R(r’) = m (similar for left).

7
Fortunately for us such a function exists The MEX function, short for “minimal excludant”, satisfies these conditions and is therefore used as the functions L and R

8
Let p be a position in a game. The mex value of p (mex(p)), is defined as the smallest natural number, n, such that There is no move in the game from p to position q satisfying mex(q) = n For m < n, there is a move from p to q satisfying mex(q) = m. This is a recursive definition.

9
Informally, mex(p) is the minimum number that is excluded from the mex numbers of positions q to which a move can be made from p (i.e. q is a successor of p).

10
The graphs do not have regular structure, so the mex numbers must be calculated by hand End positions have a mex number of 0 A mex number can be give to a node when all its successors have been assigned a mex number The number is the smallest number that is not included in the mex numbers of its successors

13
Suppose we start with “ok” (o,k) as our position This is a winning position because the mex numbers are different The winning strategy is to move the right graph to node i which has the same mex number as “O” i.e. we are restoring the balance (R(r ) = L(l )) The opponent will then disrupt the balance (making this an inequality) The first player the repeats the strategy of making the mex numbers equal, moving in the game with the highest mex number, until the opponent can move no further

14
Note that due to the lack of structure, the mex number of the 15 left and 11 right positions were calculated individually In total we only did 15+11 (=24) calculations, and not 15*11 (=165) calculations

15
b) a) b) (15)(20)

Similar presentations

Presentation is loading. Please wait....

OK

AE1APS Algorithmic Problem Solving John Drake

AE1APS Algorithmic Problem Solving John Drake

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google