SK Planet Number Cards Battle
This match is a 1:1 match between Player 1 and Player 2's code, and the programming language is JAVASCRIPT.
After checking the game rules, writing the codes for Player 1 and Player 2, click the Start Game button to start the match.
1 Game consists of up to 99 Sets, and in 1 Set, the Round is repeated until all coins are used up. 1 Round means one hand, and Turns are repeated until both players' betting coins are equal or until one side gives up.
1 Game has a time limit of 20 seconds. If 20 seconds have passed at the end of the Set, the Game ends without proceeding further with the Set, and the player who wins more Rounds at that time wins the Game.
Code battle's lifecycle callback functions are onGameStart, onSetStart, onRoundStart, onTurnStart, onRoundEnd, onSetEnd, onGameEnd, and you have to implement your own logic on each function.(There is no onTurnEnd.)
Building a basic strategy of the game, analyzing your opponent's pattern and returning the best choice at onTurnStart is the key to winning.
(Any attempt to cheat, such as affecting the opponent's code or delaying time, will result in defeat.)
The game rules

Player 1

Player 2

Player1 TURN Player2
-1 -1
0
0
0
0
ROUND
Player1Player2
0
0
SET (GAME)
Player1Player2
0 (0) 0 (0)
The entire game log is displayed in the area below.
If you or the opponent's screen is not visible, the communication speed will be slower.