kwin4proc.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           Kwin4  -  Four in a Row for KDE
00003                              -------------------
00004     begin                : March 2000 
00005     copyright            : (C) 1995-2007 by Martin Heni
00006     email                : kde@heni-online.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef _KWIN4PROC_H_
00019 #define _KWIN4PROC_H_
00020 
00021 #include <kgameprocess.h>
00022 
00023 // TODO match up with what is in kwin4globals.h
00024 typedef enum e_farbe {Niemand=0,Gelb=1,Rot=2,Tip=3,Rand=4} Farbe;
00025 typedef char FARBE;
00026 
00027 #define SIZE_Y_ALL 36
00028 #define SIZE_X 6
00029 #define SIZE_Y 5
00030 
00031 class KComputer : public QObject
00032 {
00033 
00034 Q_OBJECT
00035 
00036 public:
00037   KComputer();
00038   // The KGameProcess is the main program and event loop 
00039   KGameProcess proc;
00040 
00041 public slots:
00042   void slotCommand(QDataStream &, int msgid,int receiver,int sender);
00043   void slotInit(QDataStream &, int id);
00044   void slotTurn(QDataStream &, bool turn);
00045 
00046 protected:
00047   void sendValue(long value);
00048   long random(long max);
00049   long think(QDataStream &in,QDataStream &out,bool hint);
00050   
00051   // Old computer stuff
00052   Farbe SwitchPlayer(Farbe amZug=Niemand);
00053   Farbe GameOver(FARBE feld[][SIZE_X+1],char anzahl[]);
00054   void DoMove(char move,Farbe farbe,FARBE feld[][SIZE_X+1],char anzahl[]);
00055   int GetCompMove();
00056   long Wertung(Farbe farbe,FARBE feld[][SIZE_X+1],char anzahl[],int reklev,int zug);
00057   long Bewertung(Farbe farbe,FARBE feld[][SIZE_X+1]);
00058   void InitField();
00059 
00060 private:
00061   /* rows: 0-5  =6 : horiz(i:0-6) */
00062   /*       6-12 =7 : vert(i:0-5)  */
00063   /*      13-24 =12: diag-45(i:...) */
00064   /*      25-36 =12: diag45(i:...) */
00065 
00066   char lenofrow[38];
00067   char startofrow[38];
00068 
00069         Farbe beginner,second;  // Welche Farbe faengt an und zieht nach
00070 
00071         Farbe amZug;    // wer ist am Zug
00072         Farbe winner;   // who won thee game
00073   FARBE feldmatrix[SIZE_Y_ALL+1][SIZE_X+1];
00074         char anzahlmatrix[SIZE_Y_ALL+1];
00075 
00076   int aktzug;                   // welcher Zug ist getade gemacht 0..42
00077         int mymaxreklev;        // maximale Rekursion
00078         long aktwert;           // Stellungsbewertung
00079 
00080 };
00081 
00082 #endif // _KWIN4PROC_H_
00083 

Generated on Sun Mar 4 10:56:43 2007 for KWin4 by  doxygen 1.4.6