You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.6 KiB
85 lines
2.6 KiB
15 years ago
|
/***************************************************************************
|
||
|
Kwin4 - Four in a Row for KDE
|
||
|
-------------------
|
||
|
begin : March 2000
|
||
|
copyright : (C) 1995-2001 by Martin Heni
|
||
|
email : martin@heni-online.de
|
||
|
***************************************************************************/
|
||
|
|
||
|
/***************************************************************************
|
||
|
* *
|
||
|
* This program is free software; you can redistribute it and/or modify *
|
||
|
* it under the terms of the GNU General Public License as published by *
|
||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||
|
* (at your option) any later version. *
|
||
|
* *
|
||
|
***************************************************************************/
|
||
|
|
||
|
#ifndef _KWIN4PROC_H_
|
||
|
#define _KWIN4PROC_H_
|
||
|
|
||
|
#include <kgameprocess.h>
|
||
|
|
||
13 years ago
|
// TODO match up with what is in twin4doc.h
|
||
15 years ago
|
typedef enum e_farbe {Niemand=0,Gelb=1,Rot=2,Tip=3,Rand=4} Farbe;
|
||
|
typedef char FARBE;
|
||
|
|
||
|
#define SIZE_Y_ALL 36
|
||
|
#define SIZE_X 6
|
||
|
#define SIZE_Y 5
|
||
|
|
||
13 years ago
|
class KComputer : public TQObject
|
||
15 years ago
|
{
|
||
|
|
||
|
Q_OBJECT
|
||
13 years ago
|
TQ_OBJECT
|
||
15 years ago
|
|
||
|
public:
|
||
|
KComputer();
|
||
|
// The KGameProcess is the main program and event loop
|
||
|
KGameProcess proc;
|
||
|
|
||
|
public slots:
|
||
14 years ago
|
void slotCommand(TQDataStream &, int msgid,int receiver,int sender);
|
||
|
void slotInit(TQDataStream &, int id);
|
||
|
void slotTurn(TQDataStream &, bool turn);
|
||
15 years ago
|
|
||
|
protected:
|
||
|
void sendValue(long value);
|
||
|
long random(long max);
|
||
14 years ago
|
long think(TQDataStream &in,TQDataStream &out,bool hint);
|
||
15 years ago
|
|
||
|
// Old computer stuff
|
||
|
Farbe SwitchPlayer(Farbe amZug=Niemand);
|
||
|
Farbe GameOver(FARBE feld[][SIZE_X+1],char anzahl[]);
|
||
|
void DoMove(char move,Farbe farbe,FARBE feld[][SIZE_X+1],char anzahl[]);
|
||
|
int GetCompMove();
|
||
|
long Wertung(Farbe farbe,FARBE feld[][SIZE_X+1],char anzahl[],int reklev,int zug);
|
||
|
long Bewertung(Farbe farbe,FARBE feld[][SIZE_X+1]);
|
||
|
void InitField();
|
||
|
|
||
|
private:
|
||
|
/* rows: 0-5 =6 : horiz(i:0-6) */
|
||
|
/* 6-12 =7 : vert(i:0-5) */
|
||
|
/* 13-24 =12: diag-45(i:...) */
|
||
|
/* 25-36 =12: diag45(i:...) */
|
||
|
|
||
|
char lenofrow[38];
|
||
|
char startofrow[38];
|
||
|
|
||
|
Farbe beginner,second; // Welche Farbe faengt an und zieht nach
|
||
|
|
||
|
Farbe amZug; // wer ist am Zug
|
||
|
Farbe winner; // who won thee game
|
||
|
FARBE feldmatrix[SIZE_Y_ALL+1][SIZE_X+1];
|
||
|
char anzahlmatrix[SIZE_Y_ALL+1];
|
||
|
|
||
|
int aktzug; // welcher Zug ist getade gemacht 0..42
|
||
|
int mymaxreklev; // maximale Rekursion
|
||
|
long aktwert; // Stellungsbewertung
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif // _KWIN4PROC_H_
|
||
|
|