|
|
|
This file describes the overall design of KReversi. Some of the
|
|
|
|
classes have different names at this point, but that is indicated by a
|
|
|
|
(now: XXX) tag. These names will be changed when the KDE project has
|
|
|
|
converted from CVS to Subversion since Subversion has so much better
|
|
|
|
support for renaming files and directories.
|
|
|
|
|
|
|
|
Almost all of the classes hold more members than are mentioned here,
|
|
|
|
but those are implementation details and would only obscure the
|
|
|
|
overall picture. This file is only to give a helicopter view of the
|
|
|
|
program, not to serve as detailed documentation.
|
|
|
|
|
|
|
|
|
|
|
|
Classes
|
|
|
|
=======
|
|
|
|
|
|
|
|
Class Diagram (See details below)
|
|
|
|
-------------
|
|
|
|
|
|
|
|
KReversi----------------------------------------------+
|
|
|
|
| | +--------------------------------+ |
|
|
|
|
| +-----------------+ | |
|
|
|
|
| | | |
|
|
|
|
| v v v
|
|
|
|
| QReversiGameView Engine StatusBar
|
|
|
|
| | | | (shows whose turn it is)
|
|
|
|
| +- - - - - - - + | +----------+
|
|
|
|
| | v v
|
|
|
|
| +- - - -QReversiBoardView Other widgets
|
|
|
|
| | | (movelist, score)
|
|
|
|
v v v
|
|
|
|
QReversiGame
|
|
|
|
X
|
|
|
|
v
|
|
|
|
Game
|
|
|
|
I +=========+
|
|
|
|
I I
|
|
|
|
v v
|
|
|
|
Position Move[]
|
|
|
|
|
|
|
|
|
|
|
|
Legend:
|
|
|
|
XXXXXXXX> Inherits
|
|
|
|
========> Contains
|
|
|
|
--------> Ownership pointer
|
|
|
|
- - - - > Reference pointer
|
|
|
|
|
|
|
|
|
|
|
|
Details
|
|
|
|
-------
|
|
|
|
|
|
|
|
ReversiPosition (now: Position)
|
|
|
|
Holds a Reversi position. This is the object that implements the
|
|
|
|
Reversi rules.
|
|
|
|
|
|
|
|
|
|
|
|
ReversiMove (now: Move)
|
|
|
|
A move in a Reversi game.
|
|
|
|
|
|
|
|
|
|
|
|
ReversiGame (now: Game)
|
|
|
|
Holds all the moves of the game being played.
|
|
|
|
Contains: ReversiPosition Holds the current position.
|
|
|
|
Move[60]
|
|
|
|
FIXME: Remove the ReversiPosition and let it be implicit?
|
|
|
|
FIXME: Implement variations (later)
|
|
|
|
|
|
|
|
|
|
|
|
Engine
|
|
|
|
Can generate a move, given a ReversiPosition.
|
|
|
|
|
|
|
|
|
|
|
|
QReversiGame
|
|
|
|
The "document" for KReversi.
|
|
|
|
Handles a game being played and sends signals to all its views
|
|
|
|
when something changes. Basically, the only difference between
|
|
|
|
this class and the more basic ReversiGame is that it sends signals
|
|
|
|
to the views.
|
|
|
|
Inherits: ReversiGame The actual game being played
|
|
|
|
|
|
|
|
|
|
|
|
QReversiGameView (status: PLANNED)
|
|
|
|
|
|
|
|
Shows a view of a complete game. Currently this comprises a board
|
|
|
|
view, a listbox with a list of the moves, two status widgets
|
|
|
|
showing the current score.
|
|
|
|
|
|
|
|
Contains: *QReversiBoardView
|
|
|
|
*QListBox
|
|
|
|
*StatusWidget (two of them)
|
|
|
|
|
|
|
|
|
|
|
|
QReversiBoardView
|
|
|
|
|
|
|
|
A view for a Reversi board. The rest of the game view is
|
|
|
|
implemented in the class QReversiGameView.
|
|
|
|
|
|
|
|
Inherits: TQWidget.
|
|
|
|
Contains: *QReversiGame (not owner)
|
|
|
|
|
|
|
|
FIXME: Enhance the view with timing information, clock, etc.
|
|
|
|
|
|
|
|
|
|
|
|
KReversi
|
|
|
|
The main class for the KReversi program
|
|
|
|
Contains: TDEActions
|
|
|
|
*QReversiGame (owner)
|
|
|
|
*KReversiGameView (owner)
|
|
|
|
*Engine (owner)
|
|
|
|
Statusbar
|
|
|
|
|
|
|
|
FIXME: Let the class also own two players.
|
|
|
|
|
|
|
|
|
|
|
|
EngineView (status: PLANNED)
|
|
|
|
View of the internal thought processes of an Engine (trace, etc).
|
|
|
|
|
|
|
|
|
|
|
|
Some notes
|
|
|
|
----------
|
|
|
|
|
|
|
|
* KReversi follows the Model/View principle strictly.
|