Oswin Aichholzer Algorithms and Games1
Dots and Boxes
Algorithms & Games WS 2019/20
Oswin Aichholzer Algorithms and Games2 i
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
Oswin Aichholzer Algorithms and Games2 ii
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
3× 4 grid
Oswin Aichholzer Algorithms and Games2 iii
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
Oswin Aichholzer Algorithms and Games2 iv
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
A
Oswin Aichholzer Algorithms and Games2 v
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
Oswin Aichholzer Algorithms and Games2 vi
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
A
Oswin Aichholzer Algorithms and Games2 vii
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
Oswin Aichholzer Algorithms and Games2 viii
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
A
Oswin Aichholzer Algorithms and Games2 ix
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
Oswin Aichholzer Algorithms and Games2 x
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
A
Oswin Aichholzer Algorithms and Games2 xi
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
Oswin Aichholzer Algorithms and Games2 xii
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
B
Oswin Aichholzer Algorithms and Games2 xiii
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
B
Oswin Aichholzer Algorithms and Games2 xiv
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
AA
Oswin Aichholzer Algorithms and Games2 xv
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
A
AA
Oswin Aichholzer Algorithms and Games2 xvi
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
A
AA
Oswin Aichholzer Algorithms and Games2 xvii
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
A
AB
Oswin Aichholzer Algorithms and Games2 xviii
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
A
AA
Oswin Aichholzer Algorithms and Games2 xix
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
A
A
BB
Oswin Aichholzer Algorithms and Games2 xx
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
A
A
B
BB
Oswin Aichholzer Algorithms and Games2 xxi
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
A
A
B
BBB
Oswin Aichholzer Algorithms and Games2 xxii
Dots and Boxes
Dots and Boxes is played by two players (Alice and Bob)on and n×m grid.
In each turn a player connects two adjacent dots with ahorizontal or vertical unit segment.
B
If a player completes a unit box, he/she owns that box andmust then draw another segment (except in the last move).
A
A
B
BB
At the end of the game the players count their boxes. Inthe example B wins 4 : 2.
Oswin Aichholzer Algorithms and Games3 i
Move Generator: Pseudo Code
NEXT STATES(state, player)E = Set of unused segments in stateIF E = ∅ THEN
add state to list(state, NOT player)ELSE FOR all segments s ∈ E DO
IF s closes one or two boxes in state THENlabel new boxes with playernext states(state + s, player)
ELSEadd state to list(state + s, NOT player)
Main call:E = Set of unused segments in current stateIF E 6= ∅ THEN next states(current state, current player)
ELSE No moves possibleRemark: add state to list() removes duplicates
Oswin Aichholzer Algorithms and Games3 ii
Move Generator: Pseudo Code
NEXT STATES(state, player)E = Set of unused segments in stateIF E = ∅ THEN
add state to list(state, NOT player)ELSE FOR all segments s ∈ E DO
IF s closes one or two boxes in state THENlabel new boxes with playernext states(state + s, player)
ELSEadd state to list(state + s, NOT player)
Main call:E = Set of unused segments in current stateIF E 6= ∅ THEN next states(current state, current player)
ELSE No moves possibleRemark: add state to list() removes duplicates
Final segment closeda box, no move left(rule exception).
Oswin Aichholzer Algorithms and Games4
Small Boards
. . .
2× 2, 4, 6, 8, 10: B (4,8,12,16,20?) 2× 3, 5, 7, 9: draw
3× 3: A (9); 3× 4: B (12); 3× 5: A (15); 3× 6: B (18?)
4× 4: B (16)
Oswin Aichholzer Algorithms and Games5
Schedule:• Testrun 1: Tuesday 21.01.2020 14:00-16:00• Testrun 2: Thursday 23.01.2020 14:00-16:00• Competition 1: Thursday 30.01.2020 10:00-18:00• Competition 2: Friday 31.01.2020 10:00-18:00
Interviews:• By appointment with TAs, and on request of a group• January, February, first week of March.• All members of a group have to be present• Approach has to be explained• Source code has to be provided for the interview and
can be inspected
Oswin Aichholzer Algorithms and Games6
Evaluation: maximum of 34% for practical part• Minimum requirement: All valid moves (and only valid
moves) for all legal positions are provided; results in theminimum of 17%
• 17-34% depending on approach and level of play
Top Related