[0CTF/TCTF 2019 Finals] ###game

It is tictactoe-like game, only ip & port number is given.


When you enter the server, you can see the rules.



RuleThere are three types of boards in this game. big board: board1 medium board: board2 small board: board3 This game is a board game composed of nine big boards(board1), and each board1 consists nine medium boards(board2), and each board2 consists nine small boards(board3). In small board, the player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins this small board. And In medium board, the player who succeeds in winning three small boards in this medium board in a horizontal, vertical, or diagonal row wins this medium board. Same as big board. The format of your move is like 0,1,2,1,1,2 0,1 specifies which board2 in board1 you choose. 2,1 specifies which board3 in that board2 you choose. So this means that you place your mark in (0,1) of board1 and (2,1) of board2 and (1,2) of board3. Your move will indicate where your opponent has to play. And your opponent's move will also indicate where you have to play. For example, if your opponent's move is x1,y1,x2,y2,x3,y3, then you should place your mark in (x2,y2) of board1 and (x3,y3) of board2. If you were about to play in a finished board, you would then be allowed to play anywhere in upper board. Win 5 times in 40min to get the flag.



When you play the game several time, you can know some property.


1. AI's moves are deterministic.

2. AI is not that clever..


It is possible to win AI by some basic game theory algorithm such as minimax tree, however I don't want to waste my time to implement. So I choose another way to "hack" this problem.


I make a program such that two AI competes against each other. (get_winning_move.py) This program gives a winning path. After that, I just win 5 times XD(solver.py)


Since player always make first move in this game, there is possibility to occur an error while get_winning_move.py runs, but fortunately it doesn't.

'CTF > MISC + Coding' 카테고리의 다른 글

[zer0pts CTF 2022] MathHash  (0) 2022.03.22
[TSG 2021] Advanced Fisher  (2) 2021.10.05
[PlaidCTF 2019] Project Eulernt  (0) 2019.04.15
[2018 X-MAS CTF] Xⁿ-Mas  (0) 2018.12.19
[2018 X-MAS CTF] A Christmas Dilemma  (0) 2018.12.19
[2018 X-MAS CTF] The ultimate Christmas game  (0) 2018.12.19