- You win a round when one of the boards has no stones of your opponent left, or when your opponent has no legal action.
- You win the match with more points than your opponent after the two
rounds (
2 per round won,1 per draw).
A higher resolution is required to access the IDE
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
Shobu is played on four small boards at once. Every turn you move two of your stones: a quiet move at home, then the same move somewhere else, where it can shove an enemy stone off the edge. Push all four of your opponent's stones off any one board to win.
Shobu was designed by Manolis Vranas and Jamie Sajdak of Seesaw Games, and published by Smirk & Laughter in 2019. This adaptation adds a two-round match, a pie rule and a turn limit.
Source code of the referee and viewer: github.com/Waffle3z/CG-Shobu
Rules
The boards
There are four 4×4 boards, given to you as one 8×8 grid of
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ||
| 0 | w | w | w | w | w | w | w | w | white's home boards |
| 1 | . | . | . | . | . | . | . | . | |
| 2 | . | . | . | . | . | . | . | . | |
| 3 | b | b | b | b | b | b | b | b | |
| 4 | w | w | w | w | w | w | w | w | black's home boards |
| 5 | . | . | . | . | . | . | . | . | |
| 6 | . | . | . | . | . | . | . | . | |
| 7 | b | b | b | b | b | b | b | b | |
| dark boards | light boards | ||||||||
- The left column of boards (x < 4) is dark, the right column (x ≥ 4) is light.
- Black's home boards are the two bottom ones (y ≥ 4), white's the two top ones (y < 4).
- Each player starts with four stones on every board: black on row 3 of each board (y = 3 and 7), white on row 0 (y = 0 and 4).
- Stones never leave their board, except by being pushed off it.
A turn: two moves
Black moves first. On your turn you make a passive move and then an aggressive move with the same displacement.
- Passive move. Pick one of your stones on one of your two home
boards and move it
1 or2 squares in any of the8 directions (orthogonal or diagonal). Every square it passes over or lands on must be empty: a passive move never touches another stone. - Aggressive move. Then move one of your stones on a board of the
other color (dark ↔ light), on your side or your opponent's, by exactly the
same direction and distance. This stone may push:
- it may push one enemy stone that is in its path or on its landing square;
- the pushed stone ends up one square past where your stone lands; if that square is off the board, the stone is removed from the game;
- your stone may not pass over or land on one of your own stones, push two stones, or push a stone onto another stone.
Both moves are made in one turn and given as one action. An action is legal only when both of its moves are legal; the list of legal actions is in your input.
End of a round
- You win the round as soon as one board has no stones of your opponent.
- A player with no legal action loses the round.
- A round ends after
110 turns in total (a turn spent onSWAP does not count). If the110 th turn empties an enemy board, its player wins; otherwise the round is a draw.
Pie rule
Moving first can be an advantage, and some first actions are much stronger than others. So in every
round, on white's first turn, white may answer
- The player who swapped now plays black, with black's first action already on the board.
- The stones do not change: they stay where they are and keep their letters in the input. The
player who swapped now moves the
b stones and receives myColor =0 . - The other player now plays white and plays next.
- So black's best first action is a balanced one: a first action that is too strong just gets taken by the opponent.
Match
A match is two rounds: you start as black (moving first) in one round and as white in
the other, and the pie rule applies in both. A won round is worth
A timeout or an invalid action loses the whole match, including any round you already won.
- You lose a round when your opponent wins it.
- You lose the whole match if your program does not respond in time, or outputs anything that is not one of the listed legal actions.
Example
- First turn. Black plays
3 7 4 3 0 -2 . Passive: the stone on (3,7), on black's dark home board, moves two squares up to (3,5) over empty squares. Aggressive: the stone on (4,3), on white's light board (light, so the other color), moves two squares up to (4,1). Nothing is pushed: white's stone on (4,0) is beyond the landing square. - Push off. Later, with that black stone still on (4,1) and the white stone
on (4,0), an aggressive move of
0 -1 (one up) lands on (4,0) and pushes the white stone to (4,-1): off the board, so it is removed. Here black plays3 7 4 1 0 -1 :
- Illegal push. A black stone on (4,3) cannot move
0 -1 if white stones stand on both (4,2) and (4,1): that would push two stones in a row.
The input white receives in round
wwwwwwww
....b...
........
bbbb.bbb
wwwwwwww
...b....
........
bbb.bbbb
3 7 4 3 0 -2
211
0 0 4 0 1 1
0 0 5 0 1 1
0 0 6 0 1 1
(... 207 more legal actions ...)
SWAP
Game Input/Output
Next
Next line: your opponent's last action as px py ax ay dx dy,
Next line: actionCount, the number of legal actions.
Next actionCount lines: a legal action px py ax ay dx dy. On white's first turn of a round the last of these lines is
Or, on white's first turn of a round only:
Response time for one turn ≤
actionCount ≤
Leagues
Each league has a boss to beat:
- Wood 4: a greedy bot. It takes a winning action if it sees one, otherwise the action that removes the most material, and never looks at your reply.
- Wood 3: Monte Carlo tree search with short random playouts. It also recognizes positions it has fully solved.
- Wood 2: a plain three-turn-deep minimax with alpha-beta pruning, counting stones.
The bosses never swap. Wood 1 is the top league.
A higher resolution is required to access the IDE