COMP30024-python代写
时间:2023-03-22
Rules for the Game of Infexion
COMP30024 Artificial Intelligence
2023
Infexion is a two-player game of contagion and domination. You assume the role of a virus vying to
overtake and control an unsuspecting host. But beware, another strain competes for dominion, and will
stop at nothing to steal your hard work in its own quest to prevail. You’ll have to be not only smart, but
cunning, as you attempt to outmaneuver your opponent in an increasingly cut-throat environment. Will
you emerge victorious in this battle for viral supremacy?
Overview
Infexion is a perfect-information two-player game played on an 7 × 7 hexagonally tiled, infinitely
repeating board. Two players (named Red and Blue) compete, with the goal of taking control of all
‘tokens’ on the board.
2
2
1
1
1
1
1
5
4
4
42
1
2
1
3
1
1
1
1
1
1
1
1
1
5
6
4
Figure 1: An example in-progress game of Infexion.
Game Board
We use an axial coordinate system to describe positions on the hexagonal grid (Figure 2). Formally,
a valid coordinate is an integer pair (r, q), 0 ≤ r ≤ 6, 0 ≤ q ≤ 6. Similar to a classic game of Pacman
1
where the game environment edges are spatially connected, the same is the case in Infexion. Although
there is a board “outline” depicted in our illustrations, these are just numeric boundaries where q
and/or r wrap around from 7 to 0 (or vice versa). In other words, there are no true ‘edges’ of the
game board, but rather, it spans an infinite repeating plane 1. For example, in Figure 2, notice how
the coordinate (6, 1) has two neighbouring cells which wrap around to the other side of the board,
namely, (0, 1) and (0, 0).
r
q
0
1
2
3
4
5
6
0
1
2
3
4
5
6
6,6
6,0
6,1
6,2
6,3
6,4
6,5
6,6
6,0
0,6
0,0
0,1
0,2
0,3
0,4
0,5
0,6
0,0
1,6
1,0
1,1
1,2
1,3
1,4
1,5
1,6
1,0
2,6
2,0
2,1
2,2
2,3
2,4
2,5
2,6
2,0
3,6
3,0
3,1
3,2
3,3
3,4
3,5
3,6
3,0
4,6
4,0
4,1
4,2
4,3
4,4
4,5
4,6
4,0
5,6
5,0
5,1
5,2
5,3
5,4
5,5
5,6
5,0
6,6
6,0
6,1
6,2
6,3
6,4
6,5
6,6
6,0
0,6
0,0
0,1
0,2
0,3
0,4
0,5
0,6
0,0
Figure 2: The coordinate system used on an Infexion game board.
Hexagonal cells on the board may be empty, or have a stack of 1 ≤ k ≤ 6 tokens controlled by a
particular player (we call k the POWER of the cell). For example, in Figure 1, the cell at (3, 2) has
POWER 3, and the ‘controlling’ player is Blue.
Gameplay
• The game begins with an empty board and proceeds sequentially.
• By convention, Red starts. Throughout the game Red and Blue take turns. In a given turn a
player chooses to play one of the following two actions:
– A player may SPAWN a token in an empty cell, on the condition that the total POWER
of all cells on the board is less than 49.
– A player may SPREAD one of their token stacks of POWER k in a consecutive line of
adjacent cells (they may choose any one of the six hex directions around the cell).
• The exact validity conditions (and edge cases) related to the aforementioned actions are
detailed below in the “Actions” section.
• The game ends when one player takes control of all opponent tokens on the board. See the
“Ending the Game” section for details.
1The topology of the board is a torus.
© - University of Melbourne, 2023 2
Actions
SPAWN
On their turn, a player may choose to SPAWN a token in an empty cell at some coordinate (r, q).
This action is valid only when the total POWER of all cells on the board is less than 49. Hence it
is typically played during the early game 2, and is in fact the only possible action on each player’s
first move.
Figure 3 shows an example of a SPAWN action. The state of the board before and after the action
is shown on the left and right respectively. Notice that the total POWER of occupied cells on the
board before the action is 5 (< 49), hence the move is permitted.
1
1
1
1
1
1
1
1
1 1
1
1
1
1
1
1
1
1
1
1 1
1
1
Figure 3: Red plays a SPAWN action at coordinate (5, 4).
SPREAD
A player may alternatively choose to SPREAD an existing token stack of power k which they
currently control. A SPREAD action is defined by a board coordinate, (r, q), the cell where this
stack currently resides, and a hex direction (rd, qd) which is one of the following “hex neighbour”
offsets: (0, 1), (−1, 1), (−1, 0), (0,−1), (1,−1), or, (1, 0).
Specifically, a SPREAD action involves the following changes to the board state:
• All k tokens comprising the chosen stack are removed from the cell, leaving it empty.
• The immediately-adjacent line of k cells in the chosen direction, (rd, qd), have one token placed
on top of each, thus incrementing their POWER by exactly one.
• The moving player takes control of any opponent-controlled stacks where a token has been
placed on top.
2Note that it is not impossible for tokens to be removed via the SPREAD action, thus permitting it later on in a
game, even after the 49 limit is reached.
© - University of Melbourne, 2023 3
• In the case that a stack is incremented above POWER 6 (the maximum possible power), the
stack is completely removed from the game, leaving the cell empty. This also consumes the
SPREAD token that would have been placed on top.
Note that a “stack” in its simplest form is just a single token in a cell, i.e., a cell with a POWER of
one. The SPREAD action applied in this context is really the same as “moving” it one cell in any
direction, potentially stacking it on top of another adjacent stack.
Figure 4 shows an example SPREAD action on a POWER 5 cell, for two of the six possible hex
directions. In particular, observe how in Figure 4b the updated cells include a “wraparound” of the
board in the q axis. Since (6, 7) is not a valid board coordinate, the SPREAD action wraps around
to (6, 0) and (6, 1).
2
2
1
1
1
1
1
5
4
4
42
1
2
1
3
1
1
1
1
1
1
1
1
1
5
6
4 2
2
1
1
1
1
1
5
4
4
42
1
2
1
3
1
1
1
1
1
1
1
1
1
5
6
4
2
2
1
1
(a) If direction (−1, 0) was chosen.
2
2
1
1
1
1
1
5
4
4
42
1
2
1
3
1
1
1
1
1
1
1
1
1
5
6
4 2
2
1
1
1
1
1
5
4
4
4
2
2
1
1
1
1
1
1
1
2
1
2
1
3
1
1
1
1
1
1
1
1
1
5
6
4
2
2
1
1
1
(b) If direction (0, 1) was chosen.
Figure 4: Blue plays a SPREAD spread action at coordinate (6, 3).
© - University of Melbourne, 2023 4
Ending the Game
The game ends when one player successfully takes control of all tokens on the board. This player
is declared the winner. Note that a win can only occur as the result of a SPREAD action3 (see
Figure 5 for an example).
1
1
1
2
1
1
1
1
2
1
2
1
2
1
2
1
1
1
1
1
2
1
1
2
1
2
1
2
1
1
1
2
1
1
2
1
1
1
1
1
2
1
1
1
1
2
1
2
1
2
1
2
1
1
3
1
1
1
2
1
1
2
1
2
1
2
1
1
1
2
1
1
2
1
1
3
Figure 5: Blue plays a final SPREAD spread action to claim victory.
Alternatively, if there have been 343 turns without a winner being declared, the player with the
greatest total POWER4 is declared the winner, provided they lead on this metric by at least 2. If
no player leads by this amount, the game ends in a draw.
3Without this condition, technically Red would win when they SPAWN on their first move!
4This is computed by summing up the POWER of all cells controlled by a given player. For example, in Figure 1
(at the start of this document), Red has 15 total POWER, and Blue has 18 total POWER.
© - University of Melbourne, 2023 5


essay、essay代写