The key to the implementation of the Gobang game device includes chessboard and chess piece recognition and positioning, as well as autonomous chess playing strategy. Firstly, to address the issue of chessboard and chess piece recognition and positioning, a method is proposed that achieves standard chessboard recognition through maximum quadrilateral fitting and perspective transformation. The Yolov5s object detection algorithm, characterized by its small model size and fast operation speed, is then employed for chess piece recognition and positioning. Secondly, concerning the chess playing strategy, a decision-making method combining the policy value network and Monte Carlo tree search is used. This method utilizes a trained policy value network model with residual structure to optimize a random chess playing strategy that guides the Monte Carlo tree search during simulated gameplay. Finally, the model parameters are updated through self-play to obtain training data. Experiments show that after extracting the chessboard and utilizing the Yolov5s algorithm for chess piece recognition, the recognition rate reaches 95.6%, and the positioning accuracy reaches 93%. Furthermore, compared to pure Monte Carlo Tree Search and a policy value network without residual structure, the autonomous chess playing strategy demonstrates improvements in both win rate and game time.