30 files changed, 3294 insertions, 1 deletions
@@ -38,7 +38,7 @@ APPS=$(LOCALAPPS) addressbook calculator clock datebook \ todo wordgame embeddedkonsole taskbar sysinfo \ parashoot snake citytime showimg netsetup tableviewer \ qipkg mindbreaker go qasteroids qcop fifteen keypebble today opiemail/converter opiemail \ - noncore/tictac noncore/opieftp + noncore/tictac noncore/opieftp noncore/kcheckers DOCS = docs/src/opie-policy single: mpegplayer/libmpeg3 diff --git a/apps/Games/kcheckers.desktop b/apps/Games/kcheckers.desktop new file mode 100644 index 0000000..4515b3a --- a/dev/null +++ b/apps/Games/kcheckers.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Comment=A Ckeckers Game +Exec=kcheckers +Icon=KCheckers +Type=Application +Name=KCheckers diff --git a/noncore/games/kcheckers/.cvsignore b/noncore/games/kcheckers/.cvsignore new file mode 100644 index 0000000..2c33e73 --- a/dev/null +++ b/noncore/games/kcheckers/.cvsignore @@ -0,0 +1,3 @@ +moc_* +*.moc +Makefile* diff --git a/noncore/games/kcheckers/checkers.cpp b/noncore/games/kcheckers/checkers.cpp new file mode 100644 index 0000000..1e4dd1f --- a/dev/null +++ b/noncore/games/kcheckers/checkers.cpp @@ -0,0 +1,337 @@ +// +// KCheckers Engine + +// +// Board = 54 Fields: +// +// | 06 07 08 09| MAN2 +// |11 12 13 14 | +// | 17 18 19 20| +// |22 23 24 25 | +// | 28 29 30 31| +// |33 34 35 36 | +// | 39 40 41 42| +// |44 45 46 47 | MAN1 + +#include <time.h> +#include <stdlib.h> + +#include "checkers.h" + + +Checkers::Checkers(int skill) +{ + for(int i=0;i<54;i++) board[i]=NONE; + board[6] =MAN2; board[7] =MAN2; board[8] =MAN2; board[9] =MAN2; + board[11]=MAN2; board[12]=MAN2; board[13]=MAN2; board[14]=MAN2; + board[17]=MAN2; board[18]=MAN2; board[19]=MAN2; board[20]=MAN2; + board[22]=FREE; board[23]=FREE; board[24]=FREE; board[25]=FREE; + board[28]=FREE; board[29]=FREE; board[30]=FREE; board[31]=FREE; + board[33]=MAN1; board[34]=MAN1; board[35]=MAN1; board[36]=MAN1; + board[39]=MAN1; board[40]=MAN1; board[41]=MAN1; board[42]=MAN1; + board[44]=MAN1; board[45]=MAN1; board[46]=MAN1; board[47]=MAN1; + + levelmax=skill; + + srand(time(0)); // Seed the random number generator +} + + +/////////////////////////////////////////////////// +// +// User Functions +// +/////////////////////////////////////////////////// + + +bool Checkers::checkMove1() +{ + for(int i=6;i<48;i++) + { + switch(board[i]) + { + case MAN1: + if(board[i-6]==FREE) return true; + if(board[i-5]==FREE) return true; + break; + case KING1: + if(board[i-6]==FREE) return true; + if(board[i-5]==FREE) return true; + if(board[i+5]==FREE) return true; + if(board[i+6]==FREE) return true; + } + } + return false; +} + + +//////////////////////////////////////////////////// +// +// Computer Functions +// +//////////////////////////////////////////////////// + + +void Checkers::go2() +{ + level=0; + for(int i=6;i<48;i++) bestboard[i]=board[i]; + turn(); + for(int i=6;i<48;i++) board[i]=bestboard[i]; + ; +} + + +void Checkers::turn(int &resMax,bool capture) +{ + if(level<levelmax) + { + bool f12,f13,f14,f17,f18,f19,f23,f24,f25,f28,f29,f30,f34,f35,f36,f39,f40,f41; + if(capture) + { + if(board[12]==NONE) {f12=true;board[12]=FREE;} else f12=false; + if(board[13]==NONE) {f13=true;board[13]=FREE;} else f13=false; + if(board[14]==NONE) {f14=true;board[14]=FREE;} else f14=false; + if(board[17]==NONE) {f17=true;board[17]=FREE;} else f17=false; + if(board[18]==NONE) {f18=true;board[18]=FREE;} else f18=false; + if(board[19]==NONE) {f19=true;board[19]=FREE;} else f19=false; + if(board[23]==NONE) {f23=true;board[23]=FREE;} else f23=false; + if(board[24]==NONE) {f24=true;board[24]=FREE;} else f24=false; + if(board[25]==NONE) {f25=true;board[25]=FREE;} else f25=false; + if(board[28]==NONE) {f28=true;board[28]=FREE;} else f28=false; + if(board[29]==NONE) {f29=true;board[29]=FREE;} else f29=false; + if(board[30]==NONE) {f30=true;board[30]=FREE;} else f30=false; + if(board[34]==NONE) {f34=true;board[34]=FREE;} else f34=false; + if(board[35]==NONE) {f35=true;board[35]=FREE;} else f35=false; + if(board[36]==NONE) {f36=true;board[36]=FREE;} else f36=false; + if(board[39]==NONE) {f39=true;board[39]=FREE;} else f39=false; + if(board[40]==NONE) {f40=true;board[40]=FREE;} else f40=false; + if(board[41]==NONE) {f41=true;board[41]=FREE;} else f41=false; + } + + int b6=board[6]; + int b7=board[7]; + int b8=board[8]; + int b9=board[9]; + int b11=board[11]; + int b12=board[12]; + int b13=board[13]; + int b14=board[14]; + int b17=board[17]; + int b18=board[18]; + int b19=board[19]; + int b20=board[20]; + int b22=board[22]; + int b23=board[23]; + int b24=board[24]; + int b25=board[25]; + int b28=board[28]; + int b29=board[29]; + int b30=board[30]; + int b31=board[31]; + int b33=board[33]; + int b34=board[34]; + int b35=board[35]; + int b36=board[36]; + int b39=board[39]; + int b40=board[40]; + int b41=board[41]; + int b42=board[42]; + int b44=board[44]; + int b45=board[45]; + int b46=board[46]; + int b47=board[47]; + + board[6]=FULL-b47; + board[7]=FULL-b46; + board[8]=FULL-b45; + board[9]=FULL-b44; + board[11]=FULL-b42; + board[12]=FULL-b41; + board[13]=FULL-b40; + board[14]=FULL-b39; + board[17]=FULL-b36; + board[18]=FULL-b35; + board[19]=FULL-b34; + board[20]=FULL-b33; + board[22]=FULL-b31; + board[23]=FULL-b30; + board[24]=FULL-b29; + board[25]=FULL-b28; + board[28]=FULL-b25; + board[29]=FULL-b24; + board[30]=FULL-b23; + board[31]=FULL-b22; + board[33]=FULL-b20; + board[34]=FULL-b19; + board[35]=FULL-b18; + board[36]=FULL-b17; + board[39]=FULL-b14; + board[40]=FULL-b13; + board[41]=FULL-b12; + board[42]=FULL-b11; + board[44]=FULL-b9; + board[45]=FULL-b8; + board[46]=FULL-b7; + board[47]=FULL-b6; + + int res=-turn(); + + board[6]=b6; + board[7]=b7; + board[8]=b8; + board[9]=b9; + board[11]=b11; + board[12]=b12; + board[13]=b13; + board[14]=b14; + board[17]=b17; + board[18]=b18; + board[19]=b19; + board[20]=b20; + board[22]=b22; + board[23]=b23; + board[24]=b24; + board[25]=b25; + board[28]=b28; + board[29]=b29; + board[30]=b30; + board[31]=b31; + board[33]=b33; + board[34]=b34; + board[35]=b35; + board[36]=b36; + board[39]=b39; + board[40]=b40; + board[41]=b41; + board[42]=b42; + board[44]=b44; + board[45]=b45; + board[46]=b46; + board[47]=b47; + + if(res>resMax) + { + resMax=res; + if(level==1) + { + for(int i=6;i<48;i++) bestboard[i]=board[i]; + bestcounter=1; + } + } + else if(res==resMax && level==1) + { + bestcounter++; + if((rand()%bestcounter)==0) + { + for(int i=6;i<48;i++) bestboard[i]=board[i]; + } + } + + if(capture) + { + if(f12) board[12]=NONE; + if(f13) board[13]=NONE; + if(f14) board[14]=NONE; + if(f17) board[17]=NONE; + if(f18) board[18]=NONE; + if(f19) board[19]=NONE; + if(f23) board[23]=NONE; + if(f24) board[24]=NONE; + if(f25) board[25]=NONE; + if(f28) board[28]=NONE; + if(f29) board[29]=NONE; + if(f30) board[30]=NONE; + if(f34) board[34]=NONE; + if(f35) board[35]=NONE; + if(f36) board[36]=NONE; + if(f39) board[39]=NONE; + if(f40) board[40]=NONE; + if(f41) board[41]=NONE; + } + } + else if(resMax<0) resMax=0; +} + + +bool Checkers::checkMove2() +{ + for(int i=6;i<48;i++) + { + switch(board[i]) + { + case MAN2: + if(board[i+5]==FREE) return true; + if(board[i+6]==FREE) return true; + break; + case KING2: + if(board[i-6]==FREE) return true; + if(board[i-5]==FREE) return true; + if(board[i+5]==FREE) return true; + if(board[i+6]==FREE) return true; + } + } + return false; +} + + +int Checkers::turn() +{ + int resMax=(level-levelmax)*10; + level++; + if(checkCapture2()) + { + for(int i=6;i<48;i++) + { + switch(board[i]) + { + case MAN2: + manCapture2(i,resMax); + break; + case KING2: + kingCapture2(i,UL,resMax); + kingCapture2(i,UR,resMax); + kingCapture2(i,DL,resMax); + kingCapture2(i,DR,resMax); + } + } + } + else if(checkMove2()) + { + for(int i=6;i<48;i++) + { + switch(board[i]) + { + case MAN2: + if(board[i+5]==FREE) + { + board[i]=FREE; + if(i>38) board[i+5]=KING2; + else board[i+5]=MAN2; + turn(resMax); + board[i+5]=FREE; + board[i]=MAN2; + } + if(board[i+6]==FREE) + { + board[i]=FREE; + if(i>38) board[i+6]=KING2; + else board[i+6]=MAN2; + turn(resMax); + board[i+6]=FREE; + board[i]=MAN2; + } + break; + case KING2: + kingMove2(i,resMax); + break; + } + } + } + else ; + + level--; + return resMax; +} + + diff --git a/noncore/games/kcheckers/checkers.h b/noncore/games/kcheckers/checkers.h new file mode 100644 index 0000000..bd2be08 --- a/dev/null +++ b/noncore/games/kcheckers/checkers.h @@ -0,0 +1,56 @@ +#ifndef CHECKERS_H +#define CHECKERS_H + +#define NONE 0 +#define MAN1 1 +#define KING1 2 +#define FREE 3 +#define KING2 4 +#define MAN2 5 +#define FULL 6 + +#define UL -6 +#define UR -5 +#define DL 5 +#define DR 6 + + +class Checkers +{ + public: + Checkers(int); + virtual bool go1(int,int)=0; + + void go2(); + bool checkMove1(); + bool checkMove2(); + + virtual bool checkCapture1()=0; + virtual bool checkCapture2()=0; + + void setLevel(int i) {levelmax=i;}; + int getBoard(int i) {return board[i];}; + + protected: + int level; // Current level + int levelmax; // Maximum level + + int turn(); + void turn(int &,bool capture=false); + + int to; + int board[54]; + int bestboard[54]; + int bestcounter; + + virtual void kingMove2(int,int &)=0; + + virtual bool manCapture2(int,int &)=0; + virtual bool kingCapture2(int,int,int &)=0; + + virtual bool manCapture1(int,int,bool &)=0; + virtual bool kingCapture1(int,int,bool &)=0; + +}; + +#endif diff --git a/noncore/games/kcheckers/echeckers.cpp b/noncore/games/kcheckers/echeckers.cpp new file mode 100644 index 0000000..1146059 --- a/dev/null +++ b/noncore/games/kcheckers/echeckers.cpp @@ -0,0 +1,349 @@ +// +// English Checkers + + +#include "echeckers.h" + + +/////////////////////////////////////////////////// +// +// User Functions +// +/////////////////////////////////////////////////// + + +bool ECheckers::go1(int from,int field) +{ + to=field; + + if(checkCapture1()) + { + bool capture=false; + switch(board[from]) + { + case MAN1: + if(manCapture1(from,UL,capture)) return true; + if(manCapture1(from,UR,capture)) return true; + return false; + case KING1: + if(kingCapture1(from,UL,capture)) return true; + if(kingCapture1(from,UR,capture)) return true; + if(kingCapture1(from,DL,capture)) return true; + if(kingCapture1(from,DR,capture)) return true; + return false; + } + } + else + { + switch(board[from]) + { + case MAN1: + if((to==(from-6))||(to==(from-5))) + { + board[from]=FREE; + if(to<10) board[to]=KING1; + else board[to]=MAN1; + return true; + } + return false; + case KING1: + if((to==(from-6))||(to==(from-5))|| + (to==(from+5))||(to==(from+6)) ) + { + board[from]=FREE; + board[to]=KING1; + return true; + } + return false; + } + } + return false; +} + + +bool ECheckers::checkCapture1() +{ + for(int i=6;i<48;i++) + { + switch(board[i]) + { + case MAN1: + if(board[i-6]==MAN2 || board[i-6]==KING2) + if(board[i-12]==FREE) return true; + if(board[i-5]==MAN2 || board[i-5]==KING2) + if(board[i-10]==FREE) return true; + break; + case KING1: + if(board[i-6]==MAN2 || board[i-6]==KING2) + if(board[i-12]==FREE) return true; + if(board[i-5]==MAN2 || board[i-5]==KING2) + if(board[i-10]==FREE) return true; + if(board[i+5]==MAN2 || board[i+5]==KING2) + if(board[i+10]==FREE) return true; + if(board[i+6]==MAN2 || board[i+6]==KING2) + if(board[i+12]==FREE) return true; + } + } + return false; +} + + +// Return TRUE if a course of the user true +// Return FALSE if a course of the user incorrect + +bool ECheckers::manCapture1(int from,int direction,bool &capture) +{ + int i=from+direction; + if(board[i]==MAN2 || board[i]==KING2) + { + int k=i+direction; + if(board[k]==FREE) + { + bool next=false; + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + + if(k<10) + { + board[k]=KING1; + if(kingCapture1(k,direction+11,next)) {board[i]=FREE;return true;} + } + else + { + board[k]=MAN1; + if(manCapture1(k,UL,next)) {board[i]=FREE;return true;} + if(manCapture1(k,UR,next)) {board[i]=FREE;return true;} + } + + if((!next) && k==to) {board[i]=FREE;return true;} + + board[k]=FREE; + board[i]=save; + board[from]=MAN1; + capture=true; + } + } + return false; +} + + +bool ECheckers::kingCapture1(int from,int direction,bool &capture) +{ + int i=from+direction; + if(board[i]==MAN2 || board[i]==KING2) + { + int k=i+direction; + if(board[k]==FREE) + { + bool next=false; + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + board[k]=KING1; + + if(direction==UL || direction==DR) + { + if(kingCapture1(k,UR,next)) {board[i]=FREE;return true;} + if(kingCapture1(k,DL,next)) {board[i]=FREE;return true;} + } + else + { + if(kingCapture1(k,UL,next)) {board[i]=FREE;return true;} + if(kingCapture1(k,DR,next)) {board[i]=FREE;return true;} + } + if(kingCapture1(k,direction,next)) {board[i]=FREE;return true;} + + if((!next) && k==to) {board[i]=FREE;return true;} + + board[k]=FREE; + board[i]=save; + board[from]=KING1; + capture=true; + } + } + return false; +} + + +//////////////////////////////////////////////////// +// +// Computer Functions +// +//////////////////////////////////////////////////// + + +void ECheckers::kingMove2(int from,int &resMax) +{ + board[from]=FREE; + + int i=from-6; + if(board[i]==FREE) + { + board[i]=KING2; + turn(resMax); + board[i]=FREE; + } + + i=from-5; + if(board[i]==FREE) + { + board[i]=KING2; + turn(resMax); + board[i]=FREE; + } + + i=from+5; + if(board[i]==FREE) + { + board[i]=KING2; + turn(resMax); + board[i]=FREE; + } + + i=from+6; + if(board[i]==FREE) + { + board[i]=KING2; + turn(resMax); + board[i]=FREE; + } + + board[from]=KING2; +} + + +bool ECheckers::checkCapture2() +{ + for(int i=6;i<48;i++) + { + switch(board[i]) + { + case MAN2: + if(board[i+5]==MAN1 || board[i+5]==KING1) + if(board[i+10]==FREE) return true; + if(board[i+6]==MAN1 || board[i+6]==KING1) + if(board[i+12]==FREE) return true; + break; + case KING2: + if(board[i-6]==MAN1 || board[i-6]==KING1) + if(board[i-12]==FREE) return true; + if(board[i-5]==MAN1 || board[i-5]==KING1) + if(board[i-10]==FREE) return true; + if(board[i+5]==MAN1 || board[i+5]==KING1) + if(board[i+10]==FREE) return true; + if(board[i+6]==MAN1 || board[i+6]==KING1) + if(board[i+12]==FREE) return true; + } + } + return false; +} + + +// Return TRUE if it is possible to capture +// Return FALSE if it is impossible to capture + +bool ECheckers::manCapture2(int from,int &resMax) +{ + bool capture=false; + + int i=from+5; + if(board[i]==MAN1 || board[i]==KING1) + { + int k=from+10; + if(board[k]==FREE) + { + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + resMax--; + if(from>32) + { + board[k]=KING2; + if(!kingCapture2(k,UL,resMax)) turn(resMax,true); + } + else + { + board[k]=MAN2; + if(!manCapture2(k,resMax)) turn(resMax,true); + } + resMax++; + board[k]=FREE; + board[i]=save; + board[from]=MAN2; + capture=true; + } + } + + i=from+6; + if(board[i]==MAN1 || board[i]==KING1) + { + int k=from+12; + if(board[k]==FREE) + { + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + resMax--; + if(from>32) + { + board[k]=KING2; + if(!kingCapture2(k,UR,resMax)) turn(resMax,true); + } + else + { + board[k]=MAN2; + if(!manCapture2(k,resMax)) turn(resMax,true); + } + resMax++; + board[k]=FREE; + board[i]=save; + board[from]=MAN2; + capture=true; + } + } + + if(capture) return true; + return false; +} + + +bool ECheckers::kingCapture2(int from,int direction,int &resMax) +{ + int i=from+direction; + if(board[i]==MAN1 || board[i]==KING1) + { + int k=i+direction; + if(board[k]==FREE) + { + bool capture=false; + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + resMax--; + + board[k]=KING2; + if(direction==UL || direction==DR) + { + if(kingCapture2(k,UR,resMax)) capture=true; + if(kingCapture2(k,DL,resMax)) capture=true; + } + else + { + if(kingCapture2(k,UL,resMax)) capture=true; + if(kingCapture2(k,DR,resMax)) capture=true; + } + if(kingCapture2(k,direction,resMax)) capture=true; + + if(!capture) turn(resMax,true); + board[k]=FREE; + + resMax++; + board[i]=save; + board[from]=KING2; + return true; + } + } + return false; +} + diff --git a/noncore/games/kcheckers/echeckers.h b/noncore/games/kcheckers/echeckers.h new file mode 100644 index 0000000..5ca3ecc --- a/dev/null +++ b/noncore/games/kcheckers/echeckers.h @@ -0,0 +1,28 @@ + +#ifndef ECHECKERS_H +#define ECHECKERS_H + +#include <checkers.h> + + +class ECheckers:public Checkers +{ + public: + ECheckers(int skill):Checkers(skill){}; + bool go1(int,int); + + bool checkCapture1(); + bool checkCapture2(); + + private: + void kingMove2(int,int &); + + bool manCapture1(int,int,bool &); + bool kingCapture1(int,int,bool &); + + bool manCapture2(int,int &); + bool kingCapture2(int,int,int &); + +}; + +#endif diff --git a/noncore/games/kcheckers/field.cpp b/noncore/games/kcheckers/field.cpp new file mode 100644 index 0000000..0755008 --- a/dev/null +++ b/noncore/games/kcheckers/field.cpp @@ -0,0 +1,31 @@ + +#include <qpainter.h> + +#include "field.h" + +Field::Field(QWidget *parent,int i):QWidget(parent) +{ + pixmap=new QPixmap(SIZE,SIZE); + number=i; +} + +void Field::paintEvent(QPaintEvent*) +{ + bitBlt(this,0,0,pixmap); +} + +void Field::mousePressEvent(QMouseEvent* mouseevent) +{ + if(mouseevent->button()!=Qt::LeftButton) return; + emit click(number); +} + +void Field::draw(QImage *image) +{ + QPainter paint; + paint.begin(pixmap); + paint.drawImage(0,0,*image); + paint.end(); + update(); +} + diff --git a/noncore/games/kcheckers/field.h b/noncore/games/kcheckers/field.h new file mode 100644 index 0000000..d929e49 --- a/dev/null +++ b/noncore/games/kcheckers/field.h @@ -0,0 +1,27 @@ + +#ifndef FIELD_H +#define FIELD_H + +#include <qwidget.h> +#include <qpixmap.h> + +#define SIZE 28 + +class Field:public QWidget +{ + Q_OBJECT + public: + Field(QWidget*,int); + void draw(QImage*); + signals: + void click(int); + protected: + void paintEvent(QPaintEvent*); + void mousePressEvent(QMouseEvent*); + private: + int number; + QPixmap *pixmap; + +}; + +#endif diff --git a/noncore/games/kcheckers/kcheckers.cpp b/noncore/games/kcheckers/kcheckers.cpp new file mode 100644 index 0000000..3df744e --- a/dev/null +++ b/noncore/games/kcheckers/kcheckers.cpp @@ -0,0 +1,382 @@ + +#include <qimage.h> +#include <qframe.h> +#include <qlayout.h> +#include <qmenubar.h> +#include <qwhatsthis.h> +#include <qmessagebox.h> +#include <qapplication.h> + +#include "kcheckers.h" +#include "echeckers.h" +#include "rcheckers.h" + +#include "pics/exit.xpm" +#include "pics/logo.xpm" +#include "pics/wood1.xpm" +#include "pics/wood2.xpm" +#include "pics/wood3.xpm" +#include "pics/marble1.xpm" +#include "pics/marble2.xpm" +#include "pics/marble3.xpm" +#include "pics/biglogo.xpm" +#include "pics/man_black.xpm" +#include "pics/man_white.xpm" +#include "pics/king_black.xpm" +#include "pics/king_white.xpm" +#include "pics/contexthelp.xpm" + + +const int KCheckers::t[]={6,7,8,9,11,12,13,14,17,18,19,20,22,23, + 24,25,28,29,30,31,33,34,35,36,39,40,41,42,44,45,46,47}; + +KCheckers::KCheckers():QMainWindow(0,0,WStyle_DialogBorder) +{ + setCaption("KCheckers"); + setIcon(QPixmap(biglogo)); + showMaximized(); + + QPopupMenu* gameMenu=new QPopupMenu; + gameMenu->insertItem(QPixmap(logo),tr("New"),this,SLOT(newGame())); + gameMenu->insertSeparator(); + gameMenu->insertItem(QPixmap(exit),tr("Quit"),qApp,SLOT(quit())); + + skillMenu=new QPopupMenu; + + skillMenu->insertItem(tr("Beginner"),this,SLOT(setSkillBeginner()),0,BEGINNER); + skillMenu->insertItem(tr("Novice"), this,SLOT(setSkillNovice()), 0,NOVICE); + skillMenu->insertItem(tr("Average"), this,SLOT(setSkillAverage()), 0,AVERAGE); + skillMenu->insertItem(tr("Good"), this,SLOT(setSkillGood()), 0,GOOD); + skillMenu->insertItem(tr("Expert"), this,SLOT(setSkillExpert()), 0,EXPERT); + skillMenu->insertItem(tr("Master"), this,SLOT(setSkillMaster()), 0,MASTER); + + optionsMenu=new QPopupMenu; + + optionsMenu->insertItem(tr("English Rules"),this,SLOT(setRulesEnglish()),0,ENGLISH); + optionsMenu->insertItem(tr("Russian Rules"),this,SLOT(setRulesRussian()),0,RUSSIAN); + optionsMenu->insertSeparator(); + optionsMenu->insertItem(tr("Marble Board"),this,SLOT(setPatternMarble()),0,MARBLE); + optionsMenu->insertItem(tr("Wooden Board"),this,SLOT(setPatternWood()), 0,WOOD); + + QPopupMenu* helpMenu=new QPopupMenu; + + helpMenu->insertItem(QPixmap(contexthelp),tr("What's This"),this,SLOT(whatsThis())); + helpMenu->insertSeparator(); + helpMenu->insertItem(QPixmap(logo),tr("About KCheckers"),this,SLOT(about())); + helpMenu->insertItem(tr("About &Qt"),this,SLOT(aboutQt())); + + menuBar()->insertItem(tr("Game"), gameMenu); + menuBar()->insertItem(tr("Skill"), skillMenu); + menuBar()->insertItem(tr("Options"),optionsMenu); + menuBar()->insertItem(tr("Help"), helpMenu); + + skill=NOVICE; + skillMenu->setItemChecked(skill,true); + + rules=ENGLISH; + optionsMenu->setItemChecked(rules,true); + + pattern=WOOD; + optionsMenu->setItemChecked(pattern,true); + + imageMan1=new QImage(man_black); + imageMan2=new QImage(man_white); + imageKing1=new QImage(king_black); + imageKing2=new QImage(king_white); + + imageWood1=new QImage(wood1); + imageWood2=new QImage(wood2); + imageWood3=new QImage(wood3); + imageMarble1=new QImage(marble1); + imageMarble2=new QImage(marble2); + imageMarble3=new QImage(marble3); + + imagePat1=imageWood1; + imagePat2=imageWood2; + imageFrame=imageWood3; + + QWidget* centralWidget=new QWidget(this); + setCentralWidget(centralWidget); + + QFrame* frame=new QFrame(centralWidget); + frame->setFrameStyle(QFrame::Box|QFrame::Plain); + frame->setFixedSize(SIZE*8+2,SIZE*8+2); + + QVBoxLayout* vlayout=new QVBoxLayout(centralWidget); + vlayout->addWidget(frame); + + statusLabel = new QLabel(centralWidget); + vlayout->addWidget(statusLabel); + + for(int i=0;i<64;i++) field[i]=new Field(frame,i); + + QGridLayout* grid=new QGridLayout(frame,8,8,1,0); + + for(int i=0;i<4;i++) + { + for(int k=0;k<4;k++) + { + grid->addWidget(field[i*8+k+32],i*2, k*2 ); + grid->addWidget(field[i*8+k ],i*2, k*2+1); + grid->addWidget(field[i*8+k+4 ],i*2+1,k*2 ); + grid->addWidget(field[i*8+k+36],i*2+1,k*2+1); + } + } + + for(int i=0;i<32;i++) + connect(field[i],SIGNAL(click(int)),this,SLOT(click(int))); + + userFirst=false; + + game=NULL; + newGame(); +} + + +void KCheckers::setSkill(int set) +{ + skillMenu->setItemChecked(skill,false); + + skill=set; + skillMenu->setItemChecked(skill,true); + + game->setLevel(skill); +} + + +void KCheckers::setRules(int set) +{ + optionsMenu->setItemChecked(rules,false); + + rules=set; + optionsMenu->setItemChecked(rules,true); + + colorChange(); + newGame(); +} + + +void KCheckers::setPattern(int set) +{ + optionsMenu->setItemChecked(pattern,false); + + pattern=set; + optionsMenu->setItemChecked(pattern,true); + + switch(pattern) + { + case MARBLE: + imagePat1=imageMarble1; + imagePat2=imageMarble2; + imageFrame=imageMarble3; + break; + case WOOD: + imagePat1=imageWood1; + imagePat2=imageWood2; + imageFrame=imageWood3; + } + + drawBoard(); + + if(selected) field[from]->draw(imageFrame); +} + + +void KCheckers::about() +{ + QMessageBox::about(this, "About", + "KCheckers, a board game. Ver 0.2\n" + "(C) 2002, A. Peredri <andi@ukr.net>\n\n" + "http://kcheckers.tuxfamily.org\n\n" + "Opie version by S.Prud'homme\n" + "<prudhomme@laposte.net>\n\n" + "http://opie.handhelds.org\n\n" + "This program is distributed under the\n" + "terms of the GNU General Public\n" + "License."); +} + + +void KCheckers::aboutQt() +{ + QMessageBox::aboutQt(this); +} + + +void KCheckers::newGame() +{ + if(game) + { + delete game; + QWhatsThis::remove(this); + } + + switch(rules) + { + case ENGLISH: + game=new ECheckers(skill); + QWhatsThis::add(this, + "<b>Rules of English Checkers</b>" + "<ul>" + "<li>In the beginning of game you have<br>12 checkers (men)." + "<li>Men move forward only." + "<li>Men capture by jumping forward only." + "<li>A man which reaches the far side of<br>the board becomes a king." + "<li>Kings move forward or backward to<br>one square." + "<li>Kings capture by jumping forward or<br>backward." + "<li>Whenever a player is able to make<br> a capture he must do so." + "</ul>"); + break; + case RUSSIAN: + game=new RCheckers(skill); + QWhatsThis::add(this, + "<b>Rules of Russian Checkers</b>" + "<ul>" + "<li>In the beginning of game you have<br> 12 checkers (men)." + "<li>Men move forward only." + "<li>Men capture by jumping forward or<br>backward." + "<li>A man which reaches the far side of<br> the board becomes a king." + "<li>Kings move forward or backward to<br>any number of squares." + "<li>Kings capture by jumping forward or<br>backward." + "<li>Whenever a player is able to make<br> a capture he must do so." + "</ul>"); + } + + selected=false; + gameOver=false; + + colorChange(); + drawBoard(); + + if(!userFirst) compGo(); + + statusLabel->setText(tr("Go!")); +} + + +void KCheckers::colorChange() +{ + userFirst=!userFirst; + + QImage* image; + image=imageMan1; + imageMan1=imageMan2; + imageMan2=image; + image=imageKing1; + imageKing1=imageKing2; + imageKing2=image; +} + + +void KCheckers::drawBoard() +{ + // Drawing of start position + for(int i=0;i<32;i++) + { + field[i]->draw(imagePat2); + if(game->getBoard(t[i])==MAN1) field[i]->draw(imageMan1); + else if(game->getBoard(t[i])==MAN2) field[i]->draw(imageMan2); + else if(game->getBoard(t[i])==KING1) field[i]->draw(imageKing1); + else if(game->getBoard(t[i])==KING2) field[i]->draw(imageKing2); + } + + for(int i=32;i<64;i++) field[i]->draw(imagePat1); +} + + +void KCheckers::click(int fieldNumber) +{ + if(gameOver) return; + switch(game->getBoard(t[fieldNumber])) + { + case MAN1: + case KING1: + // User selected + if(!selected) + { + from=fieldNumber; + selected=true; + field[fieldNumber]->draw(imageFrame); + return; + } + // User reselected + else + { + field[from]->draw(imagePat2); + if(game->getBoard(t[from])==MAN1) field[from]->draw(imageMan1); + else field[from]->draw(imageKing1); + from=fieldNumber; + field[fieldNumber]->draw(imageFrame); + return; + } + case FREE: + if(!selected) return; + + if(!userGo(fieldNumber)) return; + selected=false; + + if(!(game->checkMove2() || game->checkCapture2())) + { + gameOver=true; + statusLabel->setText(tr("Congratulation! You have won!")); + return; + } + + statusLabel->setText(tr("Please wait...")); + qApp->processEvents(); + + compGo(); + if(!(game->checkMove1() || game->checkCapture1())) + { + gameOver=true; + statusLabel->setText(tr("You have lost. Game over.")); + return; + } + statusLabel->setText(tr("Go!")); + } +} + + +void KCheckers::compGo() +{ + int save[32]; + for(int i=0;i<32;i++) save[i]=game->getBoard(t[i]); + + game->go2(); + + for(int i=0;i<32;i++) + { + if(game->getBoard(t[i])==save[i]) continue; + field[i]->draw(imagePat2); + if(game->getBoard(t[i])==MAN1) field[i]->draw(imageMan1); + else if(game->getBoard(t[i])==MAN2) field[i]->draw(imageMan2); + else if(game->getBoard(t[i])==KING1) field[i]->draw(imageKing1); + else if(game->getBoard(t[i])==KING2) field[i]->draw(imageKing2); + } +} + + +bool KCheckers::userGo(int to) +{ + int save[32]; + for(int i=0;i<32;i++) save[i]=game->getBoard(t[i]); + + if(!game->go1(t[from],t[to])) + { + statusLabel->setText(tr("Incorrect course.")); + return false; + } + + for(int i=0;i<32;i++) + { + if(game->getBoard(t[i])==save[i]) continue; + field[i]->draw(imagePat2); + if(game->getBoard(t[i])==MAN1) field[i]->draw(imageMan1); + else if(game->getBoard(t[i])==MAN2) field[i]->draw(imageMan2); + else if(game->getBoard(t[i])==KING1) field[i]->draw(imageKing1); + else if(game->getBoard(t[i])==KING2) field[i]->draw(imageKing2); + } + return true; +} + + diff --git a/noncore/games/kcheckers/kcheckers.h b/noncore/games/kcheckers/kcheckers.h new file mode 100644 index 0000000..e86524f --- a/dev/null +++ b/noncore/games/kcheckers/kcheckers.h @@ -0,0 +1,97 @@ + +#ifndef KCHECKERS_H +#define KCHECKERS_H + +#include <qmainwindow.h> +#include <qlabel.h> + +#include "field.h" +#include "checkers.h" + +#define WOOD 1 +#define MARBLE 2 + +#define ENGLISH 11 +#define RUSSIAN 12 + +#define BEGINNER 2 +#define NOVICE 4 +#define AVERAGE 5 +#define GOOD 6 +#define EXPERT 7 +#define MASTER 8 + + +class KCheckers:public QMainWindow +{ + Q_OBJECT + public: + KCheckers(); + + private slots: + void about(); + void aboutQt(); + void newGame(); + void click(int); // Processes the mouse clics on fields + + void setSkillBeginner() {setSkill(BEGINNER);}; + void setSkillNovice() {setSkill(NOVICE);}; + void setSkillAverage() {setSkill(AVERAGE);}; + void setSkillGood() {setSkill(GOOD);}; + void setSkillExpert() {setSkill(EXPERT);}; + void setSkillMaster() {setSkill(MASTER);}; + + void setPatternWood() {setPattern(WOOD);}; + void setPatternMarble() {setPattern(MARBLE);}; + + void setRulesEnglish() {setRules(ENGLISH);}; + void setRulesRussian() {setRules(RUSSIAN);}; + + private: + void compGo(); + bool userGo(int); + + void drawBoard(); + void colorChange(); + + void setSkill(int); + void setRules(int); + void setPattern(int); + + int from; // Selected by user + int skill; + int rules; + int pattern; + bool gameOver; + bool selected; + bool userFirst; + + Field* field[64]; // Fields of board + + QImage* imagePat1; // Patterns + QImage* imagePat2; + QImage* imageFrame; // Frame of selected field + + QImage* imageWood1; + QImage* imageWood2; + QImage* imageWood3; + QImage* imageMarble1; + QImage* imageMarble2; + QImage* imageMarble3; + + QImage* imageMan1; + QImage* imageMan2; + QImage* imageKing1; + QImage* imageKing2; + + Checkers* game; + QPopupMenu* skillMenu; + QPopupMenu* optionsMenu; + QLabel* statusLabel; + + static const int t[32]; // Translate table + +}; + +#endif + diff --git a/noncore/games/kcheckers/kcheckers.pro b/noncore/games/kcheckers/kcheckers.pro new file mode 100644 index 0000000..6ed8c1c --- a/dev/null +++ b/noncore/games/kcheckers/kcheckers.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +CONFIG = qt warn_on release +HEADERS = checkers.h \ + echeckers.h \ + field.h \ + kcheckers.h \ + rcheckers.h +SOURCES = checkers.cpp \ + echeckers.cpp \ + field.cpp \ + kcheckers.cpp \ + main.cpp \ + rcheckers.cpp +INTERFACES = +INCLUDEPATH += . \ + $(OPIEDIR)/include +LIBS += -lqpe +DESTDIR = $(OPIEDIR)/bin +TARGET = kcheckers diff --git a/noncore/games/kcheckers/main.cpp b/noncore/games/kcheckers/main.cpp new file mode 100644 index 0000000..ac86271 --- a/dev/null +++ b/noncore/games/kcheckers/main.cpp @@ -0,0 +1,18 @@ + +#include <qpe/qpeapplication.h> +#include <qfont.h> + +#include "kcheckers.h" + + +int main(int argc, char *argv[]) +{ + QPEApplication app(argc,argv); + + KCheckers kcheckers; + app.setMainWidget(&kcheckers); + kcheckers.show(); + + return app.exec(); +} + diff --git a/noncore/games/kcheckers/pics/biglogo.xpm b/noncore/games/kcheckers/pics/biglogo.xpm new file mode 100644 index 0000000..6570d88 --- a/dev/null +++ b/noncore/games/kcheckers/pics/biglogo.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static const char *biglogo[]={ +"32 32 6 1", +". c None", +"# c #000000", +"a c #303030", +"d c #d7d7d7", +"c c #eaeaea", +"b c #ffffff", +"................................", +"................................", +"................................", +"................................", +"....########################....", +"....#aaaaaaaaaaaaaaaaaaaaaa#....", +"....#abbbbbbbbbb##########a#....", +"....#abbbbbbbcbc##########a#....", +"....#abbbbbbbbbb##########a#....", +"....#abbbbbcbcbc##########a#....", +"....#abbbbbbbbbb##########a#....", +"....#abbbcbcbcbc##########a#....", +"....#abbbbbbbbbc##########a#....", +"....#abcbcbcbbcc##########a#....", +"....#abbbbbbbccc##########a#....", +"....#abcbcbccccc##########a#....", +"....#a##########cccccccccca#....", +"....#a##########cccccccccca#....", +"....#a##########ccccccccdca#....", +"....#a##########cccccccccca#....", +"....#a##########ccccccdcdca#....", +"....#a##########cccccccccca#....", +"....#a##########ccccdcdcdca#....", +"....#a##########cccccccccda#....", +"....#a##########ccdcdcdcdca#....", +"....#a##########cccccccdcda#....", +"....#aaaaaaaaaaaaaaaaaaaaaa#....", +"....########################....", +"................................", +"................................", +"................................", +"................................"}; diff --git a/noncore/games/kcheckers/pics/contexthelp.xpm b/noncore/games/kcheckers/pics/contexthelp.xpm new file mode 100644 index 0000000..9447207 --- a/dev/null +++ b/noncore/games/kcheckers/pics/contexthelp.xpm @@ -0,0 +1,20 @@ +/* XPM */ +static const char *contexthelp[]={ +"14 14 3 1", +". c None", +"a c #000000", +"# c #ffffff", +"##............", +"#a#...........", +"#aa#.....aaaa.", +"#aaa#...aa..aa", +"#aaaa#......aa", +"#aaaaa#.....aa", +"#aaaaaa#...aa.", +"#aaaaaaa#.aa..", +"#aaaa###..aa..", +"#a##a#........", +"##..#a#...aa..", +"....#a#.......", +".....#........", +".............."}; diff --git a/noncore/games/kcheckers/pics/exit.xpm b/noncore/games/kcheckers/pics/exit.xpm new file mode 100644 index 0000000..6fe404e --- a/dev/null +++ b/noncore/games/kcheckers/pics/exit.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static const char *exit[]={ +"14 14 4 1", +". c None", +"# c #000000", +"a c #303030", +"b c #757575", +"..............", +"......##......", +"......##......", +"...#..##..#...", +"..a##.##.##a..", +".b##..##..##b.", +".a#b..##..b#a.", +".##...##...##.", +".##...##...##.", +".a#b..##..b#a.", +".b##......##b.", +"..a##b..b##a..", +"...a######a...", +"....ba##ab...."}; diff --git a/noncore/games/kcheckers/pics/king_black.xpm b/noncore/games/kcheckers/pics/king_black.xpm new file mode 100644 index 0000000..382ee71 --- a/dev/null +++ b/noncore/games/kcheckers/pics/king_black.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static const char *king_black[]={ +"28 28 8 1", +". c None", +"# c #000000", +"f c #303030", +"d c #585858", +"b c #808080", +"a c #a0a0a0", +"c c #dcdcdc", +"e c #ffffff", +"..........########..........", +"........##aaabbbbb##........", +"......##caddddddddbb##......", +".....#ccc###########bb#.....", +"....#eed##############b#....", +"...#ee#################b#...", +"..#ee###################b#..", +"..#e##########e#########b#..", +".#ce##########e##########b#.", +".#c##########ded#########b#.", +"#aa####ca####aeb####ea####b#", +"#aa####bea###cea###aeb####b#", +"#ad####dce###ecc###ecd####b#", +"#ad#####cea##ecc##aea#####b#", +"#ad#####acea#ecc#aecb#####b#", +"#ad######cee#ecc#eec######b#", +"#ad######cceeecceeca######b#", +"#bd######acccccccccb######b#", +".#b#######ccccccccc######b#.", +".#b#######cccccccca######b#.", +"..#b######aaaaaaaab#####b#..", +"..#b#######fffffffff####b#..", +"...#b##################b#...", +"....#b################b#....", +".....#bb############bb#.....", +"......##bb########bb##......", +"........##bbbbbbbb##........", +"..........########.........."}; diff --git a/noncore/games/kcheckers/pics/king_white.xpm b/noncore/games/kcheckers/pics/king_white.xpm new file mode 100644 index 0000000..30932e8 --- a/dev/null +++ b/noncore/games/kcheckers/pics/king_white.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static const char *king_white[]={ +"28 28 8 1", +". c None", +"# c #000000", +"d c #303030", +"e c #585858", +"f c #808080", +"c c #a0a0a0", +"b c #dcdcdc", +"a c #ffffff", +"..........########..........", +"........##aaaaaaaa##........", +"......##aaabbbbbbbcc##......", +".....#aaabbbbbbbbbbbcc#.....", +"....#aabbbbbbbbbbbbbbbc#....", +"...#aabbbbbbbbbbbbbbbbbc#...", +"..#aabbbbbbbbbbbbbbbbbbbc#..", +"..#abbbbbbbbbadbbbbbbbbbc#..", +".#abbbbbbbbbbadbbbbbbbbbbc#.", +".#abbbbbbbbbbadbbbbbbbbbbc#.", +"#aabbbb#abbbbadbbbbba#bbbbc#", +"#abbbbb#dabbac#cbbbae#bbbbc#", +"#abbbbbaddbbafdfbbaf#ebbbbc#", +"#abbbbbbedcbaedebba##cbbbbc#", +"#abbbbbbcddaadddbafdebbbbbc#", +"#abbbbbbbdddadddacddcbbbbbc#", +"#abbbbbbbeddfdddfddebbbbbbc#", +"#abbbbbbbcdddddddddcbbbbbbc#", +".#cbbbbbbbddddddddebbbbbbc#.", +".#cbbbbbbbedddddddcbbbbbbc#.", +"..#cbbbbbbcfffffffbbbbbbc#..", +"..#cbbbbbbbbbbbbbbbbbbbbc#..", +"...#cbbbbbbbbbbbbbbbbbbc#...", +"....#cbbbbbbbbbbbbbbbbc#....", +".....#ccbbbbbbbbbbbbcc#.....", +"......##ccbbbbbbbbcc##......", +"........##cccccccc##........", +"..........########.........."}; diff --git a/noncore/games/kcheckers/pics/logo.xpm b/noncore/games/kcheckers/pics/logo.xpm new file mode 100644 index 0000000..a47d3de --- a/dev/null +++ b/noncore/games/kcheckers/pics/logo.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static const char *logo[]={ +"14 14 6 1", +". c None", +"# c #000000", +"d c #dcdcdc", +"c c #e1e1e1", +"b c #efefef", +"a c #ffffff", +"..............", +".############.", +".#aaaab######.", +".#aaaaa######.", +".#aabab######.", +".#aaabb######.", +".#babbb######.", +".######bcbbc#.", +".######bbbbd#.", +".######bbcdd#.", +".######bcddd#.", +".######cdddd#.", +".############.", +".............."}; diff --git a/noncore/games/kcheckers/pics/man_black.xpm b/noncore/games/kcheckers/pics/man_black.xpm new file mode 100644 index 0000000..e40a265 --- a/dev/null +++ b/noncore/games/kcheckers/pics/man_black.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static const char *man_black[]={ +"28 28 8 1", +". c None", +"# c #000000", +"c c #585858", +"a c #808080", +"f c #a0a0a0", +"e c #bdbdbd", +"b c #dcdcdc", +"d c #ffffff", +"..........########..........", +"........##aaaaaaaa##........", +"......##ba########aa##......", +".....#bbc###########aa#.....", +"....#ddc##############a#....", +"...#dd#######cccc######a#...", +"..#dd######aacccccc#####a#..", +"..#d#####ddeaac##ccc####a#..", +".#bd####dde#######ccc####a#.", +".#b####dde#########cc##cc##.", +"#aa####de#####ccc##ccc#ccc##", +"#a####ade#####ccc###cc#ccc##", +"#a####ae########cc#####ccc##", +"#a####ca#########ac####ccc##", +"#a###ccc#########ed####acc##", +"#a###cc####c#####dd###aacc##", +"#a###ccc###cc###dd####eeaa##", +"#a####cc####caedde###bbdbc##", +".#a###ccc#####dd#####bdde##.", +".#a####ccccc########bddd###.", +"..#a####cccc#######bdddb##..", +"..#a######cc#####bbdddb###..", +"...#a########aebbdddbb###...", +"....#a#####caaabddbbe###....", +".....#aa#cccccfbbde####.....", +"......##a#cccccb######......", +"........############........", +"..........########.........."}; diff --git a/noncore/games/kcheckers/pics/man_white.xpm b/noncore/games/kcheckers/pics/man_white.xpm new file mode 100644 index 0000000..b0968db --- a/dev/null +++ b/noncore/games/kcheckers/pics/man_white.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static const char *man_white[]={ +"28 28 10 1", +". c None", +"# c #000000", +"g c #808080", +"d c #a0a0a0", +"f c #b3b3b3", +"a c #d7d7d7", +"e c #dcdcdc", +"h c #e1e1e1", +"c c #f6f6f6", +"b c #ffffff", +"..........########..........", +"........##aaaaaaaa##........", +"......##abbcbbbbbbdd##......", +".....#abbbeeeeeeebbedd#.....", +"....#abbbeafffffffebeed#....", +"...#abbeadfggdgggdfebbfd#...", +"..#abbeafggeeeeeeggfeeefd#..", +"..#abeafgabbbbbbbeegfebed#..", +".#abeafgebbeeeeebbbegfebfd#.", +".#abefgebbedddddeebbhgdbed#.", +"#abbafgebeddggggdhebegdebfd#", +"#abefgebbedgggffffebbagdbed#", +"#abefgebedggffafffeebegdbed#", +"#abefgebedggfaaaafeebegdbed#", +"#abefgebedgfaaeeafeebegdbed#", +"#acefgebedgfaeebbbeebegdbed#", +"#abeffebedgffeabbbebbegfchd#", +"#acbhfgebeddfaabbbebhfdhhfd#", +".#dbhfggebedddfeeebbhgfbhd#.", +".#debefgeebbeeeeebbhgfbbhd#.", +"..#deeefgeebbbbbbbhgfbbhd#..", +"..#debbefggehhhhhfgfhbhhd#..", +"...#deebeffggggggdfebhhd#...", +"....#deebeeehddddbbbchd#....", +".....#ddeeebbbbbbeehdd#.....", +"......##ddeeeeeeeedd##......", +"........##dddddddd##........", +"..........########.........."}; diff --git a/noncore/games/kcheckers/pics/marble1.xpm b/noncore/games/kcheckers/pics/marble1.xpm new file mode 100644 index 0000000..124cbd2 --- a/dev/null +++ b/noncore/games/kcheckers/pics/marble1.xpm @@ -0,0 +1,240 @@ +/* XPM */ +static const char *marble1[]={ +"28 28 209 2", +"#Y c #cbcee3", +".s c #cccfe4", +".X c #cdcfe5", +"ba c #cdd0e2", +"ad c #cdd0e5", +"a7 c #ced0e3", +"al c #ced0e5", +"ae c #ced0e6", +"aW c #ced1e3", +".J c #ced1e6", +"#c c #cfd1e4", +"aA c #cfd1e7", +"bd c #cfd2e4", +"b. c #cfd2e5", +".W c #cfd2e7", +"#I c #cfd2e8", +"a5 c #d0d2e5", +"be c #d0d2e7", +".8 c #d0d2e8", +"aM c #d0d3e4", +".4 c #d0d3e5", +"#b c #d0d3e6", +".r c #d0d3e8", +"bl c #d0d3e9", +".f c #d1d3e6", +"bm c #d1d3e9", +".E c #d1d4e6", +".A c #d1d4e7", +"at c #d1d4e8", +".t c #d1d4e9", +"#E c #d1d4ea", +"#d c #d2d4e7", +".Y c #d2d4ea", +"#a c #d2d5e7", +".5 c #d2d5e8", +"bk c #d2d5e9", +"#B c #d2d5ea", +"#p c #d3d5e8", +"## c #d3d5eb", +".3 c #d3d6e8", +"aZ c #d3d6e9", +"aG c #d3d6ea", +"#X c #d3d6eb", +".7 c #d3d6ec", +"a# c #d3d8e4", +".2 c #d4d5e9", +"#y c #d4d6e9", +"#5 c #d4d6eb", +".L c #d4d6ec", +"#e c #d4d7e9", +".Q c #d4d7ea", +"#Q c #d4d7eb", +".O c #d4d7ec", +"#D c #d4d7ed", +".R c #d5d7ea", +"#O c #d5d7eb", +"aH c #d5d7ec", +"#l c #d5d7ed", +"aV c #d5d8e9", +".d c #d5d8ea", +".e c #d5d8eb", +".q c #d5d8ed", +".K c #d5d8ee", +"aT c #d5d9e8", +"aF c #d6d8ea", +".S c #d6d8eb", +"aQ c #d6d8ed", +".N c #d6d8ee", +".l c #d6d9eb", +".i c #d6d9ec", +"#N c #d6d9ed", +"#s c #d6d9ee", +".0 c #d6d9ef", +"aa c #d6dae7", +"az c #d7d9eb", +"#q c #d7d9ec", +"#F c #d7d9ef", +".a c #d7daec", +".c c #d7daed", +"#R c #d7daee", +".6 c #d7daef", +".w c #d7daf0", +"aw c #d7dbe8", +"#v c #d8daed", +"bn c #d8daee", +"a6 c #d8daef", +"#j c #d8daf0", +"ah c #d8dbeb", +".B c #d8dbed", +".b c #d8dbee", +"#k c #d8dbf0", +".y c #d8dbf1", +"aj c #d8dce9", +"ay c #d8dcea", +"#9 c #d8dcec", +"#S c #d9dbee", +"bo c #d9dbef", +"#n c #d9dbf1", +"#4 c #d9dceb", +"#g c #d9dcee", +".# c #d9dcef", +"an c #d9dcf0", +".v c #d9dcf1", +"#6 c #d9dcf2", +"#3 c #d9deeb", +".F c #dadcef", +"a1 c #dadcf0", +"as c #dadcf2", +"#x c #daddef", +".g c #daddf0", +"a2 c #daddf1", +"ac c #daddf2", +"#u c #daddf3", +"ap c #dadeeb", +"aE c #dadeec", +"aP c #dadfec", +"ag c #dbddef", +".o c #dbddf0", +"bj c #dbddf1", +"af c #dbddf3", +"#V c #dbdef0", +"#w c #dbdef1", +"a0 c #dbdef2", +"#. c #dbdef3", +".u c #dbdef4", +"aU c #dbdfee", +"au c #dcdef1", +"a9 c #dcdef2", +"#r c #dcdef3", +"#m c #dcdef4", +"#8 c #dcdff1", +".C c #dcdff2", +"#L c #dcdff3", +".V c #dcdff4", +".M c #dcdff5", +"#Z c #dddff2", +".9 c #dddff5", +"b# c #dddff6", +"#o c #dde0f2", +".h c #dde0f3", +"#P c #dde0f4", +"#t c #dde0f5", +"#H c #dde0f6", +"#T c #dee0f3", +"ao c #dee1f1", +"#f c #dee1f4", +"bc c #dee1f6", +".z c #dee1f7", +"ai c #dee2ef", +"#U c #dfe1f3", +"#W c #dfe1f5", +"a3 c #dfe1f7", +"av c #dfe2f3", +".P c #dfe2f5", +"#7 c #dfe2f7", +".x c #dfe2f8", +"aC c #dfe3f0", +"aL c #dfe3f1", +"bg c #e0e2f5", +"bh c #e0e2f8", +"#1 c #e0e3f4", +"#0 c #e0e3f5", +".j c #e0e3f6", +"#M c #e0e3f7", +"#J c #e0e3f8", +"bf c #e0e3f9", +"aK c #e0e5f2", +"a8 c #e1e3f9", +"aI c #e1e4f5", +".m c #e1e4f6", +".H c #e1e4f7", +"bb c #e1e4fa", +"aB c #e2e5f5", +"aS c #e2e5f6", +".D c #e2e5f7", +"#h c #e2e5f8", +".1 c #e2e5f9", +"#C c #e2e5fa", +"a4 c #e2e5fb", +"Qt c #e3e5f9", +".p c #e3e6f9", +"aY c #e3e6fa", +"bi c #e3e6fc", +"aX c #e4e6f9", +"#K c #e4e6fa", +"ab c #e4e7f9", +"#i c #e4e7fa", +".U c #e4e7fb", +"aO c #e4e8f5", +"aR c #e5e7fb", +"#z c #e5e8fa", +"aN c #e5e8fb", +"#A c #e5e8fc", +".Z c #e5e8fe", +"aD c #e5e9f6", +"ak c #e5e9f7", +".I c #e6e9fa", +"#G c #e6e9fc", +".G c #e6e9fd", +"aJ c #e6eaf8", +".k c #e7eafc", +".T c #e7eafd", +"am c #e7eafe", +"ar c #e7ebf8", +"aq c #e7ebf9", +"ax c #e7ecf9", +".n c #eaedfe", +"#2 c #edf2fc", +"a. c #f0f4fd", +"Qt.#.a.b.c.b.d.b.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.r.t.u.v.w.x.y.t.z", +".j.c.e.b.c.i.i.b.l.A.B.C.b.j.D.E.F.G.H.I.q.J.J.K.L.y.M.M.M.N.O.z", +".P.i.Q.B.i.R.c.B.l.S.g.C.b.g.H.C.h.T.U.V.W.t.W.r.X.Y.z.Z.z.L.0.u", +".1.c.2.3.4.5.b.a.l.a.a.o.g.#.d.l.b.p.H.O.X.6.7.8.t.K.9#.##.O.6.O", +".p.b#a#b#c#d.#.c.d#e.A.c#f.C#g.H#h#i.h#j.t.v#k.y.s#l#m#n.O.K.q.8", +"#o.l#p.3.d.a.a#q.c.b.R.R.C.d.Q.h#i.C#h#r#s.v.w.0.K#t.x#u.0.0.Y.t", +".p.h.S.3#v#w.a.i#x.g#y#d.S#w#z.p.j#g.I#A.K.r#B.W#u#C#D#D#E.v.t#F", +".j.h.3#c#e#y.b.B#a.E.a.a#wQt.j.c#w#g.j#G.K.s.t.J.M#H#I.r.W#l#B.u", +"#f#f#e#b.c.E.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R", +".#.P.H#Z.b.Q.F#p.d.H#T.h#aba.d#w.P#f#S.J.t.O.K.ubbas.0.ubc.o.c.l", +"Qt.H.H#f.o#g.c.c.g#Z.S.e.dbd#a.#.h#v.c#X.0.q#X.6#H#k.v#u#s#S.g#V", +"Qt.C.o.g.b.C.e.F.C.B#cbd.l#a#a.c.#.Q.l#5.6.6.K#6.u.y.M.ybe.5.a#g", +".C.i#w#w.dau.e.c.b.Q#c#daZ.5.c.e.e#g.i#X#j.w.0af#Hbf#m.q#X#a#e.i"}; diff --git a/noncore/games/kcheckers/pics/marble2.xpm b/noncore/games/kcheckers/pics/marble2.xpm new file mode 100644 index 0000000..f31ee0b --- a/dev/null +++ b/noncore/games/kcheckers/pics/marble2.xpm @@ -0,0 +1,595 @@ +/* XPM */ +static const char *marble2[]={ +"32 32 560 2", +"dC c #6079b1", +"et c #6079b4", +"fU c #607ab1", +"fT c #607ab2", +"f5 c #607bb1", +"eu c #6179b4", +"f2 c #617ab0", +"dR c #617ab1", +"df c #617ab2", +"cY c #617ab3", +"dT c #617ab4", +"ef c #617bb3", +"cS c #617bb4", +"f6 c #617caf", +"cU c #617cb0", +"de c #627ab4", +"eb c #627ab5", +"gj c #627ab8", +"fo c #627bb1", +"dg c #627bb2", +"dl c #627bb3", +"dW c #627bb4", +"dQ c #627caf", +"cT c #627cb3", +"f4 c #627cb5", +"dD c #637ab5", +"fB c #637bb4", +"gi c #637bb5", +"en c #637cb1", +"ea c #637cb3", +"dX c #637cb4", +"cX c #637cb5", +"dS c #637cb6", +"dc c #637cb7", +"dE c #647bb4", +"cC c #647cb6", +"fR c #647db3", +"dB c #647db4", +"eS c #647db5", +"fC c #647db6", +"dU c #647db7", +"d9 c #647eb0", +"fc c #647eb4", +"ee c #647eb6", +"ec c #6480b3", +"dd c #657db9", +"f1 c #657eb4", +"eR c #657eb5", +"d8 c #657eb6", +"fQ c #657eb7", +"fS c #657eb8", +"eT c #657fb2", +"cz c #657fb5", +"cR c #657fb9", +"#Y c #667fb6", +"cD c #667fb7", +"ey c #6680b4", +"d7 c #6681b7", +"fA c #677fb9", +"e9 c #6780b4", +"eI c #6780b6", +"aI c #6780b7", +"dM c #6780b8", +"dV c #6781b9", +"ed c #6782b7", +"bK c #687eb7", +"ba c #6881b6", +".C c #6881b7", +"cB c #6881b8", +"em c #6881b9", +"fP c #6881bc", +"a4 c #6882b5", +"aQ c #6884b6", +"aP c #6884b8", +"gO c #6981b7", +"bt c #6981b9", +"fh c #6981bb", +"dN c #6982b6", +"cq c #6982b7", +".D c #6982b8", +"ch c #6982b9", +"fd c #6982ba", +"cF c #6982bb", +"dP c #6983b3", +"dA c #6983b4", +"cr c #6983b5", +"at c #6983b6", +"af c #6983b7", +"cy c #6983b8", +"fu c #6983b9", +"d1 c #6983bc", +"aO c #6984b9", +"bJ c #6a7fb9", +"cL c #6a82b8", +"gP c #6a82b9", +"cZ c #6a82bc", +"bb c #6a83b5", +"b# c #6a83b8", +".W c #6a83b9", +"cE c #6a83ba", +"ag c #6a83bb", +"aw c #6a83bc", +"db c #6a83bd", +".K c #6a84b6", +"bF c #6a84b8", +"dL c #6a84b9", +"dI c #6a84ba", +"eY c #6a84bb", +"gA c #6a85b4", +"dH c #6a85b5", +"da c #6a85b6", +"f# c #6a86bb", +"dh c #6b81b7", +"bs c #6b81bb", +"gh c #6b84b7", +"#B c #6b84b8", +"#Z c #6b84b9", +".# c #6b84ba", +"aj c #6b84bb", +"aF c #6b84bc", +"bo c #6b85b7", +"ax c #6b85b8", +"ao c #6b85b9", +"#j c #6b85ba", +"d2 c #6b87b8", +"bu c #6c83b6", +"dy c #6c83ba", +"eU c #6c85b8", +"a0 c #6c85ba", +".c c #6c85bb", +"f8 c #6c85bc", +"#V c #6c85bd", +"cP c #6c85be", +"ai c #6c86b7", +"cp c #6c86b8", +".5 c #6c86b9", +"ac c #6c86ba", +"ev c #6c86bc", +"d0 c #6c86c0", +"bP c #6c87bd", +"br c #6d84b9", +"gG c #6d85b8", +"fi c #6d85c0", +"bR c #6d86ba", +"ap c #6d86bb", +"#i c #6d86bc", +"co c #6d86bd", +"aE c #6d86be", +"cb c #6d87b7", +"gs c #6d87b8", +".E c #6d87ba", +"ew c #6d87bb", +"d6 c #6d88bf", +"gF c #6e86ba", +"gL c #6e87bb", +"bj c #6e87bc", +".a c #6e87bd", +"e4 c #6e87be", +"aK c #6e87bf", +"#F c #6e87c1", +".t c #6e88ba", +"dK c #6e88bb", +"dm c #6e88bc", +"e5 c #6e88be", +"do c #6e89b8", +"aN c #6e89be", +"dp c #6f86b8", +"#E c #6f87c0", +"a6 c #6f88bd", +".b c #6f88be", +"cx c #6f88bf", +"eo c #6f89b9", +".g c #6f89ba", +"a1 c #6f89bb", +"#G c #6f89bc", +"cg c #6f89bd", +"eN c #6f8ab9", +"bO c #6f8bc2", +"cn c #7087bd", +"gH c #7088b9", +"ci c #7089bd", +"#X c #7089be", +"#k c #7089bf", +"eL c #708aba", +"au c #708abb", +".H c #708abc", +".e c #708abd", +"as c #708abe", +"b5 c #708abf", +"fb c #708bba", +"b4 c #708bbb", +"b. c #718abd", +"bC c #718abe", +"#l c #718abf", +".y c #718ac0", +"aH c #718ac2", +"f7 c #718ac3", +"a7 c #718bbb", +"#C c #718bbc", +".f c #718bbd", +".h c #718bbe", +"#f c #718cbc", +"fE c #7289ba", +"fK c #728bc0", +".X c #728bc1", +"aG c #728bc3", +"cu c #728cbd", +"c. c #728cbe", +"#0 c #728cbf", +"dY c #728cc0", +"an c #728cc1", +"dO c #728db9", +"ct c #728dbc", +"aL c #728dbd", +"gI c #728eb9", +"#e c #728ec0", +"f. c #7290c4", +"gk c #7389bd", +"bI c #7389be", +"gz c #7389bf", +"gQ c #738abb", +"fF c #738bbe", +"cO c #738bc2", +"dz c #738cbf", +"ab c #738cc0", +"cw c #738cc2", +"eg c #738cc3", +".T c #738dbd", +".G c #738dbe", +"el c #738dbf", +"bn c #738dc0", +"aC c #738dc1", +"bD c #738ebc", +".L c #738ebd", +"aM c #738ec3", +"gJ c #738fbb", +"fl c #738fbd", +".S c #738fc1", +"gy c #748bbe", +"fM c #748cbf", +"bU c #748dc1", +".z c #748dc3", +"a9 c #748ebf", +"cv c #748ec0", +".6 c #748ec1", +"aD c #748ec3", +".M c #748fbd", +".8 c #748fbe", +"fp c #748fbf", +"d5 c #7490c3", +"d# c #758bc3", +"eZ c #758dbe", +"#p c #758ec4", +"aZ c #758fbf", +".k c #758fc0", +".F c #758fc1", +".4 c #758fc2", +"bV c #758fc4", +"#5 c #7590c0", +"aS c #768dbe", +"fL c #768ec5", +"Qt c #768fc5", +"ez c #7690c0", +"fj c #7690c1", +"cf c #7690c2", +"aY c #7690c3", +"fV c #7690c5", +"#D c #7691be", +"#q c #7691c0", +"bE c #7691c1", +"cm c #778ec2", +"bQ c #7790c1", +"gM c #7790c4", +".d c #7790c6", +"fJ c #7791c0", +"#6 c #7791c1", +"#1 c #7791c2", +".s c #7791c3", +".i c #7791c4", +"bZ c #7791c5", +"a# c #7792be", +"#S c #7792bf", +"bk c #7792c2", +"fk c #7793c2", +"aU c #7793c3", +"di c #788ec0", +"f0 c #7891c7", +"cA c #7892c3", +".J c #7892c4", +"#W c #7892c5", +"#U c #7892c6", +"#H c #7893bf", +"ak c #7893c0", +"cc c #7893c1", +"#o c #7893c2", +"ex c #7893c3", +"dZ c #7894c4", +"bL c #798fc2", +"dG c #7991c4", +"#8 c #7992c6", +".A c #7992c8", +"gB c #7993c0", +"#y c #7993c3", +"ae c #7993c4", +"#O c #7993c5", +"eh c #7993c6", +"#N c #7994c2", +"#m c #7994c3", +"#T c #7994c4", +"gt c #7994c5", +"eW c #7995c3", +"aT c #7995c7", +"b9 c #7a90c7", +".U c #7a92c1", +"dq c #7a93c1", +"eE c #7a93c6", +"cN c #7a93c7", +"a5 c #7a93c9", +"f3 c #7a93cb", +"fm c #7a94c0", +"dJ c #7a94c3", +"bl c #7a94c4", +"dt c #7a94c5", +".r c #7a94c6", +"#7 c #7a94c7", +"bW c #7a94c9", +"#t c #7a95c0", +"eA c #7a95c3", +"#n c #7a95c4", +"d3 c #7a95c5", +"cG c #7a95c7", +"bq c #7b92c2", +"fa c #7b93ca", +"bp c #7b94bf", +".B c #7b94ca", +".j c #7b95c6", +".I c #7b95c7", +".7 c #7b95c8", +"fG c #7b95ca", +"ei c #7b96c4", +"fz c #7b96c5", +".1 c #7b96c6", +"eX c #7b96c7", +".u c #7b97c9", +"dF c #7c93c9", +"dx c #7c95c0", +"cQ c #7c96c6", +".l c #7c96c7", +"#R c #7c96c8", +"eH c #7c96c9", +"bX c #7c97c4", +"#r c #7c97c6", +".2 c #7c97c7", +"dj c #7d94c0", +"#A c #7d94c1", +".R c #7d94c5", +"ds c #7d95c7", +".v c #7d97c7", +"c6 c #7d97c8", +".Y c #7d97c9", +"c1 c #7d98c4", +"b3 c #7d98c5", +"#J c #7d98c6", +".0 c #7d98c8", +"d4 c #7d99c7", +"e8 c #7e95c4", +"eD c #7e96c6", +"fs c #7e97c4", +"cM c #7e97cb", +"fv c #7e98c6", +"aB c #7e98c8", +".Z c #7e98c9", +"#Q c #7e98ca", +"aA c #7e98cb", +"a. c #7e99c5", +"az c #7e99c6", +".9 c #7e99c7", +"by c #7f96c1", +"gR c #7f96c5", +"c5 c #7f96c8", +"bx c #7f97c4", +"#g c #7f97c6", +".Q c #7f97c8", +"aa c #7f99c9", +"dn c #7f99ca", +"aJ c #7f99cb", +"a3 c #7f99cc", +"eO c #7f9ac5", +"fI c #7f9ac6", +"c# c #7f9ac8", +"b0 c #7f9ac9", +"gl c #8097c6", +"gE c #8098cc", +"a2 c #809acb", +".p c #809bc7", +"ad c #809bc9", +"gu c #809bca", +"e1 c #809bcb", +"fr c #8199c3", +"gx c #8199ca", +"bm c #819bcb", +"gK c #819bcc", +"cI c #819cc4", +".O c #819cc7", +"aq c #819cc8", +".3 c #819ccb", +"e0 c #819ccc", +"eB c #8298c0", +"eM c #8298c6", +"b8 c #8298cb", +"fD c #8299c8", +"cl c #8299ca", +"c0 c #829ccc", +"eG c #829cce", +"aX c #829dc9", +"a8 c #829dcb", +"gg c #829dcd", +"f9 c #8399c6", +"c8 c #839ac9", +"c2 c #839acc", +"cK c #839cd2", +"ft c #839dcc", +"#K c #839dcd", +"du c #839dce", +".o c #839ecc", +"#M c #839ecd", +"ca c #839ece", +"es c #849aca", +".w c #849ccb", +"bY c #849ece", +"#P c #849ecf", +"av c #849fcb", +"#I c #849fcd", +"eK c #849fce", +"cV c #84a0c9", +"ay c #84a0ca", +"fO c #859cc3", +".m c #859fd0", +".N c #85a0cc", +"b2 c #85a0cd", +"eV c #85a0ce", +"eQ c #85a1c9", +"ej c #85a1cc", +"#w c #869dc7", +"gr c #869dc9", +"fn c #869fca", +"dr c #869fcd", +"#s c #86a1cd", +"cj c #86a1ce", +".n c #86a1d0", +"bc c #879ece", +"e7 c #879fca", +"ck c #879fcd", +"gw c #879fce", +"gN c #87a0d3", +"gf c #87a1d1", +"c7 c #87a1d2", +"b1 c #87a2cc", +"#9 c #87a2ce", +"cs c #87a2d0", +"eP c #87a2d1", +"ge c #889eca", +".q c #88a3ce", +"#. c #88a3cf", +"eJ c #88a3d0", +"bS c #88a3d3", +"e2 c #88a4c8", +"al c #88a4cb", +"#u c #89a0ca", +"dv c #89a2d0", +"cH c #89a4cc", +"ar c #89a4d0", +"#L c #89a4d2", +"#b c #8aa1ce", +"aR c #8aa3d4", +"aV c #8aa4d1", +"ce c #8aa4d5", +"bT c #8aa5d2", +"#4 c #8aa6c8", +"ek c #8aa6d0", +"fY c #8ba0cc", +"#a c #8ba1cf", +".P c #8ba2d3", +".x c #8ba3cf", +"aW c #8ba4cf", +"b6 c #8ba6d1", +"bB c #8ba6d2", +"cd c #8ba6d3", +"am c #8ba7cb", +"gd c #8ca1cd", +"#h c #8ca3cf", +"gD c #8ca7ce", +"#2 c #8ca7d3", +"gv c #8ca7d6", +"gc c #8da4cd", +"cJ c #8da9d2", +"fZ c #8ea3d2", +"e# c #8ea8d3", +"## c #8ea9d4", +"bi c #8ea9d5", +"gb c #8fa5cd", +"fN c #8fa6d3", +"cW c #8fa9d6", +"bN c #90a6c9", +"#v c #90a7d1", +"#d c #90a7d4", +"be c #90a8d2", +"#z c #90a8d7", +"dw c #90a9d1", +"e3 c #90abd9", +"e. c #91add5", +"b7 c #92aad2", +"fH c #92acd7", +"ah c #92addc", +"fX c #93a9d1", +"bH c #93aad8", +"gS c #93abd4", +"fg c #93abd5", +"bf c #94abd2", +".V c #94acd8", +"gm c #94add4", +"c9 c #94aecf", +"gC c #94aed9", +"ep c #94afdd", +"c3 c #95add6", +"bd c #96adda", +"fe c #96aed2", +"e6 c #97aed7", +"#c c #97aedb", +"gq c #97afd9", +"d. c #97b0d5", +"fy c #97b2de", +"fw c #98b1d9", +"eF c #98b4d9", +"ga c #99b1d1", +"c4 c #99b1da", +"bA c #9aafd3", +"bz c #9ab0d7", +"#3 c #9ab6dc", +"g. c #9bb1db", +"#x c #9bb2dc", +"fq c #9cb3db", +"gT c #9cb4d8", +"gn c #9cb5d8", +"dk c #9cb5dd", +"bh c #9db2d4", +"bw c #9db3da", +"bv c #9db3de", +"gp c #9db5dd", +"bg c #9eb3d7", +"go c #9eb6dd", +"eq c #a0b6da", +"fx c #a0b8dc", +"ff c #a0b8de", +"er c #a1b6df", +"fW c #a1b8db", +"bG c #a1bae2", +"eC c #a2b9e4", +"bM c #a3b9e3", +"g# c #a4bcdf", +"Qt.#.a.b.a.#.cQt.d.e.f.g.e.h.h.i.j.k.l.m.n.o.p.q.r.s.t.r.u.v.w.x", +".y.z.A.B.y.#.C.#.D.E.F.G.H.s.f.I.J.K.K.t.L.M.N.O.P.Q.Q.R.S.T.U.V", +".W.b.X.X.a.W.W.#.c.h.Y.Z.0.1.2.3.4.5.6.7.8.9#.###a#b#c#d#e#f#g#h", +"#i.c#i#i#j.##k#l#k.E.F.l#m#n#m#o.z.c#pQt#q#r#s#t#u#v#w#x#e#y#z#A", +".b#B#C.G#D#E#F.E#G.4.4.e#H#I#J#K#L#M.o#N.F#O.Y.t#P#Q.l#R#S#T#U#V", +".r#W#G.f.v#X#Y#Z.e.6#0.h#1#2#3#4#5.T.T#6.h.e#7#8#9a.a##9aa.Kabac", +"adaeafag.rahaiaj.E.6#W#0.Jakalamanaoap#Z.C.D.D#ka#aqararasatau#6", +"av#6.cawaxayazaj.haA.r#WaB#OaCaDaEaFajaGaH#V#VaI.HaJ.s.faKapaL.o", +"aMaNaOaPaQ.taRaSaTaUaVaWaXaYasaZ.#a0a1a2a3.h.5a4a5#p.b.caKa6a7a8", +"a9b.b#ajbabbbcbdbebfbgbhbiabbjbkacaxblbmaY#G#0bn.b.##i.Wafaxbo#P", +"bpbqbrbsbtbubvbwbxbybzbAbBbCas#T.s.1#mbD.h.6a3.e.D.y.b.abE.HbFa6", +"bGbHbIbJbKbLbMbNbObPb.bQ#SbRas.k#CbS#LbT.r.s.ibU.ybVbW.dbXbYbZaH", +"b0bX.Nb1b2b3#nai#i#i#i.X.d.c#i#ib4b5#0b6b7#hb8b9c.a9#rc#ca.ZaB#6", +"aucbcccdcecfcg.b.a.a.a.a.y.X.b.Daichcicjckclcmcn.yaEco.Wcp.Ka1.Y", +".Ccqcrb4csctcucv.a#i#i.W.acw.c.Wa4aKcx#ncwcy.WczcAcgcBcCcDcDcEcB", +"cFag#XcGcHcIcJ#.cKQt.cb#cLcMcNcOaccPagcQcRcScTcUcVcW.Y.yawcXcXcY", +"cZ.#c0c1c2c3c4c5c6c7.gauc8c9d.d#dadbdc.bdddedfdgdhdidjdkaEdldldf", +"codmdndodpdqdrdsdtc7.jdudvdwdxdydzagcDdAdBdldCcYdDdEdFdGdldfdldl", +".taYaYaxdHdIb5a9.l#1.Ga9bXdJdKcEdLdMdNdOdPdQdRdSdTdUdVdWdXdldCdC", +"cQcAdY.zdZd0d1d2a7#1d3aad4d5d6d7dCd8d9e.e#a7eaebecedeeefeadRcEeg", +"aAeh.4.icAc..5.yeib2ejek.jelao.WemeneoepeqeresbrcoeteubFdHaueh.a", +"bn.E.6a3#1.Jeh#kevew.h.Y#Texc.apageyezeAeBeCeDeEcv#Za7eFeGb.ba#Y", +"#GdKeHaYcu#OaxeIch.aci.reJeKaB.f#VeyeLbDeMckeNbEeOePeLeQeh.ceReS", +"cveEeH.H#1.feT.DeU.g#oa8eVeWeX.JeYbF#1#oeZbQe0e1e2e3e4e5#ichemcD", +"e6e7e8.0.Je9.Daj.a.4.Jdtf.f#evfa#G.4dK.h#0.6dmew.abmfbfcdXfdcDdM", +"fefffga#cheSfhfi#i#0.sfjfkflfmfn#o#1aCev#Yfofofo#YaLfpdfdlememem", +"fqfrfsftaCa0fuaw#i.h.rdn.Yfvfwfxfyfz.DfAdXdfdXdXfB.K#WfCdleSdMag", +"fDfEfFfGfHfIfJ.kfK.f.fcffLfMfNfOeOezchfPfQfCcXdWeufRbVfScXfTfUea", +"fVewc..lfWfXfYfZb2eAfp.faua9.j#1.zf0.aeI.W.#f1f2dCdBf3d8f4fTf5f6", +"f7agf8a0f9g.g#gagbgcgdge.ldt.ldt.b.c#i.dgfbYfz#fdHdPgg#ygheRgigj", +".#bFax.Kgkglgmgngogpgqgrfjcudn.j.y.#.C.WcAcpgsgtgu#m#mgvgwgxgygz", +"gAgBgCgDgEgFgGgHgIgJadfz.kc6gK#1gLcy.DcEcEfdajgMgNb.gOgPgQgRgSgT"}; diff --git a/noncore/games/kcheckers/pics/marble3.xpm b/noncore/games/kcheckers/pics/marble3.xpm new file mode 100644 index 0000000..36c9b17 --- a/dev/null +++ b/noncore/games/kcheckers/pics/marble3.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static const char *marble3[]={ +"28 28 2 1", +"# c None", +". c #0000ff", +"............................", +"............................", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"............................", +"............................"}; diff --git a/noncore/games/kcheckers/pics/wood1.xpm b/noncore/games/kcheckers/pics/wood1.xpm new file mode 100644 index 0000000..866f8d9 --- a/dev/null +++ b/noncore/games/kcheckers/pics/wood1.xpm @@ -0,0 +1,117 @@ +/* XPM */ +static const char *wood1[]={ +"32 32 82 2", +"#c c #9c825c", +".H c #9c8664", +"#p c #a48a64", +"#f c #a48a6c", +".I c #a48e64", +".G c #a48e6c", +".X c #a4926c", +"#g c #ac8a6c", +".u c #ac8e6c", +"#o c #ac8e74", +".b c #ac926c", +".c c #ac9274", +".d c #ac966c", +"Qt c #ac9674", +".j c #ac9a74", +"#b c #ac9a7c", +".w c #ac9e74", +".V c #b49274", +".A c #b49674", +".W c #b4967c", +".S c #b49a6c", +".s c #b49a74", +".t c #b49a7c", +".U c #b49e74", +".i c #b49e7c", +".2 c #b49e84", +".f c #b4a27c", +".q c #b4a284", +".k c #b4a67c", +"#n c #b4a684", +".P c #bc9a74", +"#d c #bc9a7c", +".R c #bc9e74", +".# c #bc9e7c", +".1 c #bc9e84", +".g c #bca27c", +".v c #bca284", +".F c #bca67c", +".a c #bca684", +"#. c #bcaa7c", +".h c #bcaa84", +".p c #bcaa8c", +"#a c #bcae84", +".n c #bcae8c", +".8 c #bcb28c", +"#j c #c49e84", +".K c #c4a27c", +".O c #c4a284", +".N c #c4a67c", +".D c #c4a684", +"#e c #c4a68c", +"#i c #c4aa7c", +".e c #c4aa84", +".z c #c4aa8c", +".T c #c4ae84", +".r c #c4ae8c", +".l c #c4b28c", +".o c #c4b294", +".C c #c4b68c", +".7 c #c4b694", +"#l c #c4ba94", +".L c #ccaa8c", +".Q c #ccae84", +".E c #ccae8c", +".Z c #ccae94", +".6 c #ccb284", +".B c #ccb28c", +".J c #ccb294", +".M c #ccb68c", +".x c #ccb694", +".0 c #ccb69c", +".m c #ccba94", +"#m c #ccba9c", +".5 c #ccbe94", +".9 c #ccc29c", +".Y c #d4b694", +".y c #d4ba94", +"#h c #d4ba9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z.x.y.4.x.r.B.z.a.z.r.r.e.a.r.z.a.a.a.v.a.T.l.e.iQtQt.s.#.#", +".a.a.r.x.y.x.D.i#o#p.GQt.i.v.D.r.r.z.h.z.r.r.r.J.r.r.B.x.B.#.A.b"}; diff --git a/noncore/games/kcheckers/pics/wood2.xpm b/noncore/games/kcheckers/pics/wood2.xpm new file mode 100644 index 0000000..c2ff364 --- a/dev/null +++ b/noncore/games/kcheckers/pics/wood2.xpm @@ -0,0 +1,114 @@ +/* XPM */ +static const char *wood2[]={ +"32 32 79 2", +"#k c #484c4d", +"#l c #484d47", +"#m c #494a46", +"#d c #4c4841", +"#j c #4c4c48", +".1 c #4e554d", +".9 c #4f483f", +"#e c #4f4c44", +".0 c #4f4f48", +".Z c #4f524d", +".2 c #4f564e", +".X c #515450", +".W c #51564e", +".V c #52574f", +"#. c #544e45", +".U c #545047", +".Y c #54524a", +".8 c #575046", +".T c #575248", +".7 c #57554c", +".t c #57564d", +".B c #575751", +".u c #58574f", +".a c #585950", +".A c #585d52", +".v c #5c584f", +".G c #5d564a", +".# c #5d5a54", +".Q c #5e5649", +".z c #5e5a4f", +".y c #5e5d51", +"Qt c #5e5e55", +".C c #5e5e57", +".E c #5f5a4f", +".x c #5f5e51", +".w c #5f5f54", +".b c #5f6056", +".3 c #615749", +".H c #615d4e", +".F c #615d54", +".n c #615f52", +".c c #615f56", +".S c #625a4d", +".o c #645f57", +".s c #646056", +".D c #646256", +".d c #646258", +".R c #655e4f", +".m c #655f50", +".e c #65675d", +".q c #666657", +".4 c #675d4e", +".l c #675f54", +".p c #676156", +".k c #676456", +".r c #67645a", +".P c #696054", +".j c #696456", +".5 c #69665c", +"#i c #696759", +".I c #6a6657", +".f c #6a675e", +"#h c #6c6a5d", +".L c #6d6152", +".O c #6f6758", +".i c #6f6759", +".h c #6f695d", +".g c #6f6c5e", +"#f c #6f6f62", +".N c #706250", +".M c #706757", +".J c #746c5c", +"## c #766756", +".K c #776f5f", +"#a c #796c57", +".6 c #7d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x.n.c.s.r.5.r.r.p.p.p.p.p.r.r.r.r.r", +"###a#a.6.6#g#g.6.6.g.g#h.5.r.r.q.r.d.s.c.w.w.x.w.w.w.w.x.F.F.F.F"}; diff --git a/noncore/games/kcheckers/pics/wood3.xpm b/noncore/games/kcheckers/pics/wood3.xpm new file mode 100644 index 0000000..5f4f7e2 --- a/dev/null +++ b/noncore/games/kcheckers/pics/wood3.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static const char *wood3[]={ +"28 28 2 1", +"# c None", +". c #ff8c00", +"............................", +"............................", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"............................", +"............................"}; diff --git a/noncore/games/kcheckers/rcheckers.cpp b/noncore/games/kcheckers/rcheckers.cpp new file mode 100644 index 0000000..a1c7afa --- a/dev/null +++ b/noncore/games/kcheckers/rcheckers.cpp @@ -0,0 +1,476 @@ +// +// Russian Checkers + + +#include "rcheckers.h" + + +/////////////////////////////////////////////////// +// +// User Functions +// +/////////////////////////////////////////////////// + + +bool RCheckers::go1(int from,int field) +{ + to=field; + + if(checkCapture1()) + { + bool capture=false; + switch(board[from]) + { + case MAN1: + if(manCapture1(from,UL,capture)) return true; + if(manCapture1(from,UR,capture)) return true; + if(manCapture1(from,DL,capture)) return true; + if(manCapture1(from,DR,capture)) return true; + return false; + case KING1: + if(kingCapture1(from,UL,capture)) return true; + if(kingCapture1(from,UR,capture)) return true; + if(kingCapture1(from,DL,capture)) return true; + if(kingCapture1(from,DR,capture)) return true; + return false; + } + } + else + { + switch(board[from]) + { + case MAN1: + if((to==(from-6))||(to==(from-5))) + { + board[from]=FREE; + if(to<10) board[to]=KING1; + else board[to]=MAN1; + return true; + } + return false; + case KING1: + for(int i=from-6;;i-=6) + { + if(i==to) + { + board[from]=FREE; + board[to]=KING1; + return true; + } + else if(board[i]==FREE) continue; + else break; + } + for(int i=from-5;;i-=5) + { + if(i==to) + { + board[from]=FREE; + board[to]=KING1; + return true; + } + else if(board[i]==FREE) continue; + else break; + } + for(int i=from+5;;i+=5) + { + if(i==to) + { + board[from]=FREE; + board[to]=KING1; + return true; + } + else if(board[i]==FREE) continue; + else break; + } + for(int i=from+6;;i+=6) + { + if(i==to) + { + board[from]=FREE; + board[to]=KING1; + return true; + } + else if(board[i]==FREE) continue; + else break; + } + return false; + } + } + return false; +} + + +bool RCheckers::checkCapture1() +{ + for(int i=6;i<48;i++) + { + switch(board[i]) + { + case MAN1: + if(board[i-6]==MAN2 || board[i-6]==KING2) + if(board[i-12]==FREE) return true; + if(board[i-5]==MAN2 || board[i-5]==KING2) + if(board[i-10]==FREE) return true; + if(board[i+5]==MAN2 || board[i+5]==KING2) + if(board[i+10]==FREE) return true; + if(board[i+6]==MAN2 || board[i+6]==KING2) + if(board[i+12]==FREE) return true; + break; + case KING1: + int k; + for(k=i-6;board[k]==FREE;k-=6); + if(board[k]==MAN2 || board[k]==KING2) + if(board[k-6]==FREE) return true; + + for(k=i-5;board[k]==FREE;k-=5); + if(board[k]==MAN2 || board[k]==KING2) + if(board[k-5]==FREE) return true; + + for(k=i+5;board[k]==FREE;k+=5); + if(board[k]==MAN2 || board[k]==KING2) + if(board[k+5]==FREE) return true; + + for(k=i+6;board[k]==FREE;k+=6); + if(board[k]==MAN2 || board[k]==KING2) + if(board[k+6]==FREE) return true; + } + } + return false; +} + + +// Return TRUE if a course of the user true +// Return FALSE if a course of the user incorrect + +bool RCheckers::manCapture1(int from,int direction,bool &capture) +{ + int i=from+direction; + if(board[i]==MAN2 || board[i]==KING2) + { + int k=i+direction; + if(board[k]==FREE) + { + bool next=false; + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + + if(k<10) + { + board[k]=KING1; + if(kingCapture1(k,direction+11,next)) {board[i]=FREE;return true;} + } + else + { + board[k]=MAN1; + if(direction==UL || direction==DR) + { + if(manCapture1(k,UR,next)) {board[i]=FREE;return true;} + if(manCapture1(k,DL,next)) {board[i]=FREE;return true;} + } + else + { + if(manCapture1(k,UL,next)) {board[i]=FREE;return true;} + if(manCapture1(k,DR,next)) {board[i]=FREE;return true;} + } + if(manCapture1(k,direction,next)) {board[i]=FREE;return true;} + } + + if((!next) && k==to) {board[i]=FREE;return true;} + + board[k]=FREE; + board[i]=save; + board[from]=MAN1; + capture=true; + } + } + return false; +} + + +bool RCheckers::kingCapture1(int from,int direction,bool &capture) +{ + int i; + for(i=from+direction;board[i]==FREE;i+=direction); + + if(board[i]==MAN2 || board[i]==KING2) + { + int k=i+direction; + if(board[k]==FREE) + { + bool next=false; + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + + for(;board[k]==FREE;k+=direction) + { + board[k]=KING1; + if(direction==UL || direction==DR) + { + if(kingCapture1(k,UR,next)) {board[i]=FREE;return true;} + if(kingCapture1(k,DL,next)) {board[i]=FREE;return true;} + } + else + { + if(kingCapture1(k,UL,next)) {board[i]=FREE;return true;} + if(kingCapture1(k,DR,next)) {board[i]=FREE;return true;} + } + board[k]=FREE; + } + + board[k-=direction]=KING1; + if(kingCapture1(k,direction,next)) {board[i]=FREE;return true;} + board[k]=FREE; + + if(!next) + for(;k!=i;k-=direction) + if(k==to) {board[i]=FREE;board[k]=KING1;return true;} + + board[i]=save; + board[from]=KING1; + capture=true; + } + } + return false; +} + + +//////////////////////////////////////////////////// +// +// Computer Functions +// +//////////////////////////////////////////////////// + + +void RCheckers::kingMove2(int from,int &resMax) +{ + board[from]=FREE; + for(int i=from-6;board[i]==FREE;i-=6) + { + board[i]=KING2; + turn(resMax); + board[i]=FREE; + } + for(int i=from-5;board[i]==FREE;i-=5) + { + board[i]=KING2; + turn(resMax); + board[i]=FREE; + } + for(int i=from+5;board[i]==FREE;i+=5) + { + board[i]=KING2; + turn(resMax); + board[i]=FREE; + } + for(int i=from+6;board[i]==FREE;i+=6) + { + board[i]=KING2; + turn(resMax); + board[i]=FREE; + } + board[from]=KING2; +} + + +bool RCheckers::checkCapture2() +{ + for(int i=6;i<48;i++) + { + switch(board[i]) + { + case MAN2: + if(board[i-6]==MAN1 || board[i-6]==KING1) + if(board[i-12]==FREE) return true; + if(board[i-5]==MAN1 || board[i-5]==KING1) + if(board[i-10]==FREE) return true; + if(board[i+5]==MAN1 || board[i+5]==KING1) + if(board[i+10]==FREE) return true; + if(board[i+6]==MAN1 || board[i+6]==KING1) + if(board[i+12]==FREE) return true; + break; + case KING2: + int k; + for(k=i-6;board[k]==FREE;k-=6); + if(board[k]==MAN1 || board[k]==KING1) + if(board[k-6]==FREE) return true; + + for(k=i-5;board[k]==FREE;k-=5); + if(board[k]==MAN1 || board[k]==KING1) + if(board[k-5]==FREE) return true; + + for(k=i+5;board[k]==FREE;k+=5); + if(board[k]==MAN1 || board[k]==KING1) + if(board[k+5]==FREE) return true; + + for(k=i+6;board[k]==FREE;k+=6); + if(board[k]==MAN1 || board[k]==KING1) + if(board[k+6]==FREE) return true; + } + } + return false; +} + + +// Return TRUE if it is possible to capture +// Return FALSE if it is impossible to capture + +bool RCheckers::manCapture2(int from,int &resMax) +{ + bool capture=false; + + int i=from-6; + if(board[i]==MAN1 || board[i]==KING1) + { + int k=from-12; + if(board[k]==FREE) + { + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + board[k]=MAN2; + resMax--; + if(!manCapture2(k,resMax)) turn(resMax,true); + resMax++; + board[k]=FREE; + board[i]=save; + board[from]=MAN2; + capture=true; + } + } + + i=from-5; + if(board[i]==MAN1 || board[i]==KING1) + { + int k=from-10; + if(board[k]==FREE) + { + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + board[k]=MAN2; + resMax--; + if(!manCapture2(k,resMax)) turn(resMax,true); + resMax++; + board[k]=FREE; + board[i]=save; + board[from]=MAN2; + capture=true; + } + } + + i=from+5; + if(board[i]==MAN1 || board[i]==KING1) + { + int k=from+10; + if(board[k]==FREE) + { + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + resMax--; + if(from>32) + { + board[k]=KING2; + if(!kingCapture2(k,UL,resMax)) turn(resMax,true); + } + else + { + board[k]=MAN2; + if(!manCapture2(k,resMax)) turn(resMax,true); + } + resMax++; + board[k]=FREE; + board[i]=save; + board[from]=MAN2; + capture=true; + } + } + + i=from+6; + if(board[i]==MAN1 || board[i]==KING1) + { + int k=from+12; + if(board[k]==FREE) + { + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + resMax--; + if(from>32) + { + board[k]=KING2; + if(!kingCapture2(k,UR,resMax)) turn(resMax,true); + } + else + { + board[k]=MAN2; + if(!manCapture2(k,resMax)) turn(resMax,true); + } + resMax++; + board[k]=FREE; + board[i]=save; + board[from]=MAN2; + capture=true; + } + } + + if(capture) return true; + return false; +} + + +bool RCheckers::kingCapture2(int from,int direction,int &resMax) +{ + int i; + for(i=from+direction;board[i]==FREE;i+=direction); + + if(board[i]==MAN1 || board[i]==KING1) + { + int k=i+direction; + if(board[k]==FREE) + { + bool capture=false; + int save=board[i]; + board[from]=FREE; + board[i]=NONE; + resMax--; + + for(;board[k]==FREE;k+=direction) + { + board[k]=KING2; + if(direction==UL || direction==DR) + { + if(kingCapture2(k,UR,resMax)) capture=true; + if(kingCapture2(k,DL,resMax)) capture=true; + } + else + { + if(kingCapture2(k,UL,resMax)) capture=true; + if(kingCapture2(k,DR,resMax)) capture=true; + } + board[k]=FREE; + } + + board[k-=direction]=KING2; + if(kingCapture2(k,direction,resMax)) capture=true; + board[k]=FREE; + + if(!capture) + for(;k!=i;k-=direction) + { + board[k]=KING2; + turn(resMax,true); + board[k]=FREE; + } + + resMax++; + board[i]=save; + board[from]=KING2; + return true; + } + } + return false; +} + diff --git a/noncore/games/kcheckers/rcheckers.h b/noncore/games/kcheckers/rcheckers.h new file mode 100644 index 0000000..d44bfd1 --- a/dev/null +++ b/noncore/games/kcheckers/rcheckers.h @@ -0,0 +1,28 @@ + +#ifndef RCHECKERS_H +#define RCHECKERS_H + +#include <checkers.h> + + +class RCheckers:public Checkers +{ + public: + RCheckers(int skill):Checkers(skill){}; + bool go1(int,int); + + bool checkCapture1(); + bool checkCapture2(); + + private: + void kingMove2(int,int &); + + bool manCapture1(int,int,bool &); + bool kingCapture1(int,int,bool &); + + bool manCapture2(int,int &); + bool kingCapture2(int,int,int &); + +}; + +#endif diff --git a/pics/KCheckers.xpm b/pics/KCheckers.xpm new file mode 100644 index 0000000..6570d88 --- a/dev/null +++ b/pics/KCheckers.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static const char *biglogo[]={ +"32 32 6 1", +". c None", +"# c #000000", +"a c #303030", +"d c #d7d7d7", +"c c #eaeaea", +"b c #ffffff", +"................................", +"................................", +"................................", +"................................", +"....########################....", +"....#aaaaaaaaaaaaaaaaaaaaaa#....", +"....#abbbbbbbbbb##########a#....", +"....#abbbbbbbcbc##########a#....", +"....#abbbbbbbbbb##########a#....", +"....#abbbbbcbcbc##########a#....", +"....#abbbbbbbbbb##########a#....", +"....#abbbcbcbcbc##########a#....", +"....#abbbbbbbbbc##########a#....", +"....#abcbcbcbbcc##########a#....", +"....#abbbbbbbccc##########a#....", +"....#abcbcbccccc##########a#....", +"....#a##########cccccccccca#....", +"....#a##########cccccccccca#....", +"....#a##########ccccccccdca#....", +"....#a##########cccccccccca#....", +"....#a##########ccccccdcdca#....", +"....#a##########cccccccccca#....", +"....#a##########ccccdcdcdca#....", +"....#a##########cccccccccda#....", +"....#a##########ccdcdcdcdca#....", +"....#a##########cccccccdcda#....", +"....#aaaaaaaaaaaaaaaaaaaaaa#....", +"....########################....", +"................................", +"................................", +"................................", +"................................"}; |