summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/oyatzee/oyatzee.cpp49
-rw-r--r--noncore/games/oyatzee/oyatzee.h8
2 files changed, 43 insertions, 14 deletions
diff --git a/noncore/games/oyatzee/oyatzee.cpp b/noncore/games/oyatzee/oyatzee.cpp
index 6228a8f..d0e220c 100644
--- a/noncore/games/oyatzee/oyatzee.cpp
+++ b/noncore/games/oyatzee/oyatzee.cpp
@@ -1,179 +1,179 @@
1#include "oyatzee.h" 1#include "oyatzee.h"
2 2
3#include <qpe/applnk.h> 3#include <qpe/applnk.h>
4#include <qpe/global.h> 4#include <qpe/global.h>
5#include <qpe/filemanager.h> 5#include <qpe/filemanager.h>
6#include <qpe/resource.h> 6#include <qpe/resource.h>
7#include <qpe/config.h> 7#include <qpe/config.h>
8 8
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qmessagebox.h> 10#include <qmessagebox.h>
11#include <qcombobox.h> 11#include <qcombobox.h>
12#include <qdatetime.h> 12#include <qdatetime.h>
13#include <qfileinfo.h> 13#include <qfileinfo.h>
14#include <qfile.h> 14#include <qfile.h>
15#include <qdir.h> 15#include <qdir.h>
16#include <qiconset.h> 16#include <qiconset.h>
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qlineedit.h> 18#include <qlineedit.h>
19#include <qpushbutton.h> 19#include <qpushbutton.h>
20#include <qtextstream.h> 20#include <qtextstream.h>
21#include <qtimer.h> 21#include <qtimer.h>
22#include <qpe/qpetoolbar.h> 22#include <qpe/qpetoolbar.h>
23#include <qtoolbutton.h> 23#include <qtoolbutton.h>
24#include <qvbox.h> 24#include <qvbox.h>
25#include <qwidgetstack.h> 25#include <qwidgetstack.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qregexp.h> 28#include <qregexp.h>
29 29
30#include <stdlib.h> 30#include <stdlib.h>
31#include <unistd.h> 31#include <unistd.h>
32#include <pwd.h> 32#include <pwd.h>
33#include <sys/types.h> 33#include <sys/types.h>
34 34
35OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl ) 35OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl )
36{ 36{
37 QWidget *thing = new QWidget( this ); 37 QWidget *thing = new QWidget( this );
38 setCentralWidget( thing ); 38 setCentralWidget( thing );
39 39
40 40
41 setPlayerNumber( 4 ); 41 setPlayerNumber( 4 );
42 setRoundsNumber( 1 ); 42 setRoundsNumber( 1 );
43 43
44 playerList ps; 44 playerList ps;
45 ps.append( new Player( "Carsten" ) ); 45 ps.append( new Player( "Carsten" ) );
46 ps.append( new Player( "Julia" ) ); 46 ps.append( new Player( "Julia" ) );
47 ps.append( new Player( "Christine" ) ); 47 ps.append( new Player( "Christine" ) );
48 ps.append( new Player( "Stephan" ) ); 48 ps.append( new Player( "Stephan" ) );
49 49
50 Game *g = new Game( ps ); 50 //X Game *g = new Game( ps );
51 51 //X
52 52
53 QVBoxLayout *vbox = new QVBoxLayout( thing ); 53 QVBoxLayout *vbox = new QVBoxLayout( thing );
54 54
55 sb = new Scoreboard( ps, thing , "sb" ); 55 sb = new Scoreboard( ps, thing , "sb" );
56 dw = new DiceWidget( thing , "dw" ); 56 dw = new DiceWidget( thing , "dw" );
57 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) ); 57 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) );
58 58
59 vbox->addWidget( sb ); 59 vbox->addWidget( sb );
60 vbox->addWidget( dw ); 60 vbox->addWidget( dw );
61} 61}
62 62
63OYatzee::~OYatzee() 63OYatzee::~OYatzee()
64{ 64{
65} 65}
66 66
67void OYatzee::detectPosibilities() 67void OYatzee::detectPosibilities()
68{ 68{
69 posibilities.clear(); 69 posibilities.clear();
70 qDebug( "running detectPosibilities()" ); 70 qDebug( "running detectPosibilities()" );
71 71
72 Dice *d = dw->diceList.first(); 72 Dice *d = dw->diceList.first();
73 73
74 QValueListInt numbers; 74 QValueListInt numbers;
75 75
76 for ( ; d != 0 ; d = dw->diceList.next() ) 76 for ( ; d != 0 ; d = dw->diceList.next() )
77 { 77 {
78 numbers.append( d->Value ); 78 numbers.append( d->Value );
79 } 79 }
80 80
81 //the 6 numbers 81 //the 6 numbers
82 QValueListInt::Iterator it; 82 QValueListInt::Iterator it;
83 83
84 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6 84 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6
85 { 85 {
86 bool cont = false; 86 bool cont = false;
87 it = numbers.begin(); 87 it = numbers.begin();
88 for ( ; it != numbers.end() ; ++it ) 88 for ( ; it != numbers.end() ; ++it )
89 { 89 {
90 if ( cont ) 90 if ( cont )
91 continue; 91 continue;
92 92
93 if ( numbers.find( i ) != numbers.end() ) 93 if ( numbers.find( i ) != numbers.end() )
94 { 94 {
95 posibilities.append( i ); 95 posibilities.append( i );
96 cont = true; 96 cont = true;
97 } 97 }
98 } 98 }
99 } 99 }
100 100
101 101
102 //3er, 4er, Yatzee 102 //3er, 4er, Yatzee
103 it = numbers.begin(); 103 it = numbers.begin();
104 int count; 104 int count;
105 int temp; 105 int temp;
106 int countFH = 0; //for the full-house-check 106 int countFH = 0; //for the full-house-check
107 107
108 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6 at least 3 times 108 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6 at least 3 times
109 { 109 {
110 count = 0; 110 count = 0;
111 temp = 0; 111 temp = 0;
112 it = numbers.begin(); 112 it = numbers.begin();
113 for ( ; it != numbers.end() ; ++it ) 113 for ( ; it != numbers.end() ; ++it )
114 { 114 {
115 if ( *it == i ) 115 if ( *it == i )
116 { 116 {
117 count++; 117 count++;
118 temp++; 118 temp++;
119 } 119 }
120 if ( temp == 2 ) 120 if ( temp == 2 )
121 countFH = temp; 121 countFH = temp;
122 } 122 }
123 123
124 if ( count >= 3 ) 124 if ( count >= 3 )
125 { 125 {
126 posibilities.append( 7 ); 126 posibilities.append( 7 );
127 127
128 //now we check if it is a full house 128 //now we check if it is a full house
129 if ( count == 3 && countFH == 2 ) //aka Full House 129 if ( count == 3 && countFH == 2 ) //aka Full House
130 posibilities.append( 9 ); 130 posibilities.append( 9 );
131 } 131 }
132 if ( count >= 4 ) 132 if ( count >= 4 )
133 posibilities.append( 8 ); 133 posibilities.append( 8 );
134 if ( count == 5 ) //Yatzee 134 if ( count == 5 ) //Yatzee
135 posibilities.append( 12 ); 135 posibilities.append( 12 );
136 } 136 }
137 137
138 //S-Straight 138 //S-Straight
139 if ( numbers.find( 3 ) != numbers.end() && numbers.find( 4 ) != numbers.end() ) 139 if ( numbers.find( 3 ) != numbers.end() && numbers.find( 4 ) != numbers.end() )
140 { 140 {
141 bool isLong = false; 141 bool isLong = false;
142 bool isShort = true; 142 bool isShort = true;
143 //L-Straight 143 //L-Straight
144 if ( numbers.find( 2 ) != numbers.end() && numbers.find( 5 ) != numbers.end() ) 144 if ( numbers.find( 2 ) != numbers.end() && numbers.find( 5 ) != numbers.end() )
145 { 145 {
146 isShort = true; 146 isShort = true;
147 147
148 //12345 or 23456 148 //12345 or 23456
149 if ( numbers.find( 1 ) != numbers.end() || numbers.find( 6) != numbers.end() ) 149 if ( numbers.find( 1 ) != numbers.end() || numbers.find( 6) != numbers.end() )
150 isLong = true; 150 isLong = true;
151 } 151 }
152 //1234 152 //1234
153 if ( numbers.find( 1 ) != numbers.end() && numbers.find( 2 ) != numbers.end() ) 153 if ( numbers.find( 1 ) != numbers.end() && numbers.find( 2 ) != numbers.end() )
154 isShort = true; 154 isShort = true;
155 //3456 155 //3456
156 if ( numbers.find( 5 ) != numbers.end() && numbers.find( 6 ) != numbers.end() ) 156 if ( numbers.find( 5 ) != numbers.end() && numbers.find( 6 ) != numbers.end() )
157 isShort = true; 157 isShort = true;
158 158
159 if ( isShort ) 159 if ( isShort )
160 posibilities.append( 10 ); 160 posibilities.append( 10 );
161 if ( isLong ) 161 if ( isLong )
162 posibilities.append( 11 ); 162 posibilities.append( 11 );
163 } 163 }
164 164
165 posibilities.append( 13 ); //Chance, well, this is allways possible 165 posibilities.append( 13 ); //Chance, well, this is allways possible
166 166
167 displayPossibilites(); 167 displayPossibilites();
168} 168}
169 169
170void OYatzee::displayPossibilites() 170void OYatzee::displayPossibilites()
171{ 171{
172 for ( QValueListInt::Iterator it = posibilities.begin() ; it != posibilities.end(); ++it ) 172 for ( QValueListInt::Iterator it = posibilities.begin() ; it != posibilities.end(); ++it )
173 { 173 {
174 qDebug( QString::number( *it ) ); 174 qDebug( QString::number( *it ) );
175 switch ( *it ) 175 switch ( *it )
176 { 176 {
177 case Ones: 177 case Ones:
178 qDebug( "1er" ); 178 qDebug( "1er" );
179 break; 179 break;
@@ -279,179 +279,206 @@ void Scoreboard::createResultboards(const int num)
279 } 279 }
280} 280}
281 281
282void Scoreboard::paintEvent( QPaintEvent * ) 282void Scoreboard::paintEvent( QPaintEvent * )
283{ 283{
284 QPainter p; 284 QPainter p;
285 p.begin( this ); 285 p.begin( this );
286 286
287 p.drawRect( 0,0, this->width() , this->height() ); 287 p.drawRect( 0,0, this->width() , this->height() );
288} 288}
289 289
290/* 290/*
291 * Dice 291 * Dice
292 */ 292 */
293Dice::Dice( QWidget *parent , const char *name ) : QFrame( parent , name ) 293Dice::Dice( QWidget *parent , const char *name ) : QFrame( parent , name )
294{ 294{
295 QTime t = QTime::currentTime(); // set random seed 295 QTime t = QTime::currentTime(); // set random seed
296 srand(t.hour()*12+t.minute()*60+t.second()*60); 296 srand(t.hour()*12+t.minute()*60+t.second()*60);
297 297
298 connect( this , SIGNAL( selected() ), this , SLOT( slotSelected() ) ); 298 connect( this , SIGNAL( selected() ), this , SLOT( slotSelected() ) );
299} 299}
300 300
301void Dice::slotSelected() 301void Dice::slotSelected()
302{ 302{
303 if ( isSelected ) 303 if ( isSelected )
304 isSelected = false; 304 isSelected = false;
305 else isSelected = true; 305 else isSelected = true;
306 306
307 update(); 307 update();
308} 308}
309 309
310int Dice::hasValue() 310int Dice::hasValue()
311{ 311{
312 return Value; 312 return Value;
313} 313}
314 314
315void Dice::roll() 315void Dice::roll()
316{ 316{
317 Value = rand()%6; 317 Value = rand()%6;
318 Value += 1; 318 Value += 1;
319 319
320 update(); 320 update();
321} 321}
322 322
323void Dice::mousePressEvent( QMouseEvent* /*e*/ ) 323void Dice::mousePressEvent( QMouseEvent* /*e*/ )
324{ 324{
325 emit selected(); 325 emit selected();
326} 326}
327 327
328void Dice::paintEvent( QPaintEvent * ) 328void Dice::paintEvent( QPaintEvent * )
329{ 329{
330 QPainter p; 330 QPainter p;
331 p.begin( this ); 331 p.begin( this );
332 332
333 p.drawRect( 0,0, this->width() , this->height() ); 333 p.drawRect( 0,0, this->width() , this->height() );
334 334
335 if ( isSelected ) 335 if ( isSelected )
336 p.drawRect( 20,20, 10,10 ); 336 p.drawRect( 20,20, 10,10 );
337 337
338 paintNumber( &p ); 338 paintNumber( &p );
339} 339}
340 340
341void Dice::paintNumber( QPainter *p ) 341void Dice::paintNumber( QPainter *p )
342{ 342{
343 switch ( Value ) 343 switch ( Value )
344 { 344 {
345 case 1: 345 case 1:
346 p->drawText( 10,10,"1"); 346 p->drawText( 10,10,"1");
347 break; 347 break;
348 case 2: 348 case 2:
349 p->drawText( 10,10,"2"); 349 p->drawText( 10,10,"2");
350 break; 350 break;
351 case 3: 351 case 3:
352 p->drawText( 10,10,"3"); 352 p->drawText( 10,10,"3");
353 break; 353 break;
354 case 4: 354 case 4:
355 p->drawText( 10,10,"4"); 355 p->drawText( 10,10,"4");
356 break; 356 break;
357 case 5: 357 case 5:
358 p->drawText( 10,10,"5"); 358 p->drawText( 10,10,"5");
359 break; 359 break;
360 case 6: 360 case 6:
361 p->drawText( 10,10,"6"); 361 p->drawText( 10,10,"6");
362 break; 362 break;
363 } 363 }
364} 364}
365 365
366/* 366/*
367 * DiceWidget 367 * DiceWidget
368 */ 368 */
369DiceWidget::DiceWidget( QWidget *parent , const char *name ) : QWidget( parent , name ) 369DiceWidget::DiceWidget( QWidget *parent , const char *name ) : QWidget( parent , name )
370{ 370{
371 rollButton = new QPushButton( tr( "Roll" ) , this ) ; 371 rollButton = new QPushButton( tr( "Roll" ) , this ) ;
372 372
373 for ( int i = 0 ; i < 5 ; i++ ) 373 for ( int i = 0 ; i < 5 ; i++ )
374 { 374 {
375 //appending the 5 dices of the game 375 //appending the 5 dices of the game
376 diceList.append( new Dice( this, "wuerfel" ) ); 376 diceList.append( new Dice( this, "wuerfel" ) );
377 } 377 }
378 378
379 QHBoxLayout *hbox = new QHBoxLayout( this ); 379 QHBoxLayout *hbox = new QHBoxLayout( this );
380 380
381 Dice *d = diceList.first(); 381 Dice *d = diceList.first();
382 382
383 for ( ; d != 0 ; d = diceList.next() ) 383 for ( ; d != 0 ; d = diceList.next() )
384 { 384 {
385 hbox->addWidget( d ); 385 hbox->addWidget( d );
386 } 386 }
387 387
388 hbox->addWidget( rollButton ); 388 hbox->addWidget( rollButton );
389} 389}
390 390
391/* 391/*
392 * Player 392 * Player
393 */ 393 */
394Player::Player( QString name ) 394Player::Player( QString name )
395{ 395{
396 playerName = name; 396 playerName = name;
397} 397}
398 398
399 399
400/* 400/*
401 * Board 401 * Board
402 */ 402 */
403Board::Board( QWidget *parent , const char* name ) : QWidget ( parent , name ) 403Board::Board( QWidget *parent , const char* name ) : QWidget ( parent , name )
404{ 404{
405} 405}
406 406
407void Board::paintEvent( QPaintEvent* )
408{
409 QPainter p;
410 p.begin( this );
411
412 p.drawRect( 0,0, this->width() , this->height() );
413}
414
415/* 407/*
416 * Resultboard 408 * Resultboard
417 */ 409 */
418 410
419Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name ) 411Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name )
420{ 412{
421 pName = playerName; 413 pName = playerName;
422} 414}
423 415
424void Resultboard::paintEvent( QPaintEvent* ) 416void Resultboard::paintEvent( QPaintEvent* )
425{ 417{
426 QPainter p; 418 QPainter p;
427 p.begin( this ); 419 p.begin( this );
428 420
429 p.drawText( 10,10, pName ); 421 p.drawText( 10,10, pName );
430 p.drawRect( 0,0, this->width() , this->height() ); 422 p.drawRect( 0,0, this->width() , this->height() );
431} 423}
432 424
433/* 425/*
434 * Possibilityboard 426 * Possibilityboard
435 */ 427 */
436 428
437Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name ) 429Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name )
438{ 430{
439} 431}
440 432
441void Possibilityboard::paintEvent( QPaintEvent* ) 433void Possibilityboard::paintEvent( QPaintEvent* )
442{ 434{
443 QPainter p; 435 QPainter p;
444 p.begin( this ); 436 p.begin( this );
445 437
446 p.drawRect( 0,0, this->width() , this->height() ); 438 const int cell_width = this->width();
439 const int h = this->height();
440 const int cell_height = h/17;
441
442 QStringList begriffe;
443 begriffe.append( "1er" );
444 begriffe.append( "2er" );
445 begriffe.append( "3er" );
446 begriffe.append( "4er" );
447 begriffe.append( "5er" );
448 begriffe.append( "6er" );
449 begriffe.append( "Total" );
450 begriffe.append( "Bonus" );
451 begriffe.append( "3oaK" );
452 begriffe.append( "4oaK" );
453 begriffe.append( "Full House" );
454 begriffe.append( "Short S" );
455 begriffe.append( "Long S" );
456 begriffe.append( "Yatzee!" );
457 begriffe.append( "Chance" );
458 begriffe.append( "Score" );
459
460 QStringList::Iterator it = begriffe.begin();
461
462 for ( int i = 1 ; i < 18 ; ++i )
463 {
464 p.drawRect( 0 , i*cell_height , cell_width , cell_height );
465 p.drawText( 0 , i*cell_height , cell_width , cell_height , Qt::AlignCenter , *it );
466 ++it;
467 }
447} 468}
448 469
449/* 470/*
450 * Game 471 * Game
451 */ 472 */
452 473
453Game::Game( playerList pla ) 474Game::Game( playerList pla )
454{ 475{
455 players = pla; 476 players = pla;
456} 477}
457 478
479void Game::startGame()
480{}
481
482void Game::stopGame()
483{}
484
diff --git a/noncore/games/oyatzee/oyatzee.h b/noncore/games/oyatzee/oyatzee.h
index dd996ee..1074f1d 100644
--- a/noncore/games/oyatzee/oyatzee.h
+++ b/noncore/games/oyatzee/oyatzee.h
@@ -1,172 +1,174 @@
1#ifndef WORDGAME_H 1#ifndef WORDGAME_H
2#define WORDGAME_H 2#define WORDGAME_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qlist.h> 6#include <qlist.h>
7 7
8#include <stdlib.h> // rand() function 8#include <stdlib.h> // rand() function
9#include <qdatetime.h> // seed for rand() 9#include <qdatetime.h> // seed for rand()
10 10
11class Dice; 11class Dice;
12class Game; 12class Game;
13class Scoreboard; 13class Scoreboard;
14class DiceWidget; 14class DiceWidget;
15class Resultboard; 15class Resultboard;
16class Player; 16class Player;
17 17
18typedef QList<Dice> dicesList; 18typedef QList<Dice> dicesList;
19typedef QList<Resultboard> resultboardList; 19typedef QList<Resultboard> resultboardList;
20typedef QValueList<int> QValueListInt; 20typedef QValueList<int> QValueListInt;
21typedef QList<Player> playerList; 21typedef QList<Player> playerList;
22 22
23class OYatzee : public QMainWindow { 23class OYatzee : public QMainWindow {
24 Q_OBJECT 24 Q_OBJECT
25 public: 25 public:
26 OYatzee( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 26 OYatzee( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
27 ~OYatzee(); 27 ~OYatzee();
28 28
29 Game *g; 29 Game *g;
30 DiceWidget *dw; 30 DiceWidget *dw;
31 Scoreboard *sb; 31 Scoreboard *sb;
32 32
33 QValueListInt posibilities; 33 QValueListInt posibilities;
34 34
35 void setPlayerNumber( const int num ); 35 void setPlayerNumber( const int num );
36 void setRoundsNumber( const int num ); 36 void setRoundsNumber( const int num );
37 37
38 enum { 38 enum {
39 Ones=1, 39 Ones=1,
40 Twos = 2, 40 Twos = 2,
41 Threes = 3, 41 Threes = 3,
42 Fours = 4, 42 Fours = 4,
43 Fives = 5, 43 Fives = 5,
44 Sixes = 6, 44 Sixes = 6,
45 ThreeOfAKind = 7, //12444 45 ThreeOfAKind = 7, //12444
46 FourOfAKind = 8, //14444 46 FourOfAKind = 8, //14444
47 FullHouse = 9, //22555 47 FullHouse = 9, //22555
48 SStraight = 10, //13456 48 SStraight = 10, //13456
49 LStraight = 11, //12345 49 LStraight = 11, //12345
50 Yatzee = 12, //55555 50 Yatzee = 12, //55555
51 Chance = 13}; 51 Chance = 13};
52 52
53 public slots: 53 public slots:
54 void slotStartGame(); 54 void slotStartGame();
55 void slotRollDices(); 55 void slotRollDices();
56 56
57 private: 57 private:
58 int numOfPlayers; 58 int numOfPlayers;
59 int numOfRounds; 59 int numOfRounds;
60 60
61 /* 61 /*
62 * Check what posibilities the player currently has 62 * Check what posibilities the player currently has
63 */ 63 */
64 void detectPosibilities(); 64 void detectPosibilities();
65 void displayPossibilites(); 65 void displayPossibilites();
66 66
67}; 67};
68 68
69class Dice : public QFrame 69class Dice : public QFrame
70{ 70{
71 Q_OBJECT 71 Q_OBJECT
72 public: 72 public:
73 Dice( QWidget* parent = 0, const char* name = 0 ); 73 Dice( QWidget* parent = 0, const char* name = 0 );
74 74
75 int Value; 75 int Value;
76 bool isSelected; 76 bool isSelected;
77 77
78 int hasValue(); 78 int hasValue();
79 void roll(); 79 void roll();
80 virtual void mousePressEvent( QMouseEvent* ); 80 virtual void mousePressEvent( QMouseEvent* );
81 81
82 private slots: 82 private slots:
83 void slotSelected(); 83 void slotSelected();
84 84
85 signals: 85 signals:
86 void selected(); 86 void selected();
87 87
88 protected: 88 protected:
89 void paintEvent( QPaintEvent *e ); 89 void paintEvent( QPaintEvent *e );
90 void paintNumber( QPainter *p ); 90 void paintNumber( QPainter *p );
91}; 91};
92 92
93class DiceWidget : public QWidget 93class DiceWidget : public QWidget
94{ 94{
95 Q_OBJECT 95 Q_OBJECT
96 public: 96 public:
97 DiceWidget( QWidget *parent = 0, const char* name = 0 ); 97 DiceWidget( QWidget *parent = 0, const char* name = 0 );
98 98
99 QPushButton *rollButton; 99 QPushButton *rollButton;
100 100
101 dicesList diceList; 101 dicesList diceList;
102}; 102};
103 103
104 104
105class Board : public QWidget 105class Board : public QWidget
106{ 106{
107 Q_OBJECT 107 Q_OBJECT
108 public: 108 public:
109 Board( QWidget *parent = 0, const char* name = 0 ); 109 Board( QWidget *parent = 0, const char* name = 0 );
110
111 protected:
112 virtual void paintEvent( QPaintEvent *e );
113}; 110};
114 111
115class Possibilityboard : public Board 112class Possibilityboard : public Board
116{ 113{
117 Q_OBJECT 114 Q_OBJECT
118 115
119 public: 116 public:
120 Possibilityboard( QWidget *parent = 0, const char* name = 0 ); 117 Possibilityboard( QWidget *parent = 0, const char* name = 0 );
121 118
122 protected: 119 protected:
123 virtual void paintEvent( QPaintEvent *e ); 120 virtual void paintEvent( QPaintEvent *e );
124}; 121};
125 122
126class Resultboard : public Board 123class Resultboard : public Board
127{ 124{
128 Q_OBJECT 125 Q_OBJECT
129 126
130 public: 127 public:
131 Resultboard( QString playerName , QWidget *parent = 0, const char* name = 0 ); 128 Resultboard( QString playerName , QWidget *parent = 0, const char* name = 0 );
132 QString pName; 129 QString pName;
133 130
134 protected: 131 protected:
135 virtual void paintEvent( QPaintEvent *e ); 132 virtual void paintEvent( QPaintEvent *e );
136}; 133};
137 134
138 135
139class Scoreboard : public QWidget 136class Scoreboard : public QWidget
140{ 137{
141 Q_OBJECT 138 Q_OBJECT
142 public: 139 public:
143 Scoreboard( playerList ps, QWidget *parent = 0, const char* name = 0 ); 140 Scoreboard( playerList ps, QWidget *parent = 0, const char* name = 0 );
144 141
145 Possibilityboard *pb; 142 Possibilityboard *pb;
146 resultboardList rbList; 143 resultboardList rbList;
147 playerList ps_; 144 playerList ps_;
148 145
149 void createResultboards(const int); 146 void createResultboards(const int);
150 147
151 protected: 148 protected:
152 void paintEvent( QPaintEvent *e ); 149 void paintEvent( QPaintEvent *e );
153}; 150};
154 151
155 152
156class Player 153class Player
157{ 154{
158 public: 155 public:
159 Player( QString name ); 156 Player( QString name );
160 157
161 QString playerName; 158 QString playerName;
162 int totalPoints; 159 int totalPoints;
163}; 160};
164 161
165class Game 162class Game
166{ 163{
167 public: 164 public:
168 Game( playerList pla ); 165 Game( playerList pla );
166
169 playerList players; 167 playerList players;
168 int currentPlayer;
169
170 void startGame();
171 void stopGame();
170}; 172};
171 173
172#endif // WORDGAME_H 174#endif // WORDGAME_H