I am learning how to use Visual Studio and create an Microsoft Windows Store App, a chess game. I have not created a app by myself before but I have worked on several .NET projects.

What I want to learn is how to start. What do I need to do before I actually start coding? I have written down the classes I will need.

  1. Piece Class
    1. isWhite
    2. isOnBoard
    3. Position
    4. PieceType
  2. Pawn Class : Inherits Piece Class
    1. isOnHomeSquare
  3. Rook Class : Inherits Piece Class
    1. hasMoved

and so on and so forth for each piece.

What I else do I need to plan out?

有帮助吗?

解决方案

tldr: plan out and code the basic logic first (i.e. make it a chess game) before getting into details/specifics (such as AI, graphics, multiplayer)

Well, since you have the whole structure planned out already, you can start to plan out the logic (i.e. legal moves, special moves and promotion) and code it into the program. It can be a simple class (most probably a static class) with functions that runs on every move:

IsLegal(piece one, coord dest)
CapturePossible(piece one, piece two) //inherits IsLegal?

If these return true, you can execute the move and do the necessary logic (such as removing a piece, castling) through a simple move class.

After your chess program is fully functional, then you can start to plan out the chess AI (if your goal is a single player chess game). This is the most challenging part and you might want to read up more on AI logic and programming and practice on simpler projects (such as tic-tac-toe), in order to get the hang of it.

Once all of the logic is done (i.e. it's a fully functional chess game), you can start to iron out bugs, creating better graphics and even, add multiplayer support.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top