It starts with six lines
You don't play the game here. You write the code that plays it. Below is an entire rock-paper-scissors strategy. Paste it into the editor on that screen and it runs.
var next = 2; // rock on the first turn
function onGameStart() {}
function onRoundStart() {}
function onTurnStart() {
return next; // 1 scissors · 2 rock · 3 paper
}
function onTurnEnd(result) {
next = result.opponentchoice % 3 + 1;
}
function onRoundEnd() {}
function onGameEnd() {}
Put this code in a battle
- LEVEL 1
- wins all 20 games
- LEVEL 2
- loses all 20 games
LEVEL 1 never looks at your previous move, so this strategy catches it every time. LEVEL 2 does the opposite: it reads the regularity and turns it back on you. So you rewrite. That is Code Battle.
Twenty games is 100 rounds and 10,000 turns. A test in the repository re-checks these numbers against the real rule engine.
Try it in rock-paper-scissors- Read the rules and the callback contract in the sample code.
- Implement your strategy, by hand or with help from an AI tool.
- Battle the AI, an online opponent or the Code Arena, then read the log and fix it.
A GAME is several ROUNDs, and a ROUND is several TURNs. Each TURN's choice decides the ROUND and the GAME. Anything you send to printLog() appears in the log area at the bottom of the screen.
Battle AI or online opponents with one strategy code
Available now. You can play right away without signing in.
Rock Scissors Paper Game
- Scissors win Paper, Rock wins Scissors, and Paper wins Rock.
- Choose one of the Scissors(1), Rock(2), or Paper(3) for each TURN, and gain 1 point if you win with Scissors, 2 points if you win with Rock and 3 points if you win with Paper.
Five in a Row (Omok) Game
- A game in which you put five consecutive stones in one direction of horizontal, vertical, or diagonal in 15x15 grid intersections.
- Each TURN receives the last coordinates of the opponent, and then determines my coordinates and returns.
Bulls and Cows Game
- The opponent and I each have their own 3 digits number, and it is a game to win by guessing the opponent's number first. If both sides guess the number at the same time, the larger number wins.
- Determine the opponent's number for each TURN, and receive the result that if the matching digits are in their right positions, they are 'bulls', if in different positions, they are 'cows'
Sutda Game
- You and your opponent will each receive 2 cards (Hwatu card), and it is a game where you win or lose with a combination of 2 cards.
- You get money when the game starts, you get 2 cards and 1 opponent card at the start of the round, and you have to choose raise or call or die on each turn.
Two strategy codes competing at developer events
Explore past qualifier screens used at SKP developer events from 2021 to 2023.
1:1 Fighting Tournament
- This page was created to support the code battle session during SK Planet's 2021 developer event.
- For each TURN, you select an punch_or_kick and an hitting_area(head, body, or leg), and if you win, you get points according to the punch_or_kick and hitting_area.
Code Baseball Classic
- This page was created to support the code battle session during SK Planet's 2022 developer event.
- It is a code battle game that stands for real baseball. There is a 3X3 strike zone, and every TURN you choose where to throw or where to hit, which will be a home run, a hit, a strike, and a ball according to the rules.
Number Cards Battle
- This page was created to support the code battle session during SK Planet's 2023 developer event.
- The gameplay is almost the same as Sutda. You are given two number cards each and can see one of your opponent's cards. This is a method in which two players bet against each other, and the side with the higher card pair takes the coins they bet on.