First of all, we must grasp a principle, the graphical interface and logic must be separated. There is nothing much to say about the graphical interface, let’s talk about the logic part. Write classes for chess pieces and abstract the characteristics of each chess piece, such as name, color, footwork, position, etc. It is also necessary to define a file format that describes the chessboard state for storage, reading, writing, and transmission. This can also be directly found in standard file formats, such as sgf. Also write a parser for this file format. Once you have these basic things written down, consider the next step.
Let’s also talk about the graphical interface. Don't pursue the realization of the entire chessboard in one step. To do it in layers, first write a control that can display pictures and zoom in and out, then extend it to vertical and horizontal lines, and then extend it to chess pieces that can be placed at intersections, etc., and implement it step by step. Loading the chessboard screen relies on The parser is loaded from a file. The graphical interface is only responsible for display and does not assume any logical functions.
The most important thing when writing software is to have a sense of hierarchy, not to be impatient, and to write layer by layer.
First of all, we must grasp a principle, the graphical interface and logic must be separated. There is nothing much to say about the graphical interface, let’s talk about the logic part. Write classes for chess pieces and abstract the characteristics of each chess piece, such as name, color, footwork, position, etc. It is also necessary to define a file format that describes the chessboard state for storage, reading, writing, and transmission. This can also be directly found in standard file formats, such as sgf. Also write a parser for this file format. Once you have these basic things written down, consider the next step.
Let’s also talk about the graphical interface. Don't pursue the realization of the entire chessboard in one step. To do it in layers, first write a control that can display pictures and zoom in and out, then extend it to vertical and horizontal lines, and then extend it to chess pieces that can be placed at intersections, etc., and implement it step by step. Loading the chessboard screen relies on The parser is loaded from a file. The graphical interface is only responsible for display and does not assume any logical functions.
The most important thing when writing software is to have a sense of hierarchy, not to be impatient, and to write layer by layer.
Abstract modeling of chess pieces is the most difficult
It is relatively simple to implement a graphical interface