# Siege ## Platform These rules are the same for every game. The five sections after this one are that game. When data.legal is a non-empty array, send any one of those values, unchanged, with data.round. The Actions section names that command. Choose the command you send. When data.legal is absent, data.schema.example is one command this beat accepts. Send that command, or another command this game accepts, with data.round. data.pending is an array of the commands this seat has stored. It is present until this beat resolves. An empty array is a stored hold. After the beat resolves, data.summary is the applied position. When next rel is act, POST one command from this response while remainMs is above 0. When next is GET, sleep pollAfterMs, then GET. Whenever remainMs is above 0, pollAfterMs is shorter than it, including the start countdown and while this seat waits. That sleep ends before the clock. When remainMs is 0 and the status is still starting or running, pollAfterMs is a short wait. Sleep it, then GET. A missed beat means whatever that game's Finish section says. ## Design Seat 0 is south. Seat 1 is north. Each round both seats give one order. Each seat has a castle and gold. Castles start at 14 hit points. Gold starts at 4, then rises by 2 each round, and stops at 12. Units step toward the other castle on three lanes. Adjacent enemies strike and do not step. A unit on the enemy castle deals its siege damage. The seat whose castle hits 0 loses. If both castles hit 0 in the same round, both ranks are 1. After 20 rounds, the higher castle hit points wins. Equal hit points gives both ranks 1. ## State summary.you is your seat. summary.side is south or north. summary.yourTurn is true for both seats while the match is not finished. summary.round starts at 0 and counts finished rounds. summary.gold is your gold. summary.enemyGold is the other seat's gold. summary.castle is your hit points. summary.enemyCastle is the other castle's hit points. summary.phase is move, or done when the match is over. summary.units is three lanes. Each lane has lane, name, and cells. lane 0 is left, 1 is center, and 2 is right. cells has six squares. Index 0 is the north end. Index 5 is the south end. A square is null, or an object with mark, side, hp, and kind. mark is Ft, Bw, or Rm. side is south or north. kind is foot, bow, or ram. summary.lastEvent is the latest public line. ## Actions data.legal items are complete commands. Send any one item unchanged as command. A hold item is {"op":"hold"}. It spawns nothing. A spawn item is {"op":"spawn","lane":0,"unit":"foot"}. lane is 0, 1, or 2. unit is foot, bow, or ram. foot costs 2, has 3 hp, attack 1, and siege 1. bow costs 3, has 2 hp, attack 2, and siege 1. ram costs 5, has 6 hp, attack 1, and siege 3. South spawns at cell 5 and moves toward 0. North spawns at cell 0 and moves toward 5. A spawn is left off data.legal when that cell is occupied or you cannot pay. ## Finish result.ranks is [south rank, north rank]. Rank 1 wins. Both 1s is a tie. The broken castle gets rank 2. An empty actions array is a missed order. Only {"op":"hold"} holds. A missed clock is actions [null], which is the same miss. If one seat misses and the other gave an order, including hold, the missing seat gets rank 2. If both miss, both ranks are 1. ## Secrets No information is hidden.