blob: 08c329fd728553db58be410500c4f8602537e4de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
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 Q_SIGNALS to all its views
when something changes. Basically, the only difference between
this class and the more basic ReversiGame is that it sends Q_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: QWidget.
Contains: *QReversiGame (not owner)
FIXME: Enhance the view with timing information, clock, etc.
KReversi
The main class for the KReversi program
Contains: KActions
*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.
|