Answer the question
In order to leave comments, you need to log in
Have I drawn the plan for the OOP game of checkers correctly?
I am learning OOP. I wanted to try to write a game of checkers for two in javascript. And I threw on the xmind program, so to speak, the architecture of the game. I would like to know your opinion
Answer the question
In order to leave comments, you need to log in
Since you are studying OOP, maybe make the lady a child class that inherits something from a simple checker, but overrides some properties and methods?
The above scheme does not take into account the possibility of chains of “attacking” moves. Incl. with transformation into a lady in the process of gluttony)
You can enter the essence of the "move". Then you can add the moves to the array of the game. Save the game, play it. Walk over! )
Length in time: if done beautifully, there will be animations of checkers transition between cells. At this time, you can not interfere, for example. This is probably an over-complication, though.
The board will need initialization methods, maybe loading a position, evaluating a position.
oops need abstractions!
on the figure! (today they are checkers, but tomorrow they will need go)
on the move! on the desk! (checkers are also hundred-celled)
to coordinates - so that you can go to spherical ones!
and cover everything with interfaces, for the glory of sotho ... oops!
Overall, not bad. But I would do it differently.
1. Do not display properties separately in the schema . It is not entirely clear what you are changing in the methods. What are the conditions for change. What settings. And so on. Properties are needed more for database design.
For example, it's better like this:
Hang a cage
- color (string(6))
2. Checker is an integral part of the board . Therefore, the modification of checkers will be from the essence of the board.
For example, you can see how any API is built. Everywhere there are methods and a description of what they do. What parameters are accepted. What result is returned. What type and so on. Go to the VK API and you will immediately understand. You need to make some kind of API.
otherwise ok)
I am learning OOP. I wanted to try to write a game of checkers
Cell State{
White Checker,
Black Checker,
White Checker King, Black Checker
King,
No Checkers
} Game
State {
Start,
Draw,
White Move,
Black Move,
Game Over,
}
Variables:
"Board" type: Checker State
"Stage" type:
GameState "Player1"
"Player2"
Methods:
SetStage(GameState) //Here you can use the "State" pattern
OnStart()
-InitializePlayers();
OnPairing()
-SetPlayersColors()
-FillBoard()
OnMove(Player, X, Y)
-HereMoveLogic (deleting chips, moving, etc.)
OnGameOver() -Calculate and
outputResults()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question