openpref-0.1.3/0000755000175000017500000000000011265437521012745 5ustar kostyakostyaopenpref-0.1.3/src/0000755000175000017500000000000011265437521013534 5ustar kostyakostyaopenpref-0.1.3/src/ui/0000755000175000017500000000000011265437521014151 5ustar kostyakostyaopenpref-0.1.3/src/ui/newgameform.ui0000644000175000017500000002441311265177055017026 0ustar kostyakostya NewGameDialog Qt::ApplicationModal 0 0 460 310 0 0 460 310 460 310 false New Game ../../../../pics/newgame.png../../../../pics/newgame.png false true 10 270 441 32 Qt::Horizontal QDialogButtonBox::Ok true 10 70 205 90 Player 1 (left) 20 70 181 20 Increase difficulty AlphaBeta algorithm 20 20 52 15 Name: 20 40 151 21 Name of opponent (for chart) 232 10 220 250 Conventions 30 85 171 20 0 0 In six of spades game all opponents must whist &Stalingrad 27 165 171 71 10 game 30 20 121 21 0 0 Check true 30 40 121 21 0 0 In 10 game whister must take at least one trick Whist 10 31 81 20 Pool size: Qt::PlainText Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 30 60 171 20 0 0 &Greedy whist 30 110 181 20 0 0 &Pass-out exit 6-7-7... 100 30 54 21 When all players reach this score in pool the game ends 4 1000 10 30 140 171 20 0 0 Cancel game with penalty of three untaken tricks. No whists are written &Without three 10 170 205 90 Player 2 (right) 20 70 181 20 Increase difficulty AlphaBeta algorithm 20 20 52 15 Name: 20 40 151 21 Name of opponent (for chart) 10 10 205 51 Your name: 20 20 151 21 Your name (to display in chart) buttonBox accepted() NewGameDialog accept() 248 254 157 274 buttonBox rejected() NewGameDialog reject() 316 260 286 274 openpref-0.1.3/src/ui/helpbrowser.ui0000644000175000017500000000113211265177055017044 0ustar kostyakostya HelpBrowser 0 0 356 320 Preferans Rules 0 0 361 321 openpref-0.1.3/src/ui/optform.ui0000755000175000017500000000774511265177055016221 0ustar kostyakostya OptDialog Qt::ApplicationModal 0 0 240 180 240 180 240 180 Options ../../../../pics/tool.png../../../../pics/tool.png true Animation 20 20 171 20 0 0 Animate &deal 20 40 181 20 0 0 Animate &takes true 0 0 Pref&Club Remix true 0 0 Sho&w AI cards (debug) QDialogButtonBox::Cancel|QDialogButtonBox::Ok true buttonBox accepted() OptDialog accept() 112 158 112 89 buttonBox rejected() OptDialog reject() 112 158 112 89 openpref-0.1.3/src/desk/0000755000175000017500000000000011265437521014462 5ustar kostyakostyaopenpref-0.1.3/src/desk/desk.cmake0000644000175000017500000000024511265177055016416 0ustar kostyakostyaproject(openpref) SET ( HEADERS ${HEADERS} src/desk/desktop.h src/desk/deskview.h ) SET ( SOURCES ${SOURCES} src/desk/desktop.cpp src/desk/deskview.cpp )openpref-0.1.3/src/desk/deskview.cpp0000755000175000017500000004543511265177055017030 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "deskview.h" #include "baser.h" #include "card.h" #include "formbid.h" #include "kpref.h" #include "prfconst.h" // change white to yellow static void yellowize (QImage *im, QRgb newColor=qRgb(255, 255, 0)) { for (int y = im->height()-1; y >= 0; y--) { for (int x = im->width()-1; x >= 0; x--) { QRgb p = im->pixel(x, y); if (qRed(p) == 255 && qGreen(p) == 255 && qBlue(p) == 255) { im->setPixel(x, y, newColor); } } } } bool DeskView::loadCards () { //qDebug() << SLOT(slotPushButtonClick95()); for (int f = 0; f < 106; f++) bidIcons[f] = 0; // load cards from resources QString deckPath; if (optPrefClub) { deckPath = "prefclub/"; CARDWIDTH = 56; CARDHEIGHT = 67; } else { deckPath = "classic/"; CARDWIDTH = 71; CARDHEIGHT = 96; } for (int face = 7; face <= 14; face++) { for (int suit = 1; suit <= 4; suit++) { QString fname, resname; resname.sprintf("%i%i", face, suit); fname.sprintf(QString(":/pics/cards/"+deckPath+"%i%i.png").toAscii(), face, suit); cardI[resname] = new QImage(fname); // build highlighted image QImage *im = new QImage(fname); yellowize(im); resname.sprintf("q%i%i", face, suit); cardI[resname] = im; } } // load cardback cardI["1000"] = new QImage(QString(":/pics/cards/"+deckPath+"1000.png")); cardI["empty"] = new QImage(QString(":/pics/cards/"+deckPath+"empty.png")); // load bid icons for (int f = 6; f <= 10; f++) { for (int s = 1; s <= 5; s++) { QString fname; fname.sprintf(":/pics/bids/s%i%i.png", f, s); bidIcons[f*10+s] = new QImage(fname); } } // done return true; } void DeskView::freeCards () { for (int f = 0; f < 106; f++) { if (bidIcons[f]) delete bidIcons[f]; bidIcons[f] = 0; } foreach (QImage *i, cardI) if (i) delete i; cardI.clear(); } QImage *DeskView::GetImgByName (const char *name) { if (!cardI.contains(name)) cardI["empty"]; return cardI[name]; } /////////////////////////////////////////////////////////////////////////////// bool SleepEventFilter::eventFilter (QObject *obj, QEvent *e) { Q_UNUSED(obj) // if (e->type() == QEvent::KeyPress) { QKeyEvent *event = static_cast(e); mLoop->doEventKey(event); } else if (e->type() == QEvent::MouseButtonPress) { QMouseEvent *event = static_cast(e); mLoop->doEventMouse(event); } return false; // event is not tasty } /////////////////////////////////////////////////////////////////////////////// void SleepEventLoop::doEventKey (QKeyEvent *event) { qDebug() << event->key(); if (mIgnoreKey) return; switch (event->key()) { case Qt::Key_Escape: case Qt::Key_Enter: case Qt::Key_Return: case Qt::Key_Space: mKeyPressed = true; quit(); break; default: ; } } void SleepEventLoop::doEventMouse (QMouseEvent *event) { if (mIgnoreMouse) return; if (event->button() == Qt::LeftButton) { mMousePressed = true; mMouseX = event->x(); mMouseY = event->y(); //qDebug() << "mouse! x:" << mMouseX << "y:" << mMouseY; quit(); } } void SleepEventLoop::keyPicUpdate () { if (optPrefClub == true) { mDeskView->drawPKeyBmp(true); mDeskView->emitRepaint(); } } /////////////////////////////////////////////////////////////////////////////// DeskView::DeskView (int aW, int aH) : mDeskBmp(0) { mDigitsBmp = new QImage(QString(":/pics/digits/digits.png")); mBidBmp = new QImage(QString(":/pics/bidinfo.png")); mKeyBmp[0] = new QImage(QString(":/pics/presskey.png")); mKeyBmp[1] = new QImage(QString(":/pics/presskey.png")); yellowize(mKeyBmp[1], qRgb(127, 127, 127)); mIMoveBmp = new QImage(QString(":/pics/imove.png")); if (!loadCards()) abort(); Event = 0; CardWidht = CARDWIDTH; CardHeight = CARDHEIGHT; xBorder = 20; yBorder = 20; DesktopWidth = aW; DesktopHeight = aH; //mDeskBmp = new QPixmap(DesktopWidth, DesktopHeight); ClearScreen(); } DeskView::~DeskView () { if (mDeskBmp) delete mDeskBmp; freeCards(); delete mIMoveBmp; delete mKeyBmp[0]; delete mKeyBmp[1]; delete mBidBmp; delete mDigitsBmp; } void DeskView::emitRepaint () { emit deskChanged(); } void DeskView::drawIMove (int x, int y) { if (!mDeskBmp) return; QPainter p(mDeskBmp); p.drawImage(x, y, *mIMoveBmp); p.end(); } void DeskView::drawPKeyBmp (bool show) { static int phase = 0; if (!mDeskBmp) return; /* time_t tt = time(0); int phase = tt%2; */ QImage *i = mKeyBmp[phase]; if (show) { QPainter p(mDeskBmp); p.drawImage(4, DesktopHeight-(i->height()+8), *i); p.end(); phase = 1-phase; } else { ClearBox(4, DesktopHeight-(i->height()+8), i->width(), i->height()); } } void DeskView::drawBmpChar (QPainter &p, int x0, int y0, int cx, int cy) { QRect tgt(x0, y0, 8, 14); QRect src(cx, cy, 8, 14); p.drawImage(tgt, *mDigitsBmp, src); } void DeskView::drawNumber (int x0, int y0, int n, bool red) { if (!mDeskBmp || n < 0 || n > 1024) return; char buf[12], *pd; sprintf(buf, "%i", n); pd = buf; QPainter p(mDeskBmp); while (*pd) { int d = (*pd++)-'0'; int px = d*8, py = red?14:0; if (red) drawBmpChar(p, x0+1, y0+1, px, 0); drawBmpChar(p, x0, y0, px, py); x0 += 8; } p.end(); } static int numWidth (int n) { if (n < 0 || n > 1024) return 0; char buf[16]; sprintf(buf, "%i", n); return strlen(buf)*8; } void DeskView::drawGameBid (eGameBid game) { if (!mDeskBmp) return; if (game != raspass && (game < 61 || game > 105)) return; // unknown game QPainter p(mDeskBmp); int x, y; QImage *i; switch (game) { case raspass: drawBmpChar(p, bidBmpX+44-4, bidBmpY+34-7, 80, 0); break; case g86: // misere drawBmpChar(p, bidBmpX+44-4, bidBmpY+34-7, 80, 14); break; default: i = bidIcons[(int)game]; if (i) { x = 44-(i->width()/2)+3; y = 34-(i->height()/2)-1; p.drawImage(bidBmpX+x, bidBmpY+y, *i); } break; } p.end(); } /* game: * <0: none * =0: misere * suit: * =0: nt * plrAct: 0-3 */ void DeskView::drawBidsBmp (int plrAct, int p0t, int p1t, int p2t, eGameBid game) { if (!mDeskBmp) return; QImage *i = mBidBmp; bidBmpX = DesktopWidth-(i->width()+8); bidBmpY = DesktopHeight-(i->height()+8); QPainter p(mDeskBmp); p.drawImage(bidBmpX, bidBmpY, *i); p.end(); /* * p0t: 10,6 (left top) * p1t: 77,6 (right top) * p2t: 44,50 (bottom center) * bid: 44,34 (center) */ // human if (p0t >= 0) { int wdt = numWidth(p0t); int x = 44-(wdt/2); drawNumber(bidBmpX+x, bidBmpY+50, p0t, plrAct==1); } // left-top ai if (p1t >= 0) { drawNumber(bidBmpX+10, bidBmpY+6, p1t, plrAct==2); } // right-top ai if (p2t >= 0) { int wdt = numWidth(p2t); int x = 77-wdt; drawNumber(bidBmpX+x, bidBmpY+6, p2t, plrAct==3); } drawGameBid(game); } void DeskView::mySleep (int seconds) { Event = 0; SleepEventLoop eloop(this); SleepEventFilter efilter(&eloop); qApp->installEventFilter(&efilter); QTimer *timer = new QTimer(&eloop); if (seconds == 0) { /*if (optPrefClub == false) seconds=1; else {*/ drawPKeyBmp(false); emitRepaint(); qApp->processEvents(QEventLoop::WaitForMoreEvents); qApp->sendPostedEvents(); return; //} } if (seconds > 0) { connect(timer, SIGNAL(timeout()), &eloop, SLOT(quit())); timer->start(seconds*1000); } else if (seconds == -1) { connect(timer, SIGNAL(timeout()), &eloop, SLOT(keyPicUpdate())); timer->start(1000); } else if (seconds < -1) { eloop.mIgnoreKey = true; } if (optPrefClub == true) drawPKeyBmp(seconds == -1); emitRepaint(); eloop.exec(); qApp->removeEventFilter(&efilter); Event = (eloop.mMousePressed) ? 1 : (eloop.mKeyPressed ? 2 : 3); if (seconds == -1) { drawPKeyBmp(false); emitRepaint(); } } void DeskView::aniSleep (int milliseconds) { Event = 0; SleepEventLoop eloop(this); eloop.mIgnoreMouse = true; eloop.mIgnoreKey = true; SleepEventFilter efilter(&eloop); qApp->installEventFilter(&efilter); QTimer *timer = new QTimer(&eloop); connect(timer, SIGNAL(timeout()), &eloop, SLOT(quit())); timer->start(milliseconds); emitRepaint(); eloop.exec(); qApp->removeEventFilter(&efilter); } void DeskView::ClearScreen () { if (!mDeskBmp || (mDeskBmp->width() != DesktopWidth || mDeskBmp->height() != DesktopHeight)) { if (mDeskBmp) delete mDeskBmp; //mDeskBmp = new QPixmap(DesktopWidth, DesktopHeight); mDeskBmp = new QImage(DesktopWidth, DesktopHeight, QImage::Format_ARGB32); } ClearBox(0, 0, DesktopWidth, DesktopHeight); } void DeskView::ClearBox (int x1, int y1, int x2, int y2) { if (!mDeskBmp) return; QPainter p(mDeskBmp); //QBrush brush(qRgb(0, 128, 0)); QBrush brush(QImage(":/pics/cloth.png")); QRect NewRect = QRect(x1, y1, x2, y2); p.fillRect(NewRect, brush); p.end(); } void DeskView::drawCard (Card *card, int x, int y, bool opened, bool hilight) { char cCardName[16]; if (!mDeskBmp) return; cCardName[0] = 0; if (!card) { ClearBox(x, y, x+CARDWIDTH, y+CARDHEIGHT); return; } strcpy(cCardName, opened?"empty":"1000"); //opened = true; if (opened && card->face() >= 7 && card->face() <= FACE_ACE && card->suit() >= 1 && card->suit() <= 4) { sprintf(cCardName, "%s%i%i", hilight?"q":"", card->face(), card->suit()); //if (hilight) fprintf(stderr, "SELECTED! [%s]\n", cCardName); } QImage *bmp = GetImgByName(cCardName); if (!bmp) { //fprintf(stderr, "not found: [%s]\n", cCardName); bmp = GetImgByName("empty"); if (!bmp) { ClearBox(x, y, x+CARDWIDTH, y+CARDHEIGHT); return; } } //fprintf(stderr, "found: [%s]\n", cCardName); QPainter p(mDeskBmp); p.drawImage(x, y, *bmp); p.end(); } void DeskView::drawText (const QString &str, int x, int y, QRgb textColor, QRgb outlineColor) { if (!mDeskBmp) return; QString s(str); s.replace("\1s", QChar((ushort)0x2660)); s.replace("\1c", QChar((ushort)0x2663)); s.replace("\1d", QChar((ushort)0x2666)); s.replace("\1h", QChar((ushort)0x2665)); s = s.trimmed(); QPainter p(mDeskBmp); p.setPen(outlineColor); QBrush b(p.brush()); b.setColor(outlineColor); p.setBrush(b); y += FONTSIZE; for (int dy = -1; dy <= 1; dy++) { for (int dx = -1; dx <= 1; dx++) { if (dx || dy) p.drawText(x+dx, y+dy, s); } } p.setPen(textColor); b.setColor(textColor); p.setBrush(b); p.drawText(x, y, s); p.end(); } void DeskView::MessageBox (const QString &text, const QString &caption) { QMessageBox mb(caption, text, QMessageBox::Information, QMessageBox::Ok | QMessageBox::Default, 0, 0); mb.exec(); } void DeskView::ShowBlankPaper (int optMaxPool) { int PaperWidth = 410; int PaperHeight = 530; int PoolWidth = 40; // 190 // 307 // if (!mDeskBmp) return; xDelta = (DesktopWidth-PaperWidth)/2; yDelta = (DesktopHeight-PaperHeight)/2; //char buff[16]; QPainter p(mDeskBmp); QRect NewRect = QRect(xDelta, yDelta, PaperWidth, PaperHeight); QBrush shadow(qRgba(0, 0, 0, 128)); NewRect.adjust(6, 6, 6, 6); p.fillRect(NewRect, shadow); NewRect.adjust(-6, -6, -6, -6); QBrush brush(qRgb(255, 255, 255)); p.fillRect(NewRect, brush); QBrush b1(brush); b1.setColor(qRgb(255, 255, 0)); p.setBrush(b1); p.setPen(qRgb(0, 0, 0)); // Draw borders of paper p.drawLine(xDelta, yDelta, xDelta+PaperWidth, yDelta); p.drawLine(xDelta, yDelta, xDelta, yDelta+PaperHeight); p.drawLine(xDelta, yDelta+PaperHeight, xDelta+PaperWidth, yDelta+PaperHeight); p.drawLine(xDelta+PaperWidth, yDelta, xDelta+PaperWidth, yDelta+PaperHeight); // Circle with MaxPool value p.drawEllipse(xDelta+PaperWidth/2-18,yDelta+277,36,36); // Diagonal lines from bottom corners to circle p.drawLine(xDelta+PaperWidth, yDelta+PaperHeight, xDelta+PaperWidth-190, yDelta+307); p.drawLine(xDelta+0, yDelta+PaperHeight, xDelta+190, yDelta+307); // Central vertical line p.drawLine(xDelta+PaperWidth/2, yDelta+277, xDelta+PaperWidth/2, yDelta+0); // External border of pool p.drawLine(xDelta+PoolWidth, yDelta+0, xDelta+PoolWidth, yDelta+483); p.drawLine(xDelta+PoolWidth, yDelta+483, xDelta+370, yDelta+483); p.drawLine(xDelta+370, yDelta+483, xDelta+370, yDelta+0); //p.drawLine(xDelta+370, yDelta+0, xDelta+80, yDelta+0); // Border of mountain p.drawLine(xDelta+2*PoolWidth, yDelta+0, xDelta+2*PoolWidth, yDelta+436); p.drawLine(xDelta+2*PoolWidth, yDelta+436, xDelta+330, yDelta+436); p.drawLine(xDelta+330, yDelta+436, xDelta+330, yDelta+0); p.drawLine(xDelta+0, yDelta+255, xDelta+PoolWidth, yDelta+255); p.drawLine(xDelta+PaperWidth, yDelta+255, xDelta+370, yDelta+255); p.drawLine(xDelta+PaperWidth/2, yDelta+PaperHeight, xDelta+PaperWidth/2, yDelta+483); // Draw text // MaxPool //p.drawText(xDelta+197, FONTSIZE+yDelta+292, buff); p.drawText(QRect(xDelta+PaperWidth/2-18,yDelta+277,36,36), QString::number(optMaxPool), QTextOption(Qt::AlignCenter)); // Players' names p.setBrush(brush); p.drawText(QRect(xDelta+150,yDelta+350,110,20),optHumanName,QTextOption(Qt::AlignHCenter)); drawRotatedText(p,xDelta+175,yDelta+200,110,20,90,optPlayerName1); drawRotatedText(p,xDelta+235,yDelta+310,110,20,-90,optPlayerName2); p.end(); } void DeskView::StatusBar (const QString &text) { qDebug() << text; //kpref->StatusBar1->showMessage(text); } void DeskView::showPlayerScore (int i, const QString &sb, const QString &sm, const QString &slv, const QString &srv, const QString &tv) { if (!mDeskBmp) return; QPainter p(mDeskBmp); p.setPen(qRgb(0, 0, 0)); QFont fnt(p.font()); fnt.setBold(false); p.setFont(fnt); switch (i) { case 1: p.setPen(qRgb(0, 128, 0)); p.drawText(xDelta+65, FONTSIZE+yDelta+450, sb); p.setPen(qRgb(255, 0, 0)); p.drawText(xDelta+105, FONTSIZE+yDelta+420, sm); p.setPen(qRgb(0, 0, 0)); p.drawText(xDelta+15, FONTSIZE+yDelta+510, slv); p.drawText(xDelta+220, FONTSIZE+yDelta+510, srv); p.setPen(qRgb(0, 0, 255)); fnt.setBold(true); p.setFont(fnt); p.drawText(xDelta+188, FONTSIZE+yDelta+390, tv); break; case 2: p.setPen(qRgb(0, 128, 0)); drawRotatedText(p, xDelta+60, FONTSIZE+yDelta+5, 90, sb); p.setPen(qRgb(255, 0, 0)); drawRotatedText(p, xDelta+100, FONTSIZE+yDelta+5, 90, sm); p.setPen(qRgb(0, 0, 0)); drawRotatedText(p, xDelta+18, FONTSIZE+yDelta+5, 90, slv); drawRotatedText(p, xDelta+18, FONTSIZE+yDelta+270, 90, srv); p.setPen(qRgb(0, 0, 255)); fnt.setBold(true); p.setFont(fnt); drawRotatedText(p, xDelta+170, FONTSIZE+yDelta+120, 90, tv); break; case 3: p.setPen(qRgb(0, 128, 0)); drawRotatedText(p, xDelta+355, FONTSIZE+yDelta+440, -90, sb); p.setPen(qRgb(255, 0, 0)); drawRotatedText(p, xDelta+322, FONTSIZE+yDelta+405, -90, sm); p.setPen(qRgb(0, 0, 0)); drawRotatedText(p, xDelta+400, FONTSIZE+yDelta+500, -90, slv); drawRotatedText(p, xDelta+400, FONTSIZE+yDelta+240, -90, srv); p.setPen(qRgb(0, 0, 255)); fnt.setBold(true); p.setFont(fnt); drawRotatedText(p, xDelta+250, FONTSIZE+yDelta+120, -90, tv); break; default: ; } fnt.setBold(false); p.setFont(fnt); p.end(); } void DeskView::drawRotatedText (QPainter &p, int x, int y, float angle, const QString &text) { p.translate(x, y); p.rotate(angle); p.drawText(0, 0, text); p.rotate(-1*angle); p.translate(-1*x, -1*y); } void DeskView::drawRotatedText (QPainter &p, int x, int y, int width, int height, float angle, const QString &text) { p.translate(x, y); p.rotate(angle); p.drawText(QRectF(0,0,width,height),text,QTextOption(Qt::AlignHCenter)); //p.drawRect(0,0,width,height); p.rotate(-1*angle); p.translate(-1*x, -1*y); } eGameBid DeskView::selectBid (eGameBid lMove, eGameBid rMove) { Q_UNUSED(lMove) Q_UNUSED(rMove) //if (!formBid->exec()) qApp->quit(); //connect(formBid, SIGNAL(rejected()), kpref, SLOT(slotAbortBid())); formBid->_GamesType = undefined; do formBid->exec(); while (formBid->_GamesType == undefined); return formBid->_GamesType; } void DeskView::drawMessageWindow (int x0, int y0, const QString &msg, bool dim) { if (!mDeskBmp) return; QPainter p(mDeskBmp); // change suits to unicode chars QRgb textRGB(qRgb(0, 0, 0)); QString s(msg); if (s.indexOf("\1d") >= 0 || s.indexOf("\1h") >= 0) textRGB = qRgb(255, 0, 0); s.replace("\1s", QChar((ushort)0x2660)); s.replace("\1c", QChar((ushort)0x2663)); s.replace("\1d", QChar((ushort)0x2666)); s.replace("\1h", QChar((ushort)0x2665)); s = s.trimmed(); // now i want to know text extents QRect drawR(0, 0, 0, 0); QRect boundR; p.drawText(drawR, Qt::AlignLeft | Qt::AlignTop | Qt::TextExpandTabs, s, &boundR); // window size // .|.....text.....|. int w = boundR.width()+4+4+2+2, h = boundR.height()+2+2+2+2; if (x0 < 0) { if (x0 == -666) x0 = (DesktopWidth-w)/2; else x0 += DesktopWidth-w; } if (y0 < 0) { if (y0 == -666) y0 = (DesktopHeight-h)/2; else y0 += DesktopHeight-h; } // draw shadow QBrush brush(qRgba(0, 0, 0, 128)); QRect winR(x0, y0, w, h); winR.adjust(-4, 8, -4, 8); p.fillRect(winR, brush); winR.adjust(4, -8, 4, -8); // draw window brush.setColor(qRgb(dim?164:255, dim?164:255, dim?164:255)); p.fillRect(winR, brush); // draw frame p.setPen(qRgb(0, 0, 0)); p.drawLine(x0+1, y0+1, x0+w-2, y0+1); p.drawLine(x0+1, y0+h-2, x0+w-2, y0+h-2); p.drawLine(x0+1, y0+1, x0+1, y0+h-2); p.drawLine(x0+w-2, y0+1, x0+w-2, y0+h-2); // draw text boundR.adjust(x0+2+4, y0+2+2, x0+2+4, y0+2+2); p.setPen(textRGB); p.drawText(boundR, Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextExpandTabs, s); // done p.end(); } openpref-0.1.3/src/desk/desktop.cpp0000755000175000017500000010714211265177055016652 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include "prfconst.h" #include #include #include #include #include #include #include "aialphabeta.h" #include "aiplayer.h" #include "baser.h" #include "debug.h" #include "deskview.h" #include "ncounter.h" #include "kpref.h" #include "player.h" #include "desktop.h" #include "plscore.h" #include "human.h" bool Closed_Whist = false; /*enum GameStage { Bidding, Drop, Game } GameStage gameStage = Bidding;*/ typedef struct { int mount, pool, leftWh, rightWh; } tScores; typedef struct { eGameBid game; const QString name; } tGameName; static tGameName gameNames[] = { {g86catch, " "}, {raspass, "pass-out"}, {undefined, "-----"}, {whist, "whist"}, {halfwhist, "halfwhist"}, {gtPass, "pass"}, {g61, "6\1s"}, {g62, "6\1c"}, {g63, "6\1d"}, {g64, "6\1h"}, {g65, "6NT"}, {g71, "7\1s"}, {g72, "7\1c"}, {g73, "7\1d"}, {g74, "7\1h"}, {g75, "7NT"}, {g81, "8\1s"}, {g82, "8\1c"}, {g83, "8\1d"}, {g84, "8\1h"}, {g85, "8NT"}, {g86, "Misere"}, {g91, "9\1s"}, {g92, "9\1c"}, {g93, "9\1d"}, {g94, "9\1h"}, {g95, "9NT"}, {g101, "10\1s"}, {g102, "10\1c"}, {g103, "10\1d"}, {g104, "10\1h"}, {g105, "10NT"}, {zerogame, 0} }; const QString &sGameName (eGameBid game) { static QString empty; for (int i = 0; !gameNames[i].name.isEmpty(); i++) { if (gameNames[i].game == game) return gameNames[i].name; } return empty; } void PrefDesktop::internalInit () { mCardsOnDesk[0] = mCardsOnDesk[1] = mCardsOnDesk[2] = mCardsOnDesk[3] = mFirstCard = mSecondCard = mThirdCard=0; nCurrentStart.nValue = nCurrentMove.nValue = (qrand()%3)+1; nCurrentStart.nMin = nCurrentMove.nMin = 1; nCurrentStart.nMax = nCurrentMove.nMax = 3; mPlayers << 0; // 0th player is nobody //addPlayer(new AiPlayer(1)); // I Hate This Game :) addPlayer(new HumanPlayer(1, mDeskView)); if (!optAlphaBeta1) addPlayer(new AiPlayer(2, mDeskView)); else addPlayer(new CheatPlayer(2, mDeskView)); if (!optAlphaBeta2) addPlayer(new AiPlayer(3, mDeskView)); else addPlayer(new CheatPlayer(3, mDeskView)); mShowPool = false; mOnDeskClosed = false; // optMaxPool = 21; iMoveX = iMoveY = -1; } PrefDesktop::PrefDesktop (DeskView *aDeskView) : QObject(0) { mPlayingRound = false; mGameRunning = false; internalInit(); mDeskView = aDeskView; } PrefDesktop::~PrefDesktop () { foreach (Player *p, mPlayers) if (p) delete p; mPlayers.clear(); } void PrefDesktop::emitRepaint () { emit deskChanged(); } void PrefDesktop::closePool () { WrapCounter counter(1, 1, 3); int i; tScores R[4]; for (i = 1; i <= 3; i++) { Player *G = player(i); R[i].mount = G->mScore.mountain(); R[i].pool = G->mScore.pool(); R[i].leftWh = G->mScore.leftWhists(); R[i].rightWh = G->mScore.rightWhists(); //if (R[i].mount < mm) mm = R[i].mount; //if (R[i].pool < mb) mb = R[i].pool; } // Amnistiya gori //for (i = 1; i <= 3; i++) R[i].mount -= mm; // Amnistiya puli //for (i = 1; i <= 3; i++) R[i].pool -= mb; // svou pulu sebe v visti for (i = 1; i <= 3;i++) { //R[i].leftWh += R[i].pool*10/2; //R[i].rightWh += R[i].pool*10/2; R[i].leftWh += R[i].pool*10/3; R[i].rightWh += R[i].pool*10/3; } // goru - drugim na sebya for (i = 1; i <= 3; i++) { /* counter.nValue = i; ++counter; R[counter.nValue].rightWh += R[i].mount*10/2; ++counter; R[counter.nValue].leftWh += R[i].mount*10/2; */ counter.nValue = i; ++counter; R[counter.nValue].rightWh += R[i].mount*10/3; ++counter; R[counter.nValue].leftWh += R[i].mount*10/3; } // schitaem visti for (i = 1; i <= 3; i++) { int i1, i2; counter.nValue = i; ++counter; i1 = counter.nValue; ++counter; i2 = counter.nValue; player(i)->mScore.setWhists(R[i].leftWh+R[i].rightWh-R[i1].rightWh-R[i2].leftWh); } } Player *PrefDesktop::addPlayer (Player *plr) { mPlayers << plr; return plr; } // 1 ( ), // HumanPlayer // if number is 1(pass) and offline game, create Player Card *PrefDesktop::makeGameMove (Card *lMove, Card *rMove, bool isPassOut) { Card *res = 0; Player *curPlr = player(nCurrentMove); // 1. Current player is not human // Human's move if current he whists whith open cards or catches misere, and current player // passes or catches misere if (((player(1)->myGame() == whist && !Closed_Whist) || player(1)->myGame() == g86catch) && curPlr->number() != 1 && (curPlr->myGame() == gtPass || curPlr->myGame() == g86catch)) { HumanPlayer *hPlr = new HumanPlayer(nCurrentMove.nValue, mDeskView); *hPlr = *curPlr; mPlayers[nCurrentMove.nValue] = hPlr; res = hPlr->moveSelectCard(lMove, rMove, player(succPlayer(nCurrentMove)), player(predPlayer(nCurrentMove)), isPassOut); *curPlr = *hPlr; mPlayers[nCurrentMove.nValue] = curPlr; delete hPlr; } // 2. Current player is human, he passes // if AI whists with open cards, it makes move instead of human else if (curPlr->number() == 1 && curPlr->myGame() == gtPass && !Closed_Whist) { Player *aiPlr; if (player(2)->myGame() == whist) { if (!optAlphaBeta1) aiPlr = new AiPlayer(nCurrentMove.nValue, mDeskView); else aiPlr = new CheatPlayer(nCurrentMove.nValue, mDeskView); } else if (player(3)->myGame() == whist) { if (!optAlphaBeta2) aiPlr = new AiPlayer(nCurrentMove.nValue, mDeskView); else aiPlr = new CheatPlayer(nCurrentMove.nValue, mDeskView); } else { QMessageBox::about(0,"Error","Something went wrong!"); printf("Something went wrong!"); } *aiPlr = *curPlr; mPlayers[nCurrentMove.nValue] = aiPlr; res = aiPlr->moveSelectCard(lMove, rMove, player(succPlayer(nCurrentMove)), player(predPlayer(nCurrentMove)), isPassOut); *curPlr = *aiPlr; mPlayers[nCurrentMove.nValue] = curPlr; delete aiPlr; } // 3. No swaps, current player makes move himself else { res = (player(nCurrentMove))->moveSelectCard(lMove, rMove, player(succPlayer(nCurrentMove)), player(predPlayer(nCurrentMove)), isPassOut); } return res; } void PrefDesktop::getPMsgXY (int plr, int *x, int *y) { switch (plr) { case 1: *x = -666; *y = -(mDeskView->yBorder+CARDHEIGHT+50); break; case 2: *x = 30; *y = 30; break; case 3: *x = -30; *y = 30; break; default: *x = -666; *y = -666; break; } } /* void PrefDesktop::drawBidWindows (const eGameBid *bids, int curPlr) { draw(false); for (int f = 1; f <= 3; f++) { int x, y; getPMsgXY(f, &x, &y); if (f != curPlr) { if (bids[f] != undefined) { mDeskView->drawMessageWindow(x, y, sGameName(bids[f]), true); } } else mDeskView->drawMessageWindow(x, y, QString("thinking...")); } //emitRepaint(); //if (curPlr != 3) mDeskView->mySleep(2); else emitRepaint(); } */ static void cardName (char *dest, const Card *c) { static const char *faceN[] = {" 7"," 8"," 9","10"," J"," Q"," K"," A"}; static const char *suitN[] = {"S","C","D","H"}; if (!c) { strcat(dest, "..."); return; } int face = c->face(), suit = c->suit(); if (face >= 7 && face <= FACE_ACE && suit >= 1 && suit <= 4) { strcat(dest, faceN[face-7]); strcat(dest, suitN[suit-1]); return; } strcat(dest, "???"); } static void dumpCardList (char *dest, const CardList &lst) { CardList tmp(lst); tmp.mySort(); for (int f = 0; f < tmp.size(); f++) { Card *c = tmp.at(f); if (!c) continue; strcat(dest, " "); cardName(dest, c); } } void PrefDesktop::animateDeskToPlayer (int plrNo, bool doAnim) { static const int steps = 10; Card *cAni[4]; int left, top; if (!mDeskView) return; Player *plr = player(plrNo); if (!plr) return; plr->getLeftTop(&left, &top); if (plrNo == 3) left -= CARDWIDTH-4; for (int f = 0; f < 4; f++) { cAni[f] = mCardsOnDesk[f]; mCardsOnDesk[f] = 0; } for (int f = doAnim?0:steps; f <= steps; f++) { draw(false); for (int c = 0; c <= 3; c++) { if (!cAni[c]) continue; int x, y; inGameCardLeftTop(c, &x, &y); x = x+((int)((double)(left-x)/steps*f)); y = y+((int)((double)(top-y)/steps*f)); mDeskView->drawCard(cAni[c], x, y, 1, 0); } mDeskView->aniSleep(20); } draw(); } int PrefDesktop::playerWithMaxPool () { int MaxBullet= -1,CurrBullet=-1,res=0; for (int i =1 ;i<=3;i++) { CurrBullet = player(i)->mScore.pool(); if (MaxBullet < CurrBullet && CurrBullet < optMaxPool ) { MaxBullet = CurrBullet; res = i; } } return res; } int PrefDesktop::whoseTrick (Card *p1, Card *p2, Card *p3, int trump) { Card *maxC = p1; int res = 1; if ((maxC->suit() == p2->suit() && maxC->face() < p2->face()) || (maxC->suit() != trump && p2->suit() == trump)) { maxC = p2; res = 2; } if ((maxC->suit() == p3->suit() && maxC->face() < p3->face()) || (maxC->suit() != trump && p3->suit() == trump)) { maxC = p3; res = 3; } return res; } Player *PrefDesktop::player (int num) { if (num < 1 || num > 3) return 0; return mPlayers[num]; } Player *PrefDesktop::player (const WrapCounter &cnt) { return player(cnt.nValue); } bool PrefDesktop::loadGame (const QString &name) { QFile fl(name); if (!fl.open(QIODevice::ReadOnly)) { printf("Load failed\n"); return false; } QByteArray ba(fl.readAll()); fl.close(); int pos = 0; return unserialize(ba, &pos); } bool PrefDesktop::saveGame (const QString &name) { QFile fl(name); if (!fl.open(QIODevice::WriteOnly)) { printf("Save failed\n"); return false; } QByteArray ba; serialize(ba); fl.write(ba); fl.close(); return true; } // draw ingame card (the card that is in game, not in hand) void PrefDesktop::inGameCardLeftTop (int mCardNo, int *left, int *top) { int w = mDeskView->DesktopWidth/2, h = mDeskView->DesktopHeight/2; int x = w, y = h; switch (mCardNo) { case 0: x -= CARDWIDTH*2+8; y -= CARDHEIGHT/2; break; case 1: x -= CARDWIDTH/2; break; case 2: x -= CARDWIDTH; y -= CARDHEIGHT; break; case 3: y -= CARDHEIGHT; break; default: return; } *left = x; *top = y; } void PrefDesktop::drawInGameCard (int mCardNo, Card *card) { if (!card) return; int x, y; inGameCardLeftTop(mCardNo, &x, &y); mDeskView->drawCard(card, x, y, !mOnDeskClosed, 0); } void PrefDesktop::drawPool () { QString sb, sm, slw, srw, tw; mDeskView->ShowBlankPaper(optMaxPool); for (int i = 1;i<=3;i++) { Player *plr = player(i); sb = plr->mScore.poolStr(); sm = plr->mScore.mountainStr(7); slw = plr->mScore.leftWhistsStr(14); srw = plr->mScore.rightWhistsStr(14); tw = plr->mScore.whistsStr(); mDeskView->showPlayerScore(i, sb, sm, slw, srw, tw); } } void PrefDesktop::draw (bool emitSignal) { if (!mDeskView) return; mDeskView->ClearScreen(); if (!mGameRunning) return; // "I move" icon switch (nCurrentStart.nValue) { case 1: iMoveX = mDeskView->DesktopWidth/2-15; iMoveY = mDeskView->DesktopHeight-mDeskView->yBorder-CARDHEIGHT-40; break; case 2: iMoveX = mDeskView->xBorder+20; iMoveY = mDeskView->yBorder+CARDHEIGHT+40; break; case 3: iMoveX = mDeskView->DesktopWidth-mDeskView->xBorder-20; iMoveY = mDeskView->yBorder+CARDHEIGHT+40; break; default: iMoveX = iMoveY = -1; break; } // repaint players for (int f = 1; f <= 3; f++) { Player *plr = player(f); if (plr) { plr->mDeskView = mDeskView; plr->draw(); } } // repaint in-game cards for (int f = 0; f <= 3; f++) { if (mCardsOnDesk[f]) drawInGameCard(f, mCardsOnDesk[f]); } // draw bidboard if (mPlayingRound) { Player *plr1 = player(1); Player *plr2 = player(2); Player *plr3 = player(3); if (plr1 && plr2 && plr3) { mDeskView->drawBidsBmp(mPlayerActive, plr1->tricksTaken(), plr2->tricksTaken(), plr3->tricksTaken(), gCurrentGame); } } if (iMoveX >= 0) mDeskView->drawIMove(iMoveX, iMoveY); // for (int f = 1; f <= 3; f++) { Player *plr = player(f); if (plr) { QString msg(plr->message()); if (!msg.isEmpty()) { int plrmx, plrmy; getPMsgXY(f, &plrmx, &plrmy); mDeskView->drawMessageWindow(plrmx, plrmy, msg, f!=mPlayerHi); } } } // repaint scoreboard if (mShowPool) drawPool(); if (emitSignal) emitRepaint(); } void PrefDesktop::serialize (QByteArray &ba) { for (int f = 1; f <= 3; f++) { Player *plr = player(f); plr->mScore.serialize(ba); } serializeInt(ba, nCurrentStart.nValue); serializeInt(ba, optMaxPool); serializeInt(ba, optStalingrad); serializeInt(ba, opt10Whist); serializeInt(ba, optWhistGreedy); } bool PrefDesktop::unserialize (QByteArray &ba, int *pos) { for (int f = 1; f <= 3; f++) { Player *plr = player(f); if (!plr->mScore.unserialize(ba, pos)) return false; } int t; if (!unserializeInt(ba, pos, &t)) return false; nCurrentStart.nValue = t; if (!unserializeInt(ba, pos, &t)) return false; optMaxPool = static_cast(t); if (!unserializeInt(ba, pos, &t)) return false; optStalingrad = static_cast(t); if (!unserializeInt(ba, pos, &t)) return false; opt10Whist = static_cast(t); if (!unserializeInt(ba, pos, &t)) return false; optWhistGreedy = static_cast(t); return true; } void PrefDesktop::runGame () { eGameBid playerBids[4]; //char *filename; //Card *mFirstCard, *mSecondCard, *mThirdCard; int npasscounter; mGameRunning = true; //mDeskView->ClearScreen(); kpref->HintBar->clearMessage(); // while !end of pool int roundNo = 0; while (!(player(1)->mScore.pool() >= optMaxPool && player(2)->mScore.pool() >= optMaxPool && player(3)->mScore.pool() >= optMaxPool)) { WrapCounter plrCounter(1, 1, 3); mPlayingRound = false; mBiddingDone = false; int nPl; int nPassCounter = 0; // number of passes playerBids[3] = playerBids[2] = playerBids[1] = playerBids[0] = undefined; mCardsOnDesk[0] = mCardsOnDesk[1] = mCardsOnDesk[2] = mCardsOnDesk[3] = mFirstCard = mSecondCard = mThirdCard = 0; mDeck.newDeck(); mDeck.shuffle(); { QFile dbgD("dbg.deck"); QFile dbgDT("dbg.deck.txt"); if (dbgDT.open(QIODevice::ReadOnly)) { mDeck.clear(); for (int f = 0; f < 32; f++) { QByteArray ba(dbgDT.readLine()); Card *c = cardFromName(ba.constData()); if (!c) abort(); qDebug() << c->toString(); mDeck << c; nCurrentStart.nValue = 1; } } else if (dbgD.open(QIODevice::ReadOnly)) { QByteArray ba(dbgD.readAll()); dbgD.close(); int pos = 0; if (!mDeck.unserialize(ba, &pos)) abort(); nCurrentStart.nValue = 1; //} else if (allowDebugLog) { } else if (allowDebugLog) { QString fns(QString::number(roundNo)); //roundNo++ while (fns.length() < 2) fns.prepend('0'); QFile fl(fns); if (fl.open(QIODevice::WriteOnly)) { QByteArray ba; mDeck.serialize(ba); fl.write(ba); fl.close(); } } } player(1)->clear(); player(2)->clear(); player(3)->clear(); mPlayerHi = 0; gCurrentGame = undefined; mShowPool = false; // deal cards /* for (int i = 0; i < CARDINCOLODA-2; i++) { Player *tmpGamer = player(plrCounter); if (!(mDeck.at(i))) mDeskView->MessageBox("Card = 0", "Error!!!"); tmpGamer->dealCard(mDeck.at(i)); ++plrCounter; } */ // Starter of bidding plrCounter = nCurrentStart; for (int i=1; i<=3; i++) { if (i == nCurrentStart.nValue) player(i)->setCurrentStart(true); else player(i)->setCurrentStart(false); } draw(); { CardList tmpDeck; int cc = succPlayer(nCurrentStart), tPos = 0, tNo = 0; mOnDeskClosed = true; if (optDealAnim) player(1)->setInvisibleHand(true); for (int f = 0; f < 15; f++) { if (f == 4) { // talon tNo = tPos; mCardsOnDesk[2] = mDeck.at(tPos++); if (optDealAnim) { draw(); mDeskView->aniSleep(40); } mCardsOnDesk[3] = mDeck.at(tPos++); if (optDealAnim) { draw(); mDeskView->aniSleep(40); } } Player *plr = player(cc); cc = (cc%3)+1; plr->dealCard(mDeck.at(tPos)); tmpDeck << mDeck.at(tPos++); //if (optDealAnim) { draw(); mDeskView->aniSleep(40); } plr->dealCard(mDeck.at(tPos)); tmpDeck << mDeck.at(tPos++); if (optDealAnim) { draw(); mDeskView->aniSleep(80); } if (optDealAnim) { if (f%3 == 2) mDeskView->aniSleep(200); } } mDeskView->aniSleep(200); if (optDealAnim) player(1)->setInvisibleHand(false); tmpDeck << mDeck.at(tNo++); tmpDeck << mDeck.at(tNo); if (tmpDeck.count() != 32) abort(); mDeck = tmpDeck; /* mOnDeskClosed = false; mCardsOnDesk[1] = mCardsOnDesk[2] = 0; */ draw(false); } if (!optDealAnim) { draw(); emitRepaint(); mDeskView->mySleep(0); } dlogf("========================================="); dlogf("player %i moves...", nCurrentStart.nValue); char xxBuf[1024]; for (int f = 1; f <= 3; f++) { Player *plr = player(nCurrentStart); ++nCurrentStart; xxBuf[0] = 0; dumpCardList(xxBuf, plr->mCards); dlogf("hand %i:%s", plr->number(), xxBuf); } xxBuf[0] = 0; cardName(xxBuf, mDeck.at(30)); cardName(xxBuf, mDeck.at(31)); dlogf("talon: %s", xxBuf); //draw(); // npasscounter = 0; //bids4win[0] = bids4win[1] = bids4win[2] = bids4win[3] = undefined; int curBidIdx = 1; while (npasscounter < 2) { // Player *plr = player(plrCounter); mPlayerHi = plrCounter.nValue; if (playerBids[curBidIdx] != gtPass) { plr->setMessage(tr("thinking...")); //drawBidWindows(bids4win, p); draw(false); if (plr->number() != 1) mDeskView->mySleep(2); else emitRepaint(); eGameBid bb; bb = playerBids[curBidIdx] = plr->moveBidding(playerBids[curBidIdx%3+1], playerBids[(curBidIdx+1)%3+1]); qDebug() << "bid:" << sGameName(bb) << bb; QString message; if (bb == whist) message = tr("whist"); else if (bb == gtPass) message = tr("pass"); else if (bb == g65) message = tr("6 no trump"); else if (bb == g75) message = tr("7 no trump"); else if (bb == g85) message = tr("8 no trump"); else if (bb == g95) message = tr("9 no trump"); else if (bb == g105) message = tr("10 no trump"); else if (bb == g86) message = tr("Misere"); else message = sGameName(bb); plr->setMessage(message); //bids4win[plrCounter] = playerBids[curBidIdx+1]; }// else plr->setMessage("PASS"); ++plrCounter; curBidIdx = curBidIdx%3+1; if ((playerBids[1] != undefined && playerBids[2] != undefined && playerBids[3] != undefined) && ((playerBids[1] == gtPass?1:0)+(playerBids[2] == gtPass?1:0)+(playerBids[3] == gtPass?1:0) >= 2)) break; } mPlayerHi = 0; draw(false); //mDeskView->mySleep(0); // calculate max game for (int i = 1; i <= 3; i++) { if (playerBids[0] < playerBids[i]) playerBids[0] = playerBids[i]; } // deliver talon and choose final bid (or pass-out if no player) mPlayerActive = 0; mPlayingRound = true; if (playerBids[0] != gtPass) { // no pass-out optPassCount = 0; // who made maximal bid for (int i = 1; i <= 3; i++) { Player *tmpg = player(i); if (tmpg->myGame() == playerBids[0]) { QString gnS(sGameName(playerBids[0])); gnS.prepend("game: "); gnS += "; player: "; gnS += QString::number(i); dlogS(gnS); mPlayerHi = i; player(i%3+1)->setMessage(""); player((i+1)%3+1)->setMessage(""); mPlayerActive = i; nPassCounter = 0; // show talon WrapCounter tmpPlayersCounter(1, 3); Player *PassOrVistPlayers; int PassOrVist = 0, nPassOrVist = 0; mOnDeskClosed = false; mCardsOnDesk[2] = mDeck.at(30); mCardsOnDesk[3] = mDeck.at(31); // trick with gCurrentGame - shows game on bidboard gCurrentGame = playerBids[0]; draw(); //drawBidWindows(bids4win, 0); if (tmpg->number() != 1) kpref->HintBar->showMessage(tr("Try to remember the cards")); if (optPrefClub) mDeskView->mySleep(-1); else mDeskView->mySleep(4); kpref->HintBar->clearMessage(); // deal talon tmpg->dealCard(mDeck.at(30)); tmpg->dealCard(mDeck.at(31)); animateDeskToPlayer(mPlayerActive, optTakeAnim); // will clear mCardsOnDesk[] //bids4win[0] = bids4win[1] = bids4win[2] = bids4win[3] = undefined; // throw away eGameBid maxBid = gCurrentGame; if (tmpg->myGame() != g86) { // not misere // not misere nCurrentMove.nValue = i; draw(false); if (mPlayerActive == 1) kpref->HintBar->showMessage(tr("Select two cards to drop")); else mDeskView->mySleep(2); playerBids[0] = gCurrentGame = tmpg->dropForGame(); kpref->HintBar->clearMessage(); } else { // playing misere // show all cards int tempint = nCurrentMove.nValue; int nVisibleState = tmpg->invisibleHand(); tmpg->setInvisibleHand(false); draw(false); if (tmpg->number() != 1) kpref->HintBar->showMessage(tr("Try to remember the cards")); /*else tmpg->setMessage(tr("Misere"));*/ // wait for event if (optPrefClub) mDeskView->mySleep(-1); else mDeskView->mySleep(4); draw(false); tmpg->setInvisibleHand(nVisibleState); nCurrentMove.nValue = tmpg->number(); if (mPlayerActive != 1) mDeskView->mySleep(2); playerBids[0] = gCurrentGame = tmpg->dropForMisere(); kpref->HintBar->clearMessage(); nCurrentMove.nValue = tempint; } tmpPlayersCounter.nValue = i; // bid QString message; if (gCurrentGame == whist) message = tr("whist"); else if (gCurrentGame == gtPass) message = tr("pass"); else if (gCurrentGame == g65) message = tr("6 no trump"); else if (gCurrentGame == g75) message = tr("7 no trump"); else if (gCurrentGame == g85) message = tr("8 no trump"); else if (gCurrentGame == g95) message = tr("9 no trump"); else if (gCurrentGame == g105) message = tr("10 no trump"); else if (gCurrentGame == g86) message = tr("Misere"); else if (gCurrentGame == withoutThree) message = tr("without three"); else message = sGameName(gCurrentGame); player(tmpPlayersCounter)->setMessage(message); if (gCurrentGame == withoutThree) { gCurrentGame = maxBid; tmpg->gotPassPassTricks(gameTricks(tmpg->myGame())-3); dlogf("clean out!\n"); goto LabelRecordOnPaper; } else { // pass or whist? ++tmpPlayersCounter; PassOrVistPlayers = player(tmpPlayersCounter); PassOrVistPlayers->setMyGame(undefined); // choice of the first player int firstPW = tmpPlayersCounter.nValue; mPlayerHi = firstPW; if ((gCurrentGame != g86) && !(!opt10Whist && gCurrentGame>=101 && gCurrentGame<=105)) { player(tmpPlayersCounter)->setMessage(tr("thinking...")); draw(false); if (firstPW != 1) mDeskView->mySleep(2); } //PassOrVist = PassOrVistPlayers->moveFinalBid(gCurrentGame, gtPass, 0); PassOrVist = PassOrVistPlayers->moveFinalBid(gCurrentGame, whist, nPassCounter); nPassOrVist = tmpPlayersCounter.nValue; if (PassOrVistPlayers->myGame() == gtPass) { nPassCounter++; player(tmpPlayersCounter)->setMessage(tr("pass")); } else if (PassOrVistPlayers->myGame() == g86catch) player(tmpPlayersCounter)->setMessage(""); else player(tmpPlayersCounter)->setMessage(tr("whist")); draw(false); //bids4win[1] = PassOrVistPlayers->myGame(); // choice of the second player ++tmpPlayersCounter; int nextPW = tmpPlayersCounter.nValue; mPlayerHi = nextPW; draw(false); PassOrVistPlayers = player(tmpPlayersCounter); PassOrVistPlayers->setMyGame(undefined); if ((gCurrentGame != g86) && !(!opt10Whist && gCurrentGame>=101 && gCurrentGame<=105)) { player(tmpPlayersCounter)->setMessage(tr("thinking...")); draw(false); if (nextPW != 1) mDeskView->mySleep(2); } //PassOrVistPlayers->moveFinalBid(gCurrentGame, PassOrVist, nPassOrVist); //qDebug() << nPassCounter; PassOrVistPlayers->moveFinalBid(gCurrentGame, PassOrVist, nPassCounter); if (PassOrVistPlayers->myGame() == gtPass) { nPassCounter++; player(tmpPlayersCounter)->setMessage(tr("pass")); } else if (PassOrVistPlayers->myGame() == g86catch) player(tmpPlayersCounter)->setMessage(""); else if (PassOrVistPlayers->myGame() == halfwhist) player(tmpPlayersCounter)->setMessage(tr("half of whist")); else player(tmpPlayersCounter)->setMessage(tr("whist")); draw(false); //bids4win[2] = PassOrVistPlayers->myGame(); // if halfwhist, choice of the first player again if (player(nextPW)->myGame() == halfwhist) { --tmpPlayersCounter; mPlayerHi = firstPW; PassOrVistPlayers = player(firstPW); PassOrVistPlayers->setMessage(tr("thinking...")); draw(false); if (firstPW != 1) mDeskView->mySleep(2); PassOrVist = PassOrVistPlayers->moveFinalBid(gCurrentGame, gtPass, 0); // no more halfwhists! //nPassOrVist = tmpPlayersCounter.nValue; if (PassOrVistPlayers->myGame() == gtPass) { //nPassCounter++; player(firstPW)->setMessage(tr("pass")); } else { player(firstPW)->setMessage(tr("whist")); //wasHalfWhist = false; player(nextPW)->setMyGame(gtPass); } draw(false); } mPlayerHi = 0; // choice made draw(false); if (optPrefClub) mDeskView->mySleep(-1); else mDeskView->mySleep(2); player(1)->setMessage(""); player(2)->setMessage(""); player(3)->setMessage(""); gnS = sGameName(gCurrentGame); gnS.prepend("game: "); gnS += "; player: "; gnS += QString::number(mPlayerActive); dlogS(gnS); //!DUMP OTHERS! if (player(nextPW)->myGame() == halfwhist) { tmpg->gotPassPassTricks(gameTricks(tmpg->myGame())); int n = gameWhists(tmpg->myGame()); if (n > 1){ player(nextPW)->gotPassPassTricks(n/2); dlogf("halfwhist!\n"); goto LabelRecordOnPaper; } } if (nPassCounter == 2) { // two players passed tmpg->gotPassPassTricks(gameTricks(tmpg->myGame())); dlogf("clean out!\n"); goto LabelRecordOnPaper; } else { // Opened or closed cards /*for (int ntmp = 2 ; ntmp <= 3 ; ntmp++) { Player *Gamer4Open; Gamer4Open = player(ntmp); if (nPassCounter || gCurrentGame == g86) { // if not 2 whists if (Gamer4Open->myGame() == gtPass || Gamer4Open->myGame() == whist || Gamer4Open->myGame() == g86catch) Gamer4Open->setInvisibleHand(false); } }*/ // On misere or 10 check play with opened cards if ((gCurrentGame == g86)|| (!opt10Whist && gCurrentGame>=101 && gCurrentGame<=105)) { player(2)->setInvisibleHand(false); player(3)->setInvisibleHand(false); } // If one whist, whister chooses closed or opened cards else if ((nPassCounter == 1)) { //qDebug() << "passcount=" << nPassCounter << endl; Closed_Whist = false; for (int n=1; n<=3; n++) if (player(n)->myGame() == whist) { player(n)->setMessage(tr("thinking...")); draw(false); if (n != 1) mDeskView->mySleep(1); Closed_Whist = player(n)->chooseClosedWhist(); if (Closed_Whist) player(n)->setMessage(tr("close")); else player(n)->setMessage(tr("open")); draw(false); mDeskView->mySleep(1); } // if closed whist chosen, no hand become opened // otherwise, whist and pass players open cards if (!Closed_Whist) { for (int n=2; n<=3; n++) if ((player(n)->myGame() == whist) || (player(n)->myGame() == gtPass)) player(n)->setInvisibleHand(false); } /*if (player(2)->myGame() == gtPass) invis = player(3)->chooseClosedWhist(); else invis = player(2)->chooseClosedWhist(); player(2)->setInvisibleHand(invis); player(3)->setInvisibleHand(invis);*/ player(1)->setMessage(""); player(2)->setMessage(""); player(3)->setMessage(""); } } break; } } } // who made maximal bid } else { // pass out dlogf("game: pass-out"); optPassCount++; mPlayerActive = 0; mPlayerHi = 0; playerBids[0] = gCurrentGame = raspass; player(1)->setMyGame(raspass); player(2)->setMyGame(raspass); player(3)->setMyGame(raspass); mCardsOnDesk[0] = mCardsOnDesk[1] = mCardsOnDesk[2] = mCardsOnDesk[3] = 0; mOnDeskClosed = false; draw(); if (optPrefClub) mDeskView->mySleep(-1); else mDeskView->mySleep(2); } player(1)->setMessage(""); player(2)->setMessage(""); player(3)->setMessage(""); draw(false); // game (10 moves) mBiddingDone = true; nCurrentMove = nCurrentStart; for (int i = 1; i <= 10; i++) { Player *tmpg; mCardsOnDesk[0] = mCardsOnDesk[1] = mCardsOnDesk[2] = mCardsOnDesk[3] = mFirstCard = mSecondCard = mThirdCard = 0; if (gCurrentGame == raspass && (i >= 1 && i <= 3)) nCurrentMove = nCurrentStart; dlogf("------------------------\nmove #%i", i); for (int f = 1; f <= 3; f++) { Player *plr = player(nCurrentMove); ++nCurrentMove; xxBuf[0] = 0; dumpCardList(xxBuf, plr->mCards); dlogf("hand %i:%s", plr->number(), xxBuf); } mPlayerHi = nCurrentMove.nValue; draw(false); player(mPlayerHi)->setMessage(tr("thinking...")); draw(); mDeskView->mySleep(0); if (gCurrentGame == raspass && (i == 1 || i == 2)) { Card *tmp4show, *ptmp4rpass; tmp4show = mDeck.at(29+i); ptmp4rpass = tmp4show;//newCard(6, tmp4show->suit()); mCardsOnDesk[0] = tmp4show; draw(); mDeskView->mySleep(0); //if (nCurrentMove.nValue != 1) mDeskView->mySleep(-1); mCardsOnDesk[nCurrentMove.nValue] = mFirstCard = makeGameMove(0, ptmp4rpass, true); //mCardsOnDesk[nCurrentMove.nValue] = mFirstCard = makeGameMove(0, 0); } else { mCardsOnDesk[nCurrentMove.nValue] = mFirstCard = makeGameMove(0, 0, false); } player(mPlayerHi)->setMessage(""); xxBuf[0] = 0; cardName(xxBuf, mCardsOnDesk[nCurrentMove.nValue]); dlogf(" (1st) player %i:%s", nCurrentMove.nValue, xxBuf); ++nCurrentMove; mPlayerHi = nCurrentMove.nValue; player(mPlayerHi)->setMessage(tr("thinking...")); draw(); mDeskView->mySleep(0); mCardsOnDesk[nCurrentMove.nValue] = mSecondCard = makeGameMove(0, mFirstCard, false); player(mPlayerHi)->setMessage(""); xxBuf[0] = 0; cardName(xxBuf, mCardsOnDesk[nCurrentMove.nValue]); dlogf(" (2nd) player %i:%s", nCurrentMove.nValue, xxBuf); ++nCurrentMove; mPlayerHi = nCurrentMove.nValue; player(mPlayerHi)->setMessage(tr("thinking...")); draw(); mDeskView->mySleep(0); mCardsOnDesk[nCurrentMove.nValue] = mThirdCard = makeGameMove(mFirstCard, mSecondCard, false); player(mPlayerHi)->setMessage(""); xxBuf[0] = 0; cardName(xxBuf, mCardsOnDesk[nCurrentMove.nValue]); dlogf(" (3rd) player %i:%s", nCurrentMove.nValue, xxBuf); ++nCurrentMove; draw(); if (optPrefClub) mDeskView->mySleep(-1); else mDeskView->mySleep(1); nPl = whoseTrick(mFirstCard, mSecondCard, mThirdCard, playerBids[0]-(playerBids[0]/10)*10)-1; nCurrentMove = nCurrentMove+nPl; animateDeskToPlayer(nCurrentMove.nValue, optTakeAnim); // will clear mCardsOnDesk[] tmpg = player(nCurrentMove); tmpg->gotTrick(); draw(false); } LabelRecordOnPaper: mPlayingRound = false; ++nCurrentStart; // for (int i = 1; i <= 3;i++ ) { Player *tmpg = player(i); Player *plr = player(mPlayerActive); int RetValAddRec = tmpg->mScore.recordScores(gCurrentGame, tmpg->myGame(), plr ? plr->tricksTaken() : 0, tmpg->tricksTaken(), plr ? mPlayerActive : 0, i, 2-nPassCounter); if (RetValAddRec) { int index = playerWithMaxPool(); if (index) { tmpg->mScore.whistsAdd(index, i, RetValAddRec); // RetValAddRec = player(index)->mScore.poolAdd(RetValAddRec); // if (RetValAddRec) { index = playerWithMaxPool(); if (index) { tmpg->mScore.whistsAdd(index, i, RetValAddRec); // RetValAddRec = player(index)->mScore.poolAdd(RetValAddRec); if (RetValAddRec) tmpg->mScore.mountainDown(RetValAddRec); } else { tmpg->mScore.mountainDown(RetValAddRec); } } } else { tmpg->mScore.mountainDown(RetValAddRec); } } } //amnesty for pass out (don't matter for score) if (gCurrentGame == raspass) { int mm=10; int m=0; for (int i=1; i<=3; i++) { m = player(i)->tricksTaken(); if (mmScore.mountainAmnesty(mm); } closePool(); // -- . // -- CardList tmplist[3]; if (nPassCounter != 2) { // for (int f = 1; f <= 3; f++) { Player *plr = player(f); tmplist[f-1] = plr->mCards; plr->mCards = plr->mCardsOut; plr->setInvisibleHand(false); } } mShowPool = true; mPlayingRound = true; draw(); if (optPrefClub) mDeskView->mySleep(-1); else mDeskView->mySleep(4); mPlayingRound = false; if (nPassCounter != 2) { // for (int f = 1; f <= 3; f++) { Player *plr = player(f); plr->mCardsOut = plr->mCards; plr->mCards = tmplist[f-1]; } } } // end of pool mShowPool = true; drawPool(); emitRepaint(); emit gameOver(); mGameRunning = false; } openpref-0.1.3/src/desk/desktop.h0000755000175000017500000000525711265177055016323 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef DESKTOP_H #define DESKTOP_H #include #include #include "card.h" #include "ncounter.h" #include "player.h" class PrefDesktop : public QObject { Q_OBJECT public: PrefDesktop (DeskView *aDeskView=0); virtual ~PrefDesktop (); Player *addPlayer (Player *); void runGame (); void draw (bool emitSignal=true); void drawPool (); bool saveGame (const QString &name); // don't working! bool loadGame (const QString &name); // don't working! void closePool (); inline Player *currentPlayer () const { return mPlayers[nCurrentMove.nValue]; } void serialize (QByteArray &ba); bool unserialize (QByteArray &ba, int *pos); void emitRepaint (); signals: void deskChanged (); void gameOver (); public: DeskView *mDeskView; CardList mDeck; QList mPlayers; WrapCounter nCurrentStart, nCurrentMove; Card *mFirstCard, *mSecondCard, *mThirdCard; Card *mCardsOnDesk[4]; bool mShowPool; bool mOnDeskClosed; bool mGameRunning; bool mBiddingDone; private: void internalInit (); Player *player (int num); Player *player (const WrapCounter &cnt); Card *makeGameMove (Card *lMove, Card *rMove, bool isPassOut); void drawInGameCard (int mCardNo, Card *card); void inGameCardLeftTop (int mCardNo, int *left, int *top); void animateDeskToPlayer (int plrNo, bool doAnim); private: //void drawBidWindows (const eGameBid *bids, int curPlr); void getPMsgXY (int plr, int *x, int *y); int playerWithMaxPool (); // except the players who closed the pool int whoseTrick (Card *p1, Card *p2, Card *p3, int koz); private: bool mPlayingRound; int mPlayerActive; // who plays (if not raspass and mPlayingRound=true) int iMoveX, iMoveY; int mPlayerHi; // }; #endif openpref-0.1.3/src/desk/desk.pri0000755000175000017500000000022611265177055016132 0ustar kostyakostyaDEPENDPATH += $$PWD INCLUDEPATH += $$PWD HEADERS += \ $$PWD/desktop.h \ $$PWD/deskview.h SOURCES += \ $$PWD/desktop.cpp \ $$PWD/deskview.cppopenpref-0.1.3/src/desk/deskview.h0000755000175000017500000001030411265177055016460 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ //deskview.h // all graphics function depend #ifndef DESKVIEW_H #define DESKVIEW_H #include #include #include #include #include #include #include #include #include #include "card.h" #include "prfconst.h" class DeskView; class SleepEventLoop; class SleepEventFilter : public QObject { Q_OBJECT public: SleepEventFilter (SleepEventLoop *eloop, QObject *parent=0) : QObject(parent) { mLoop = eloop; } protected: bool eventFilter (QObject *obj, QEvent *e); private: SleepEventLoop *mLoop; }; class SleepEventLoop : public QEventLoop { Q_OBJECT public: SleepEventLoop (DeskView *aDeskView, QObject *parent=0) : QEventLoop(parent), mDeskView(aDeskView), mKeyPressed(false), mMousePressed(false), mMouseX(0), mMouseY(0), mIgnoreKey(false), mIgnoreMouse(false) { } void doEventKey (QKeyEvent *event); void doEventMouse (QMouseEvent *event); public slots: void keyPicUpdate (); public: DeskView *mDeskView; bool mKeyPressed; // exited due to mouse click? bool mMousePressed; // exited due to mouse click? int mMouseX, mMouseY; // where the click was? bool mIgnoreKey; // ignore key events? bool mIgnoreMouse; // ignore mouse events? }; class DeskView : public QObject { Q_OBJECT public: DeskView (int aW, int aH); ~DeskView (); void mySleep (int seconds); void aniSleep (int milliseconds); void ClearScreen (); void ClearBox (int x1, int y1, int x2, int y2); void drawCard (Card *card, int x, int y, bool opened, bool hilight); void drawText (const QString &str, int x, int y, QRgb textColor=qRgb(255,255,255), QRgb outlineColor=qRgb(0,0,0)); void MessageBox (const QString &text, const QString &caption); void ShowBlankPaper (int optMaxPool); void showPlayerScore (int i, const QString &sb, const QString &sm, const QString &slv, const QString &srv, const QString &tv); //----------------------------- for human player eGameBid selectBid (eGameBid lMove, eGameBid rMove); void StatusBar (const QString &text); void drawRotatedText (QPainter &p, int x, int y, float angle, const QString &text); void drawRotatedText (QPainter &p, int x, int y, int width, int height, float angle, const QString &text); void drawPKeyBmp (bool show); /* game: * <0: none * =0: misere * suit: * =0: nt * plrAct: 0-3 */ void drawBidsBmp (int plrAct, int p0t, int p1t, int p2t, eGameBid game); void drawMessageWindow (int x0, int y0, const QString &msg, bool dim=false); void drawIMove (int x, int y); void emitRepaint (); bool loadCards (); void freeCards (); signals: void deskChanged (); public: int Event; QImage *mDeskBmp; QImage *mBidBmp; QImage *mIMoveBmp; QImage *mKeyBmp[2]; QImage *mDigitsBmp; int nSecondStartWait; int DesktopWidth, DesktopHeight; int CardWidht, CardHeight; int xBorder, yBorder; //int xLen,yLen; int xDelta, yDelta; int imoveX, imoveY; private: void drawBmpChar (QPainter &p, int x0, int y0, int cx, int cy); void drawNumber (int x0, int y0, int n, bool red); void drawGameBid (eGameBid game); private: int bidBmpX, bidBmpY; private: QImage *GetImgByName (const char *name); private: QHash cardI; QImage *bidIcons[106]; // wasted! }; #endif openpref-0.1.3/src/util/0000755000175000017500000000000011265437521014511 5ustar kostyakostyaopenpref-0.1.3/src/util/util.cmake0000644000175000017500000000031411265177055016471 0ustar kostyakostyaproject(openpref) SET ( HEADERS ${HEADERS} src/util/baser.h src/util/debug.h src/util/ncounter.h ) SET ( SOURCES ${SOURCES} src/util/baser.cpp src/util/debug.cpp src/util/ncounter.cpp ) openpref-0.1.3/src/util/baser.cpp0000755000175000017500000000347411265177055016327 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include "baser.h" void serializeInt (QByteArray &ba, int i) { for (int f = 3; f >= 0; f--) { unsigned char c = (i&0xff); i >>= 8; ba.append((char)c); } } bool unserializeInt (QByteArray &ba, int *pos, int *i) { unsigned char buf[4]; if (*pos+4 > ba.size()) return false; const unsigned char *u = (const unsigned char *)ba.constData(); u += *pos; *pos += 4; for (int f = 3; f >= 0; f--) buf[f] = *u++; *i = 0; for (int f = 0; f < 4; f++) { *i <<= 8; *i |= buf[f]; } return true; } /* void msSleep (int ms) { // 1sec=1000000 // seconds while (ms >= 1000) { usleep(1000000/2); usleep(1000000/2); ms -= 1000; } // milliseconds int sec = (ms*1000); // nseconds while (sec > 0) { if (sec >= 1000000/2) { usleep(1000000/2); sec -= 1000000/2; } else { usleep(sec); sec = 0; } } } */ openpref-0.1.3/src/util/debug.h0000755000175000017500000000244011265177055015756 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef DEBUG_H #define DEBUG_H #include #ifndef WIN32 #define XDEBUG #endif extern int allowDebugLog; #ifdef XDEBUG void dlogS (const QString &s); void dlogf (const char *fmt, ...) __attribute__((format(printf, 1, 2))); void dlogfVA (const char *fmt, va_list ap); #else # define dlogS(...) # define dlogf(...) # define dlogfVA(...) #endif #endif openpref-0.1.3/src/util/ncounter.h0000755000175000017500000000304011265177055016522 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef NCOUNTER_H #define NCOUNTER_H class WrapCounter { public: WrapCounter (); WrapCounter (int _nMin, int _nMax ); WrapCounter (int _nValue, int _nMin, int _nMax); int operator ++ () { if (++nValue > nMax) nValue = nMin; return nValue; } int operator -- () { if (--nValue < nMin) nValue = nMax; return nValue; } friend WrapCounter &operator - (WrapCounter &c, int n); friend WrapCounter &operator + (WrapCounter &c, int n); public: int nValue; int nMin; int nMax; }; int succPlayer (const WrapCounter &aCurrent); int predPlayer (const WrapCounter &aCurrent); #endif openpref-0.1.3/src/util/ncounter.cpp0000755000175000017500000000334411265177055017064 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include "ncounter.h" WrapCounter::WrapCounter () { nMin = nValue = 0; nMax = INT_MAX; } WrapCounter::WrapCounter (int _nMin, int _nMax) { nMin = nValue = _nMin; nMax = _nMax; } WrapCounter::WrapCounter (int _nValue, int _nMin, int _nMax) { nMin = _nMin; nMax = _nMax; nValue = (_nValue-nMin)%(nMax-nMin+1)+nMin; } WrapCounter &operator - (WrapCounter &c, int n) { while (n-- > 0) --c; return c; } WrapCounter &operator + (WrapCounter &c,int n) { while (n-- > 0) ++c; return c; } int succPlayer (const WrapCounter &aCurrent) { int res = aCurrent.nValue+1; if (res > aCurrent.nMax) res = aCurrent.nMin; return res; } int predPlayer(const WrapCounter &aCurrent) { int res = aCurrent.nValue-1; if (res < aCurrent.nMin) res = aCurrent.nMax; return res; } openpref-0.1.3/src/util/debug.cpp0000755000175000017500000000446011265177055016315 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include "debug.h" #include using namespace std; int allowDebugLog = 0; #ifdef XDEBUG void dlogS (const QString &s) { QByteArray ba(s.toUtf8()); dlogf("%s", ba.constData()); } void dlogf (const char *fmt, ...) { va_list ap; va_start(ap, fmt); dlogfVA(fmt, ap); va_end(ap); } void dlogfVA (const char *fmt, va_list ap) { va_list ap2; char buf[256]; char *xbuf = NULL; char timebuf[128]; time_t t; struct tm bt; if (!fmt || !allowDebugLog) return; va_copy(ap2, ap); int res = vsnprintf(buf, sizeof(buf)/sizeof(char), fmt, ap2); va_end(ap2); if (res > (int)(sizeof(buf)/sizeof(char))-1) { /*(int) for c++*/ xbuf = (char *)malloc((res+32)*sizeof(char)); if (!xbuf) return; va_copy(ap2, ap); res = vsnprintf(xbuf, res+31, fmt, ap2); va_end(ap2); } else xbuf = buf; t = time(NULL); localtime_r(&t, &bt); sprintf(timebuf, "%04i/%02i/%02i %02i:%02i:%02i: ", bt.tm_year+1900, bt.tm_mon, bt.tm_mday, bt.tm_hour, bt.tm_min, bt.tm_sec ); FILE *outfile = fopen("debug.log", "a"); if (outfile) { fputs(timebuf, outfile); char *p = xbuf; while (*p) { fputc(*p, outfile); if (*p == '\n') { if (p[1]) fputs(timebuf, outfile); } p++; } if (p > xbuf && p[-1] != '\n') fputc('\n', outfile); fclose(outfile); } if (xbuf != buf) free(xbuf); } #endif openpref-0.1.3/src/util/baser.h0000755000175000017500000000216111265177055015764 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef BASER_H #define BASER_H #include void serializeInt (QByteArray &ba, int i); bool unserializeInt (QByteArray &ba, int *pos, int *i); //void msSleep (int ms); #endif openpref-0.1.3/src/util/util.pri0000755000175000017500000000027111265177055016210 0ustar kostyakostyaDEPENDPATH += $$PWD INCLUDEPATH += $$PWD HEADERS += \ $$PWD/baser.h \ $$PWD/debug.h \ $$PWD/ncounter.h SOURCES += \ $$PWD/baser.cpp \ $$PWD/debug.cpp \ $$PWD/ncounter.cpp openpref-0.1.3/src/kpref.cpp0000755000175000017500000003450111265177055015360 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include #include #include #include #include "kpref.h" #include #include "desktop.h" #include "deskview.h" #include "formbid.h" #include "newgameform.h" #include "optform.h" #include "helpbrowser.h" #include "player.h" #include #include using std::string; #define HINTBAR_MAX_HEIGHT 22 const char * GenName(string str, string ext); //char *documentation; //see bottom this file Kpref *kpref; Kpref::Kpref () { setWindowTitle("OpenPref"); initMenuBar(); mInPaintEvent = mInMouseMoveEvent = mWaitingMouseUp = false; mDeskView = 0; mDesktop = 0; setMouseTracking(true); loadOptions(); HintBar = new QStatusBar; HintBar->setSizeGripEnabled(true); setStatusBar(HintBar); HintBar->setFixedHeight(HINTBAR_MAX_HEIGHT); QDesktopWidget *desk = QApplication::desktop(); QRect dims(desk->availableGeometry(this)); int w = dims.width()-60; //w = 528*2; int h = dims.height()-120; //h = 800; int x = dims.left()+(dims.width()-w)/2; int y = dims.top()+(dims.height()-h)/2; move(x, y); setMinimumWidth(CARDWIDTH*14.42); if (CARDHEIGHT*6 > 570) setMinimumHeight(CARDHEIGHT*6); else setMinimumHeight(570); //setFixedSize(w, h); resize(w, h); //connect(this, SIGNAL(rejected()), qApp, SLOT(quit())); } void Kpref::init () { //StatusBar1 = new QStatusBar(this); mDeskView = new DeskView(width(), height()-HINTBAR_MAX_HEIGHT); mDesktop = new PrefDesktop(mDeskView); connect(mDesktop, SIGNAL(deskChanged()), this, SLOT(forceRepaint())); connect(mDeskView, SIGNAL(deskChanged()), this, SLOT(forceRepaint())); HintBar->showMessage(tr("Welcome to OpenPref!")); // resize(width(),height()+HintBar->height()); } void Kpref::resizeEvent(QResizeEvent *event) { Q_UNUSED(event) mDeskView->DesktopWidth=width(); mDeskView->DesktopHeight=height()-HINTBAR_MAX_HEIGHT; mDesktop->draw(); forceRepaint(); } Kpref::~Kpref () { //delete StatusBar1; //!delete formBid; delete mDeskView; delete mDesktop; delete HintBar; delete Hint; } void Kpref::adjustDesk () { if (mDeskView) mDeskView->ClearScreen(); update(); } void Kpref::initMenuBar () { fileMenu = menuBar()->addMenu(tr("&Game")); actNewGame = fileMenu->addAction(QIcon(QString(":/pics/newgame.png")), tr("&New game..."), this, SLOT(slotNewSingleGame()), Qt::CTRL+Qt::Key_N); fileMenu->addSeparator(); actFileOpen = fileMenu->addAction(QIcon(QString(":/pics/fileopen.png")), tr("&Open..."), this, SLOT(slotFileOpen()), Qt::CTRL+Qt::Key_O); actFileSave = fileMenu->addAction(QIcon(QString(":/pics/filesave.png")), tr("&Save"), this, SLOT(slotFileSave()), Qt::CTRL+Qt::Key_S); fileMenu->addSeparator(); actOptions = fileMenu->addAction(QIcon(QString(":/pics/tool.png")), tr("&Options..."), this, SLOT(slotOptions()), Qt::CTRL+Qt::Key_P); fileMenu->addSeparator(); //actQuit = fileMenu->addAction(QIcon(QString(":/pics/exit.png")), tr("&Quit"), qApp, SLOT(quit()), Qt::CTRL+Qt::Key_Q); actQuit = fileMenu->addAction(QIcon(QString(":/pics/exit.png")), tr("&Quit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q); actFileSave->setEnabled(false); actOptions->setEnabled(true); viewMenu = menuBar()->addMenu(tr("&Show")); viewMenu->addAction(QIcon(QString(":/pics/paper.png")), tr("S&core..."), this, SLOT(slotShowScore()), Qt::CTRL+Qt::Key_R); menuBar()->addSeparator(); helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(tr("&Preferans Rules..."), this, SLOT(slotRules()), Qt::Key_F1); helpMenu->addAction(tr("&About OpenPref"), this, SLOT(slotHelpAbout()), 0); helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); //actAboutQt = helpMenu->addAction(tr("About &Qt")); //connect(actAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); } /////////////////////////////////////////////////////////////////////////////// // slots /////////////////////////////////////////////////////////////////////////////// void Kpref::slotFileOpen () { QString fileName = QFileDialog::getOpenFileName(this, "Select saved game", "", "*.prf"); if (!fileName.isEmpty()) { mDesktop->loadGame(fileName); actFileSave->setEnabled(true); mDesktop->runGame(); } } void Kpref::slotFileSave () { if (mDesktop) { QString fn = QFileDialog::getSaveFileName(this, "Select file to save the current game", "", "*.prf"); if (!fn.isEmpty()) { fn = GenName(fn.toStdString(), "prf"); mDesktop->saveGame(fn); } } } /* void Kpref::slotFileQuit() { //quit(); } */ void Kpref::slotShowScore () { mDesktop->closePool(); mDesktop->mShowPool = true; mDesktop->drawPool(); mDesktop->mDeskView->mySleep(-1); mDesktop->mShowPool = false; mDesktop->draw(); } void Kpref::forceRepaint () { update(); } void Kpref::slotNewSingleGame () { NewGameDialog *dlg = new NewGameDialog; // Players dlg->leHumanName->setText(optHumanName); dlg->leName1->setText(optPlayerName1); dlg->cbAlphaBeta1->setChecked(optAlphaBeta1); dlg->leName2->setText(optPlayerName2); dlg->cbAlphaBeta2->setChecked(optAlphaBeta2); // Conventions dlg->sbGame->setValue(optMaxPool); dlg->cbGreedy->setChecked(optWhistGreedy); dlg->rbTenWhist->setChecked(opt10Whist); dlg->cbStalin->setChecked(optStalingrad); dlg->cbAggPass->setChecked(optAggPass); dlg->cbWithoutThree->setChecked(optWithoutThree); if (dlg->exec() == QDialog::Accepted) { // Players optHumanName = dlg->leHumanName->text(); optPlayerName1 = dlg->leName1->text(); optAlphaBeta1 = dlg->cbAlphaBeta1->isChecked(); optPlayerName2 = dlg->leName2->text(); optAlphaBeta2 = dlg->cbAlphaBeta2->isChecked(); // Conventions optMaxPool = dlg->sbGame->value(); optWhistGreedy = dlg->cbGreedy->isChecked(); opt10Whist = dlg->rbTenWhist->isChecked(); optStalingrad = dlg->cbStalin->isChecked(); optAggPass = dlg->cbAggPass->isChecked(); optWithoutThree = dlg->cbWithoutThree->isChecked(); saveOptions(); delete dlg; } else { delete dlg; return; } if (mDesktop) { delete mDesktop; delete mDeskView; mDeskView = new DeskView(width(), height()-HINTBAR_MAX_HEIGHT); mDesktop = new PrefDesktop(); mDesktop->mDeskView = mDeskView; connect(mDesktop, SIGNAL(deskChanged()), this, SLOT(forceRepaint())); connect(mDeskView, SIGNAL(deskChanged()), this, SLOT(forceRepaint())); } optPassCount = 0; actFileOpen->setEnabled(false); actFileSave->setEnabled(true); mDesktop->runGame(); actFileOpen->setEnabled(true); actFileSave->setEnabled(false); } void Kpref::mouseMoveEvent (QMouseEvent *event) { if (mInMouseMoveEvent) return; mInMouseMoveEvent = true; Player *plr = mDesktop->currentPlayer(); if (plr) plr->hilightCard(event->x(), event->y()); mInMouseMoveEvent = false; } void Kpref::mousePressEvent (QMouseEvent *event) { mWaitingMouseUp = true; if (event->button() == Qt::LeftButton) { mDeskView->Event = 1; Player *plr = mDesktop->currentPlayer(); if (plr) { plr->mClickX = event->x(); plr->mClickY = event->y(); } } mWaitingMouseUp = false; } void Kpref::keyPressEvent (QKeyEvent *event) { if (mDeskView) { switch (event->key()) { case Qt::Key_Escape: case Qt::Key_Enter: case Qt::Key_Return: case Qt::Key_Space: mDeskView->Event = 2; break; default: ; } } } void Kpref::paintEvent (QPaintEvent *event) { Q_UNUSED(event) if (mInPaintEvent) return; mInPaintEvent = true; if (mDeskView) { mDeskView->DesktopHeight = height()-HINTBAR_MAX_HEIGHT; mDeskView->DesktopWidth = width(); } if (mDeskView && mDeskView->mDeskBmp) { QPainter p; p.begin(this); //p.drawPixmap(0, 0, *(mDeskView->mDeskBmp)); p.drawImage(0, 0, *(mDeskView->mDeskBmp)); p.end(); } mInPaintEvent = false; } void Kpref::closeEvent(QCloseEvent *event) { int ret; if (!mDesktop->mGameRunning) exit(0); ret = QMessageBox::question(this, tr("OpenPref"), tr("Do you really want to quit the game?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape); if (ret == QMessageBox::Yes) exit(0); else event->ignore(); } void Kpref::slotHelpAbout () { QMessageBox::about(this, tr("About"), tr("

OpenPref 0.1.3 ♣

" "

More information on
http://sourceforge.net/projects/openpref
" "Get latest sources on
http://gitorious.org/openprefqt4

\n" "
Copyright ©2000-2009, OpenPref Developers:
I.Azarniy, A.V.Fedotov, Ketmar Dark, K.Tokarev
" "
" "OpenPref is free software; you can redistribute it and/or modify
" "it under the terms of the GNU General Public License (see file
" "COPYING or http://www.gnu.org/licenses)") ); } void Kpref::saveOptions () { QSettings st; st.setValue("maxpool", optMaxPool); st.setValue("stalin", optStalingrad); st.setValue("whist10", opt10Whist); st.setValue("whistgreedy", optWhistGreedy); st.setValue("animdeal", optDealAnim); st.setValue("animtake", optTakeAnim); st.setValue("humanname", optHumanName); st.setValue("playername1", optPlayerName1); st.setValue("alphabeta1", optAlphaBeta1); st.setValue("playername2", optPlayerName2); st.setValue("alphabeta2", optAlphaBeta2); st.setValue("debughand", optDebugHands); st.setValue("without3", optWithoutThree); st.setValue("aggpass", optAggPass); st.setValue("prefclub", optPrefClub); } void Kpref::loadOptions () { QSettings st; optMaxPool = st.value("maxpool", 10).toInt(); if (optMaxPool < 4) optMaxPool = 4; else if (optMaxPool > 1000) optMaxPool = 1000; optStalingrad = st.value("stalin", false).toBool(); opt10Whist = st.value("whist10", false).toBool();// true => radio button checks 'check' nevertheless! optWhistGreedy = st.value("whistgreedy", true).toBool(); optDealAnim = st.value("animdeal", true).toBool(); optTakeAnim = st.value("animtake", true).toBool(); #ifndef WIN32 // May be #ifdef POSIX? optHumanName = st.value("humanname", getenv("USER")).toString(); #else optHumanName = st.value("humanname", "").toString(); #endif optPlayerName1 = st.value("playername1", tr("Player 1")).toString(); optAlphaBeta1 = (st.value("alphabeta1", false).toBool()); optPlayerName2 = st.value("playername2", tr("Player 2")).toString(); optAlphaBeta2 = (st.value("alphabeta2", false).toBool()); optWithoutThree = st.value("without3", false).toBool(); optDebugHands = st.value("debughand", false).toBool(); optAggPass = st.value("aggpass", false).toBool(); optPrefClub = st.value("prefclub", false).toBool(); } void Kpref::slotOptions () { bool oldPrefClub = optPrefClub; bool oldDebugHands = optDebugHands; OptDialog *dlg = new OptDialog; //connect(dlg->cbPrefClub, SIGNAL(clicked()), this, SLOT(slotDeckChanged())); dlg->cbAnimDeal->setChecked(optDealAnim); dlg->cbAnimTake->setChecked(optTakeAnim); dlg->cbDebugHands->setChecked(optDebugHands); dlg->cbPrefClub->setChecked(optPrefClub); if (dlg->exec() == QDialog::Accepted) { optDealAnim = dlg->cbAnimDeal->isChecked(); optTakeAnim = dlg->cbAnimTake->isChecked(); optPrefClub = dlg->cbPrefClub->isChecked(); optDebugHands = dlg->cbDebugHands->isChecked(); saveOptions(); } delete dlg; if ((optPrefClub != oldPrefClub) || (optDebugHands != oldDebugHands)) slotDeckChanged(); } void Kpref::slotDeckChanged () { mDeskView->freeCards(); mDeskView->loadCards(); setMinimumWidth(CARDWIDTH*14.42); if (CARDHEIGHT*6 > 570) setMinimumHeight(CARDHEIGHT*6); else setMinimumHeight(570); mDesktop->draw(); forceRepaint(); } void Kpref::slotRules () { QMessageBox::about(this, tr("Preferans Rules"), tr("Help system has not been implemented yet!\nSee http://en.wikipedia.org/wiki/Preferans")); //HelpBrowser *dlg = new HelpBrowser; //dlg->tbHelp->setSearchPaths(QStringList("/home/kostya/projects/Qt/doc/html")); //dlg->tbHelp->loadResource(0, QUrl::fromLocalFile("/home/kostya/projects/Qt/doc/html/index.html")); // delete dlg; } void Kpref::slotQuit () { int ret; if (!mDesktop->mGameRunning) exit(0); ret = QMessageBox::question(this, tr("OpenPref"), tr("Do you really want to quit the game?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape); if (ret == QMessageBox::Yes) exit(0); } /*void Kpref::slotAbortBid () { if ((formBid->_GamesType != showpool) && (formBid->_GamesType != zerogame)) { slotAbort(); formBid->_GamesType = zerogame; } }*/ void Kpref::MoveImpossible () { HintBar->showMessage(tr("This move is impossible")); } void Kpref::HintMove () { if (mDesktop->mBiddingDone) HintBar->showMessage(tr("Your move")); else HintBar->showMessage(tr("Select two cards to drop")); } bool Kpref::WhistType () { int ret = QMessageBox::question(kpref, tr("Choose whist type"), tr("Do you want to whist with opened cards?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape); if (ret == QMessageBox::Yes) return false; else return true; } const char * GenName(string str, string ext) { size_t dot_pos=str.rfind('.'); if (dot_pos!=string::npos) str.replace(dot_pos+1,str.length()-dot_pos,ext); else { str += "."; str += ext; } return str.c_str(); } openpref-0.1.3/src/forms/0000755000175000017500000000000011265437521014662 5ustar kostyakostyaopenpref-0.1.3/src/forms/forms.cmake0000644000175000017500000000051511265177055017016 0ustar kostyakostyaproject(openpref) SET ( HEADERS ${HEADERS} src/forms/optform.h src/forms/newgameform.h src/forms/helpbrowser.h src/forms/formbid.h src/forms/qbidbutton.h ) SET ( SOURCES ${SOURCES} src/forms/optform.cpp src/forms/newgameform.cpp src/forms/helpbrowser.cpp src/forms/formbid.cpp src/forms/qbidbutton.cpp )openpref-0.1.3/src/forms/qbidbutton.cpp0000755000175000017500000000250311265177055017547 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include "qbidbutton.h" QBidButton::QBidButton (eGameBid aBid, int x, int y, QWidget *parent) : QPushButton(parent), mBid(aBid) { QString iName, oName; iName.sprintf(":/pics/bids/s%i.png", aBid); oName.sprintf("g%i", aBid); setObjectName(oName); setGeometry(x, y, 40, 27); setMinimumSize(40, 27); setIconSize(QSize(40, 27)); setIcon(QIcon(iName)); } QBidButton::~QBidButton () { } openpref-0.1.3/src/forms/qbidbutton.h0000755000175000017500000000240611265177055017216 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef QBIDBUTTON_H #define QBIDBUTTON_H #include #include #include "prfconst.h" class QBidButton : public QPushButton { Q_OBJECT public: QBidButton (eGameBid aBid, int x, int y, QWidget *parent=0); ~QBidButton (); inline eGameBid bid () const { return mBid; } protected: eGameBid mBid; }; #endif openpref-0.1.3/src/forms/optform.cpp0000755000175000017500000000324111265177055017062 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include "optform.h" OptDialog::OptDialog (QWidget *parent) : QDialog(parent) { setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_DeleteOnClose, false); } void OptDialog::showEvent (QShowEvent *event) { Q_UNUSED(event) QWidget *parentObj = dynamic_cast(parent()); int x, y; if (parentObj) { QRect dims(parentObj->frameGeometry()); x = dims.left()+(dims.width()-width())/2; y = dims.top()+(dims.height()-height())/2; } else { QDesktopWidget *desk = QApplication::desktop(); QRect dims(desk->availableGeometry(this)); x = dims.left()+(dims.width()-width())/2; y = dims.top()+(dims.height()-height())/2; } move(x, y); } openpref-0.1.3/src/forms/newgameform.h0000755000175000017500000000233711265177055017355 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef NEWGAMEFORM_H #define NEWGAMEFORM_H #include #include "ui_newgameform.h" class NewGameDialog : public QDialog, public Ui_NewGameDialog { Q_OBJECT public: NewGameDialog (QWidget *parent=0); ~NewGameDialog () { } protected: void showEvent (QShowEvent *event); }; #endif openpref-0.1.3/src/forms/formbid.cpp0000755000175000017500000001476111265177055017027 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include #include #include #include "formbid.h" #include "prfconst.h" FormBid *formBid; FormBid::FormBid (QWidget *parent) : QDialog (parent) { this->setModal(true); setWindowTitle(tr("Bidding")); initDialog(); } FormBid::~FormBid () { } void FormBid::showEvent (QShowEvent *event) { Q_UNUSED(event) QWidget *parentObj = dynamic_cast(parent()); int x, y; if (parentObj) { QRect dims(parentObj->frameGeometry()); x = dims.left()+(dims.width()-width())/2; y = dims.top()+(dims.height()-height())/2; } else { QDesktopWidget *desk = QApplication::desktop(); QRect dims(desk->availableGeometry(this)); x = dims.left()+(dims.width()-width())/2; y = dims.top()+(dims.height()-height())/2; } move(x, y); } void FormBid::closeEvent(QCloseEvent *event) { int ret = QMessageBox::question(this, tr("OpenPref"), tr("Do you really want to quit the game?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape); if (ret == QMessageBox::Yes) exit(0); else event->ignore(); } void FormBid::slotPushButtonClick86 () { _GamesType = g86; accept(); } void FormBid::slotPushButtonClickPass () { _GamesType = gtPass; accept(); } void FormBid::slotPushButtonClickVist () { _GamesType = whist; accept(); } void FormBid::slotPushButtonClickHalfVist () { _GamesType = halfwhist; accept(); } void FormBid::slotWithoutThree () { _GamesType = withoutThree; accept(); } void FormBid::slotShowBullet () { _GamesType = (eGameBid)1; reject(); } void FormBid::onBidClick () { QBidButton *b = dynamic_cast(sender()); if (!b) return; _GamesType = b->bid(); accept(); } QList FormBid::buttonList () { QList res; QList wList = qFindChildren(this); foreach (QWidget *widget, wList) { QPushButton *b = dynamic_cast(widget); if (b) res << b; } return res; } QList FormBid::bidButtonList () { QList res; QList wList = qFindChildren(this); foreach (QWidget *widget, wList) { QBidButton *b = dynamic_cast(widget); if (b) res << b; } return res; } void FormBid::enableAll () { QList wList(buttonList()); foreach (QPushButton *b, wList) b->setEnabled(true); } void FormBid::disableAll () { QList wList(buttonList()); foreach (QPushButton *b, wList) b->setEnabled(false); } void FormBid::disableLessThan (eGameBid gameType) { QList wList(buttonList()); foreach (QPushButton *b, wList) { if (gameName2Type(b->objectName()) < gameType) b->setEnabled(false); } } void FormBid::disableItem (eGameBid gameType) { QList wList(buttonList()); foreach (QPushButton *b, wList) { if (gameName2Type(b->objectName()) == gameType) b->setEnabled(false); } } void FormBid::enableItem (eGameBid gameType) { QList wList(buttonList()); foreach (QPushButton *b, wList) { if (gameName2Type(b->objectName()) == gameType) b->setEnabled(true); } } void FormBid::initDialog () { this->resize(220, 260); this->setMinimumSize(220, 260); this->setMaximumSize(220, 260); for (int face = 6; face <= 10; face++) { int y = (face-6)*30+10; if (face > 8) y += 30; for (int suit = 1; suit <= 5; suit++) { int x = (suit-1)*40+10; int bid = face*10+suit; QBidButton *b = new QBidButton((eGameBid)bid, x, y, this); if (suit == 5) b->setToolTip(tr("no trump")); connect(b, SIGNAL(clicked()), this, SLOT(onBidClick())); } } b86 = new QPushButton(this); b86->setGeometry(10, 100, 200, 27); b86->setMinimumSize(0,0); b86->setObjectName("g86"); b86->setText(tr("&Misere")); bpass = new QPushButton(this); bpass->setGeometry(10,190,60,30); bpass->setMinimumSize(0,0); bpass->setObjectName("pass"); bpass->setText(tr("&Pass")); bpass->setIcon(QIcon(QString(":/pics/pass.png"))); bvist = new QPushButton(this); bvist->setGeometry(150,190,60,30); bvist->setMinimumSize(0,0); bvist->setObjectName("whist"); bvist->setText(tr("&Whist")); bvist->setIcon(QIcon(QString(":/pics/whist.png"))); bhalfvist = new QPushButton(this); bhalfvist->setGeometry(70, 190, 80, 30); bhalfvist->setMinimumSize(0,0); bhalfvist->setObjectName("halfwhist"); bhalfvist->setText(tr("&HalfWhist")); bhalfvist->setIcon(QIcon(QString(":/pics/halfwhist.png"))); showbullet = new QPushButton(this); showbullet->setGeometry(116, 220, 94, 27); showbullet->setMinimumSize(0, 0); showbullet->setText(tr("S&core")); showbullet->setToolTip(tr("Show game table with calculated scores")); showbullet->setIcon(QIcon(QString(":/pics/paper.png"))); bwithoutthree = new QPushButton(this); bwithoutthree->setGeometry(10, 220, 106, 27); bwithoutthree->setMinimumSize(0, 0); bwithoutthree->setText(tr("Without &Three")); bwithoutthree->setToolTip(tr("Cancel game with penalty of three untaken tricks. No whists are written")); bwithoutthree->setIcon(QIcon(QString(":/pics/cancel.png"))); connect(b86, SIGNAL(clicked()), this, SLOT(slotPushButtonClick86())); connect(bpass, SIGNAL(clicked()), this, SLOT(slotPushButtonClickPass())); connect(bvist, SIGNAL(clicked()), this, SLOT(slotPushButtonClickVist())); connect(bhalfvist, SIGNAL(clicked()), this, SLOT(slotPushButtonClickHalfVist())); connect(bwithoutthree, SIGNAL(clicked()), this, SLOT(slotWithoutThree())); connect(showbullet, SIGNAL(clicked()), this, SLOT(slotShowBullet())); } openpref-0.1.3/src/forms/helpbrowser.h0000644000175000017500000000232711265177055017376 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef HELPBROWSER_H #define HELPBROWSER_H #include #include "ui_helpbrowser.h" class HelpBrowser : public QDialog, public Ui_HelpBrowser { Q_OBJECT public: HelpBrowser (QWidget *parent=0); ~HelpBrowser () { } protected: void showEvent (QShowEvent *event); }; #endif openpref-0.1.3/src/forms/formbid.h0000755000175000017500000000401511265177055016463 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef FORMBID_H #define FORMBID_H #include #include #include #include #include #include "prfconst.h" #include "qbidbutton.h" class FormBid : public QDialog { Q_OBJECT public: FormBid (QWidget *parent=0); ~FormBid (); void enableAll (); void disableAll (); void disableLessThan (eGameBid);//(eGameBid); void disableItem (eGameBid); void enableItem (eGameBid); public slots: void onBidClick (); // universal handler void slotPushButtonClick86 (); void slotPushButtonClickPass (); void slotPushButtonClickVist (); void slotPushButtonClickHalfVist (); void slotWithoutThree (); void slotShowBullet (); protected: void initDialog (); QList buttonList (); QList bidButtonList (); void showEvent (QShowEvent *event); void closeEvent(QCloseEvent *event); public: eGameBid _GamesType; QPushButton *bwithoutthree; QPushButton *showbullet; QPushButton *bhalfvist; protected: QPushButton *b86; QPushButton *bpass; QPushButton *bvist; }; extern FormBid *formBid; #endif openpref-0.1.3/src/forms/forms.pri0000755000175000017500000000045111265177055016532 0ustar kostyakostyaDEPENDPATH += $$PWD INCLUDEPATH += $$PWD HEADERS += \ $$PWD/optform.h \ $$PWD/newgameform.h \ $$PWD/helpbrowser.h \ $$PWD/formbid.h \ $$PWD/qbidbutton.h SOURCES += \ $$PWD/optform.cpp \ $$PWD/newgameform.cpp \ $$PWD/helpbrowser.cpp \ $$PWD/formbid.cpp \ $$PWD/qbidbutton.cpp openpref-0.1.3/src/forms/optform.h0000755000175000017500000000230311265177055016525 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef OPTFORM_H #define OPTFORM_H #include #include "ui_optform.h" class OptDialog : public QDialog, public Ui_OptDialog { Q_OBJECT public: OptDialog (QWidget *parent=0); ~OptDialog () { } protected: void showEvent (QShowEvent *event); }; #endif openpref-0.1.3/src/forms/newgameform.cpp0000755000175000017500000000326111265177055017705 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include "newgameform.h" NewGameDialog::NewGameDialog (QWidget *parent) : QDialog(parent) { setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_DeleteOnClose, false); } void NewGameDialog::showEvent (QShowEvent *event) { Q_UNUSED(event) QWidget *parentObj = dynamic_cast(parent()); int x, y; if (parentObj) { QRect dims(parentObj->frameGeometry()); x = dims.left()+(dims.width()-width())/2; y = dims.top()+(dims.height()-height())/2; } else { QDesktopWidget *desk = QApplication::desktop(); QRect dims(desk->availableGeometry(this)); x = dims.left()+(dims.width()-width())/2; y = dims.top()+(dims.height()-height())/2; } move(x, y); } openpref-0.1.3/src/forms/helpbrowser.cpp0000644000175000017500000000325311265177055017730 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include "helpbrowser.h" HelpBrowser::HelpBrowser (QWidget *parent) : QDialog(parent) { setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_DeleteOnClose, false); } void HelpBrowser::showEvent (QShowEvent *event) { Q_UNUSED(event) QWidget *parentObj = dynamic_cast(parent()); int x, y; if (parentObj) { QRect dims(parentObj->frameGeometry()); x = dims.left()+(dims.width()-width())/2; y = dims.top()+(dims.height()-height())/2; } else { QDesktopWidget *desk = QApplication::desktop(); QRect dims(desk->availableGeometry(this)); x = dims.left()+(dims.width()-width())/2; y = dims.top()+(dims.height()-height())/2; } move(x, y); } openpref-0.1.3/src/logic/0000755000175000017500000000000011265437521014631 5ustar kostyakostyaopenpref-0.1.3/src/logic/aiplayer.cpp0000755000175000017500000016254511265177055017166 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include #include #include #include "aiplayer.h" #include "debug.h" AiPlayer::AiPlayer (int aMyNumber, DeskView *aDeskView) : Player(aMyNumber, aDeskView) { internalInit(); } void AiPlayer::clear () { Player::clear(); for (int f = 0; f <= 4; f++) { mSuitProb[f].tricks = 0; mSuitProb[f].perehvatov = 0; } } /////////////////////////////////////////////////////////////////////////////// // utils /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // масть с перехватами (max) Card *AiPlayer::GetMaxCardWithOutPere () { int index = 0, vz = 0, pere = 0; for (int f = 1; f <= 4; f++) { if (mSuitProb[f].tricks > vz || (mSuitProb[f].tricks == vz && mSuitProb[f].perehvatov < pere)) { index = f; vz = mSuitProb[f].tricks; pere = mSuitProb[f].perehvatov; } } if (index) return mCards.maxInSuit(index); return 0; } /////////////////////////////////////////////////////////////////////////////// // ??? Card *AiPlayer::GetMinCardWithOutVz () { int index = 0; double koef = 0, koef1 = 0; for (int f = 1; f <= 4; f++) { koef1 = mSuitProb[f].len+8/(1+mSuitProb[f].tricks); if ((koef1 > koef && mSuitProb[f].len != 0) || (mSuitProb[f].tricks == 0 && mSuitProb[f].len > 0)) { index = f; koef =koef1; } } if (index && index <=4) return mCards.minInSuit(index); return mCards.minFace(); } /////////////////////////////////////////////////////////////////////////////// // ??? Card *AiPlayer::GetMaxCardPere () { int index = 0, vz = 0, pere = 0; for (int f = 1; f <= 4; f++) { if (mSuitProb[f].tricks > vz || (mSuitProb[f].tricks == vz && mSuitProb[f].perehvatov > pere)) { index = f; vz = mSuitProb[f].tricks; pere = mSuitProb[f].perehvatov; } } if (index) return mCards.maxInSuit(index); return 0; } tSuitProbs AiPlayer::countTricks (eSuit Mast, CardList &aMaxCardList, int a23) { tSuitProbs suitProb; Card *MyCard, *tmpCard; CardList MyCardStack, EnemyCardStack; for (int c = 7; c <= FACE_ACE; c++) { MyCard = mCards.exists(c, Mast); if (MyCard) MyCardStack.insert(MyCard); MyCard = aMaxCardList.exists(c, Mast); if (MyCard) EnemyCardStack.insert(MyCard); } if (a23 != 23) suitProb = calcProbsForMax(MyCardStack, EnemyCardStack); else suitProb = calcProbsForMaxH23(MyCardStack, EnemyCardStack); suitProb.len = mCards.cardsInSuit(Mast); suitProb.sum = 0; for (int j = 7; j <= FACE_ACE; j++ ) { tmpCard = mCards.exists(j, Mast); if (tmpCard) suitProb.sum += tmpCard->face(); } return suitProb; } tSuitProbs AiPlayer::countGameTricks (eSuit Mast, int a23) { tSuitProbs suitProb; Card *MyCard, *tmpCard; CardList MyCardStack, EnemyCardStack; for (int c = 7; c <= FACE_ACE; c++) { MyCard = mCards.exists(c, Mast); if (MyCard) MyCardStack.insert(MyCard); else EnemyCardStack.insert(newCard(c, Mast)); } if (MyCardStack.count() >= 4 && MyCardStack.count() <= 5) EnemyCardStack.remove(EnemyCardStack.minFace()); if (a23 == 23) suitProb = calcProbsForMaxH23(MyCardStack, EnemyCardStack); else suitProb = calcProbsForMax(MyCardStack, EnemyCardStack); suitProb.len = mCards.cardsInSuit(Mast); suitProb.sum = 0; for (int j = 7; j <= FACE_ACE; j++) { tmpCard = mCards.exists(j, Mast); if (tmpCard) suitProb.sum += tmpCard->face(); } return suitProb; } //----------------------------------------------------------------------- tSuitProbs AiPlayer::countPassTricks (eSuit Mast, CardList &aMaxCardList) { tSuitProbs suitProb; Card *MyCard, *tmpCard; CardList MyCardStack, EnemyCardStack; for (int c = 7; c <= FACE_ACE; c++) { MyCard = mCards.exists(c, Mast); if (MyCard) MyCardStack.insert(MyCard); MyCard = aMaxCardList.exists(c, Mast); if (MyCard) EnemyCardStack.insert(MyCard); } suitProb = calcProbsForMin(MyCardStack, EnemyCardStack); suitProb.len = mCards.cardsInSuit(Mast); suitProb.sum = 0; for (int j = 7; j <= FACE_ACE; j++) { tmpCard = mCards.exists(j, Mast); if (tmpCard) suitProb.sum += tmpCard->face(); } return suitProb; } bool AiPlayer::checkForMisere () { int cur = 0; for (int Mast = SuitSpades; Mast <= SuitHearts; Mast++) { if (mCards.exists(7, Mast) && (mCards.exists(9, Mast) || mCards.exists(8, Mast)) && (mCards.exists(FACE_JACK, Mast) || mCards.exists(10, Mast))) { cur++; } } if (cur == 4) return true; return false; } //----------------------------------------------------------------------- // Для мин результата tSuitProbs AiPlayer::calcProbsForMin (CardList &my, CardList &enemy) { tSuitProbs suitProb; suitProb.tricks = 0; suitProb.perehvatov = 0; int nMaxLen; Card *MyCardMin, *EnemyCardMax, *EnemyCardMin; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //enemy->free(enemy->minFace()); nMaxLen = (my.count() > enemy.count()) ? my.count() : enemy.count() ; //my.count()>enemy->count() ? nMaxLen = my->count() : nMaxLen = enemy->count(); for (int f = 1; f <= nMaxLen; f++) { MyCardMin = my.minFace(); EnemyCardMax = enemy.maxFace(); if (MyCardMin) { EnemyCardMin = enemy.lesserInSuit(MyCardMin); if (!EnemyCardMin) EnemyCardMin = enemy.minFace(); } else { //EnemyCardMin = enemy->minFace(); break; } if (!EnemyCardMax && !EnemyCardMin) break; if (*MyCardMin > *EnemyCardMin) { // викидываем мою его младшую my.remove(MyCardMin); enemy.remove(EnemyCardMin); suitProb.tricks++; } else { my.remove(MyCardMin); enemy.remove(EnemyCardMax); } } return suitProb; } //----------------------------------------------------------------------- // Для максимального результата на 1 руке tSuitProbs AiPlayer::calcProbsForMax (CardList &my, CardList &enemy) { tSuitProbs suitProb; suitProb.tricks = 0; suitProb.perehvatov = 0; int nMaxLen, nIget = 1; Card *MyCardMax = 0, *EnemyCardMax = 0, *EnemyCardMin = 0; //my->count()>enemy->count() ? nMaxLen = my->count() : nMaxLen = enemy->count(); nMaxLen = (my.count() > enemy.count()) ? my.count() : enemy.count(); for (int f = 1; f <= nMaxLen; f++) { MyCardMax = my.maxFace(); if (MyCardMax) { EnemyCardMax = enemy.greaterInSuit(MyCardMax); if (!EnemyCardMax) EnemyCardMax = enemy.minFace(); } else EnemyCardMax = enemy.maxFace(); EnemyCardMin = enemy.minFace(); if (!MyCardMax) break; if (!EnemyCardMax && !EnemyCardMin) { // остаток -- мои взятки for (int j = 1; j <= my.count(); j++) suitProb.tricks++; break; } if (*MyCardMax > *EnemyCardMax) { // викидываем мою старшую, его младшую my.remove(MyCardMax); enemy.remove(EnemyCardMin); suitProb.tricks++; if (!nIget) suitProb.perehvatov++; nIget = 1; } else { my.remove(MyCardMax); enemy.remove(EnemyCardMax); nIget = 0; } } return suitProb; } //----------------------------------------------------------------------- // Для максимального результата на 2 и 3 руке tSuitProbs AiPlayer::calcProbsForMaxH23 (CardList &my, CardList &enemy) { tSuitProbs suitProb; suitProb.tricks = 0; suitProb.perehvatov = 0; int nMaxLen,nIget = 1; Card *MyCardMax, *EnemyCardMax; //my->count()>enemy->count() ? nMaxLen = my->count() : nMaxLen = enemy->count(); nMaxLen = (my.count() > enemy.count()) ? my.count() : enemy.count(); for (int f = 1; f <= nMaxLen; f++) { EnemyCardMax = enemy.maxFace(); if (EnemyCardMax) { // Пытаемся н-ти больше чеm у него MyCardMax = my.greaterInSuit(EnemyCardMax); if (!MyCardMax) { // Нет у меня больше чем у него MyCardMax = my.minFace(); if (!MyCardMax) break; // и меньше тож нет // Меньше чем у него my.remove(MyCardMax); enemy.remove(EnemyCardMax); nIget = 0; } else { // Есть больше чем у него my.remove(MyCardMax); enemy.remove(EnemyCardMax); suitProb.tricks++; if (!nIget) suitProb.perehvatov++; nIget = 1; } } else { // У него нет карт в данной масти! остаток -- мои взятки if (!enemy.count()) for (int j = 1; j <= my.count(); j++) suitProb.tricks++; //25.07.2000 for ( int j =1; j<=my->count();j++ ) suitProb.tricks++; break; } } return suitProb; } /////////////////////////////////////////////////////////////////////////////// // Пересчитывает таблицу дли распасов или мизера void AiPlayer::recalcPassOutTables (CardList &aMaxCardList, int a23) { Q_UNUSED(a23) mSuitProb[0].tricks = 0; mSuitProb[0].perehvatov = 0; mSuitProb[0].sum = 0; for (int f = 1; f <= 4; f++) { mSuitProb[f] = countPassTricks((eSuit)f, aMaxCardList); mSuitProb[0].tricks += mSuitProb[f].tricks; mSuitProb[0].perehvatov += mSuitProb[f].perehvatov; mSuitProb[0].sum += mSuitProb[f].sum; } } /////////////////////////////////////////////////////////////////////////////// // Пересчитывает таблицу tSuitProbs mSuitProb[5]; void AiPlayer::recalcTables (CardList &aMaxCardList, int a23) { int f; mSuitProb[0].tricks = 0; mSuitProb[0].perehvatov = 0; mSuitProb[0].sum = 0; for (f = 1; f <= 4; f++) { mSuitProb[f] = countTricks((eSuit)f, aMaxCardList, a23); mSuitProb[0].tricks += mSuitProb[f].tricks; mSuitProb[0].perehvatov += mSuitProb[f].perehvatov; mSuitProb[0].sum += mSuitProb[f].sum; } } void AiPlayer::loadLists (Player *aLeftPlayer, Player *aRightPlayer, CardList &aMaxCardList) { /* int nLeftVisible = aLeftPlayer->nCardsVisible,nRightVisible = aRightPlayer->nCardsVisible; int nCards = mCards.count(); */ mLeft.clear(); mRight.clear(); /* // !!!!!!!!!!!!!!!!!!!!!!!!! необходимо учитывать, что во взятках if ( !nLeftVisible && !nRightVisible ) { makestatfill(nCards,1); // ,1- for max list 2- for minlist } if ( nLeftVisible && !nRightVisible ) { makestatfill(nCards,1); // ,1- for max list 2- for minlist } if ( !nLeftVisible && nRightVisible ) { makestatfill(nCards,1); // ,1- for max list 2- for minlist } if ( nLeftVisible && nRightVisible ) { */ mLeft = aLeftPlayer->mCards; mRight = aRightPlayer->mCards; /* } */ // Get Max List only len /* for (int m = 1; m <= 4; m++) { for (int c = FACE_ACE; c >= 7; c--) { if (mLeft.exists(c, m) || mRight.exists(c, m)) { aMaxCardList.insert(newCard(c, m)); } } } */ for (int m = 1; m <= 4; m++) { Card *LeftMax,*RightMax,*Max=0; while (mLeft.cardsInSuit(m) || mRight.cardsInSuit(m)) { LeftMax = mLeft.maxInSuit(m); RightMax = mRight.maxInSuit(m); if (LeftMax == 0 && RightMax == 0) { Max = 0; } else if (LeftMax == 0 && RightMax != 0) { Max = RightMax; mRight.remove(Max); } else if (LeftMax != 0 && RightMax == 0) { Max = LeftMax; mLeft.remove(Max); } else if (*LeftMax > *RightMax) { Max = LeftMax; mLeft.remove(LeftMax); mRight.remove(RightMax); } else { Max = RightMax; mLeft.remove(LeftMax); mRight.remove(RightMax); } } if (Max != 0) aMaxCardList.insert(newCard(Max->face(), Max->suit())); } mLeft.clear(); mRight.clear(); mLeft = aLeftPlayer->mCards; mRight = aRightPlayer->mCards; } /////////////////////////////////////////////////////////////////////////////// // game mechanics /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // miseres, play /////////////////////////////////////////////////////////////////////////////// // misere, my move is first Card *AiPlayer::Miser1 (Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; if (mCards.count() == 10) { // первый выход в 8..туз если она одна for (int m = 1; m <= 4; m++) { if (mCards.cardsInSuit(m) == 1) { cur = mCards.minInSuit(m); break; } } } if (!cur) { for (int m = 4; m >= 1; m--) { if (cur) break; for (int c = FACE_ACE; c >= 7; c--) { if (cur) break; Card *my; //,*leftmax,*leftmin,*rightmax,*rightmin; my = mCards.exists(c, m); if (my) { int matrixindex = 0; matrixindex += aLeftPlayer->mCards.lesserInSuit(my) ? 1:0; matrixindex <<= 1; matrixindex += aLeftPlayer->mCards.greaterInSuit(my) ? 1:0; matrixindex <<= 1; matrixindex += aRightPlayer->mCards.lesserInSuit(my) ? 1:0; matrixindex <<= 1; matrixindex += aRightPlayer->mCards.greaterInSuit(my) ? 1:0; if (matrixindex == 1 || matrixindex == 9 || matrixindex == 13 || (matrixindex >= 4 && matrixindex <= 7)) { cur = my; } } } } } if (!cur) cur = mCards.minInSuit(1); if (!cur) cur = mCards.minInSuit(2); if (!cur) cur = mCards.minInSuit(3); if (!cur) cur = mCards.minInSuit(4); return cur; } /////////////////////////////////////////////////////////////////////////////// // misere, my move is second Card *AiPlayer::Miser2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; if (mCards.cardsInSuit(aRightCard->suit())) { for (int c = FACE_ACE; c >= 7; c--) { if (cur) break; Card *my; //,*leftmax,*leftmin,*rightmax,*rightmin; my = mCards.exists(c, aRightCard->suit()); if (my) { int matrixindex = 0; matrixindex += aLeftPlayer->mCards.lesserInSuit(my) ? 1:0; matrixindex <<= 1; matrixindex += aLeftPlayer->mCards.greaterInSuit(my) ? 1:0; matrixindex <<= 1; matrixindex += (*aRightCard < *my) ? 1:0; matrixindex <<= 1; matrixindex += (*aRightCard > *my) ? 1:0; if (matrixindex == 1 || matrixindex == 9 || matrixindex==13 || (matrixindex >= 4 && matrixindex <= 7)) { cur = my; } } } if (!cur) cur = mCards.maxInSuit(aRightCard->suit()); } else { CardList aMaxCardList; loadLists(aRightPlayer, aLeftPlayer, aMaxCardList); cur = GetMaxCardWithOutPere(); if (!cur) cur = GetMaxCardPere(); // масть с перехватами (max) if (!cur) cur = GetMinCardWithOutVz(); // лабуду if (!cur) cur = mCards.maxFace(); } return cur; } /////////////////////////////////////////////////////////////////////////////// // misere, my move is third Card *AiPlayer::Miser3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { // copy from MyPass3 Card *cur = 0; eGameBid tmpGamesType = mMyGame; CardList aMaxCardList; //int mast = mMyGame-(mMyGame/10)*10; // набираем списки loadLists(aLeftPlayer, aRightPlayer, aMaxCardList); recalcPassOutTables(aMaxCardList, 23); if (mCards.cardsInSuit(aLeftCard->suit())) { // у меня есть масть в которую зашел левый; постараемся пропустить if (aLeftCard->suit() == aRightCard->suit()) { cur = (*aRightCard > *aLeftCard) ? mCards.lesserInSuit(aRightCard) : mCards.lesserInSuit(aLeftCard); } else cur = mCards.lesserInSuit(aLeftCard); if (!cur) cur = mCards.maxInSuit(aLeftCard->suit()); } else { // у меня нет масти в которую зашел левый cur = GetMaxCardWithOutPere(); if (!cur) cur = GetMaxCardPere(); // масть с перехватами (max) if (!cur) cur = GetMinCardWithOutVz(); // лабуду if (!cur) cur = mCards.minFace(); } mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // miseres, catch /////////////////////////////////////////////////////////////////////////////// // misere catch, my move is first Card *AiPlayer::MiserCatch1 (Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; CardList aMaxCardList; CardList *Naparnik; eHand Side; if (aRightPlayer->myGame() == g86) { loadLists(aRightPlayer, aRightPlayer, aMaxCardList); Naparnik = &(aLeftPlayer->mCards); Side = RightHand; } else { loadLists(aLeftPlayer, aLeftPlayer, aMaxCardList); Naparnik = &(aRightPlayer->mCards); Side = LeftHand; } recalcPassOutTables(aMaxCardList, 1); // Randomization int suit[4]; int s; for (int i=0; i<4; i++) { s=0; while (s==0) { s = qrand()%4+1; for (int j=0; jminInSuit(m); Card *MyMin = mCards.minInSuit(m); if (cur) goto badlabel; if (EnemyMin) { //есть такая if (MyMin) { // и у меня есть такая if (NaparnikMin) { // и у напарника есть такая if (*NaparnikMin < *EnemyMin && *MyMin < *EnemyMin) { cur = MyMin;// Всунули goto badlabel; } if (*NaparnikMin > *EnemyMin && *MyMin < *EnemyMin) { // надо н-ти такую масть по которой он может пронести а // но должен вернутся ко мне for (int k = 1; k <= 4; k++) { if (k == m || aMaxCardList.cardsInSuit(k) == 0) continue; Card *EnemyMax = aMaxCardList.maxInSuit(k); Card *NaparnikMax = Naparnik->maxInSuit(k); Card *MyMax = mCards.maxInSuit(k); if (MyMax && NaparnikMax && EnemyMax) { if (Naparnik->cardsInSuit(k) < mCards.cardsInSuit(k) && Naparnik->cardsInSuit(k) < aMaxCardList.cardsInSuit(k)) { cur = mCards.lesserInSuit(EnemyMax); //MyMax; // на этой он должен пронести NaparnikMax if (aRightPlayer->myGame() == g86) aRightPlayer->mCardCarryThru = NaparnikMax; else aLeftPlayer->mCardCarryThru = NaparnikMax; goto badlabel; } } } } } else { //у напорника нет масти if (*MyMin < *EnemyMin) { cur = MyMin;// Всунули goto badlabel; } } } } } if ((Side == LeftHand) && (!cur)) // if we didn't choose anything wise, move lesser card cur = mCards.minFace(); else { //2 отгребаем свое if (!cur) cur = GetMaxCardWithOutPere(); // 3 пытаемс if (!cur) cur = GetMaxCardWithOutPere(); if (!cur) cur = mCards.minFace(); } // } else { //Side == LeftHand // } badlabel: return cur; } /////////////////////////////////////////////////////////////////////////////// // misere catch, my move is second Card *AiPlayer::MiserCatch2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; CardList aMaxCardList; CardList *Naparnik; eHand Side; if (aRightPlayer->myGame() == g86) { loadLists(aRightPlayer, aRightPlayer, aMaxCardList); Naparnik = &(aLeftPlayer->mCards); Side = RightHand; } else { loadLists(aLeftPlayer, aLeftPlayer, aMaxCardList); Naparnik = &(aRightPlayer->mCards); Side = LeftHand; } recalcPassOutTables(aMaxCardList, 23); if (Side == LeftHand) { // enemy is left if (mCards.cardsInSuit(aRightCard->suit())) { // у меня есть карты в данной масти Card *MyMax = mCards.maxInSuit(aRightCard->suit()); //Card *MyMin = mCards.minInSuit(aRightCard->suit()); //Card *EnMax = aMaxCardList->maxInSuit(aRightCard->suit()); Card *EnMin = aMaxCardList.minInSuit(aRightCard->suit()); if (EnMin) { // у противника есть карты в данной масти if (*aRightCard < *EnMin) { // можно попытаться всунуть cur = mCards.lesserInSuit(EnMin); if (!cur) cur = mCards.greaterInSuit(EnMin); } else cur= mCards.greaterInSuit(EnMin); } else cur = MyMax; // А вот тут надо смотреть кому нужен ход } else { // у меня нет карт в данной масти if (mCardCarryThru) { //надо пронести карту if (mCards.exists(mCardCarryThru->face(),mCardCarryThru->suit())) { cur = mCardCarryThru; } else { cur = mCards.maxInSuit(mCardCarryThru->suit()); if (!cur) cur = mCards.maxFace(); } } else { // указания на пронос - нет cur = GetMaxCardPere(); if (!cur) cur = mCards.maxFace(); } } } else { // противник зашел под меня Card *MyMax = mCards.maxInSuit(aRightCard->suit()); Card *MyMin = mCards.minInSuit(aRightCard->suit()); if (MyMax) { if (*MyMin < *aRightCard) { // if we both have lesser card in suit, or friend has nothing in // this suit, enemy will take the trick Card *NapMin = Naparnik->lesserInSuit(aRightCard); Card *NapMax = Naparnik->greaterInSuit(aRightCard); if (NapMin || !NapMax) cur = mCards.lesserInSuit(aRightCard); else cur = MyMax; // кому передать код ? } else cur = MyMax; // грохать ее самой большой } else { // а у меня нет масти cur = GetMaxCardPere(); if (!cur) cur = mCards.maxFace(); } } mCardCarryThru = 0; if (!cur) cur = mCards.minFace(); return cur; } /////////////////////////////////////////////////////////////////////////////// // misere catch, my move is third Card *AiPlayer::MiserCatch3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; CardList aMaxCardList; CardList *Naparnik; eHand Side; if (aRightPlayer->myGame() == g86) { loadLists(aRightPlayer, aRightPlayer, aMaxCardList); Naparnik = &(aLeftPlayer->mCards); Side = RightHand; printf("right is enemy"); } else { loadLists(aLeftPlayer, aLeftPlayer, aMaxCardList); Naparnik = &(aRightPlayer->mCards); Side = LeftHand; printf("left is enemy"); } recalcPassOutTables(aMaxCardList, 23); if (Side == LeftHand) { // Right player is my friend if (mCards.cardsInSuit(aLeftCard->suit())) { // у меня есть карты в данной масти //Card *MyMax = mCards.maxInSuit(aLeftCard->suit()); //Card *MyMin = mCards.minInSuit(aLeftCard->suit()); if (*aLeftCard < *aRightCard) { // напарник уже придавил карту cur = mCards.maxInSuit(aLeftCard->suit()); } else { //есть шанс всунуть cur = mCards.lesserInSuit(aLeftCard); if (!cur) cur = mCards.maxInSuit(aLeftCard->suit()); } } else { // у меня нет карт в данной масти if (mCardCarryThru) { //надо пронести карту if (mCards.exists(mCardCarryThru->face(),mCardCarryThru->suit())) { cur = mCardCarryThru; } else { cur = mCards.maxInSuit(mCardCarryThru->suit()); if (!cur) cur = mCards.maxFace(); } } else { // указания на пронос - нет cur = GetMaxCardPere(); if (!cur) cur = mCards.maxFace(); } } } else { // Left player is my friend Card *MyMax = mCards.maxInSuit(aLeftCard->suit()); Card *MyMin = mCards.minInSuit(aLeftCard->suit()); if (MyMax) { if ((*MyMin < *aRightCard) && (aLeftCard->suit()==aRightCard->suit())) { // push lesser card than enemy cur = mCards.lesserInSuit(aRightCard); if (!cur) cur = MyMax; } else cur = MyMax; // грохать ее самой большой } else { // have no car of this suit cur = GetMaxCardPere(); if (!cur) cur = mCards.maxFace(); } } mCardCarryThru = 0; return cur; } /////////////////////////////////////////////////////////////////////////////// // game /////////////////////////////////////////////////////////////////////////////// // game, my move is first Card *AiPlayer::MyGame1 (Player *aLeftPlayer, Player *aRightPlayer) { // 1-выбить козыря 2-разиграть масти с перехватами 3-без перехватов 4-??? Card *cur = 0; eGameBid tmpGamesType = mMyGame; CardList aMaxCardList; int mast = mMyGame-(mMyGame/10)*10; // набираем списки loadLists(aLeftPlayer, aRightPlayer, aMaxCardList); recalcTables(aMaxCardList, 1); if (mLeft.cardsInSuit(mast) || mRight.cardsInSuit(mast)) { // У противников есть козыря cur = mCards.maxInSuit(mast); if (!cur) cur = GetMaxCardWithOutPere(); // а у меня их нет !!! if (!cur) cur = GetMaxCardPere(); //масть с перехватами (max) if (!cur) cur = GetMinCardWithOutVz(); // лабуду if (!cur) cur = mCards.maxFace(); } else { // а козырьков у них и нету !!! if (!cur) cur = GetMaxCardPere(); //масть с перехватами (max) if (!cur) cur = GetMaxCardWithOutPere(); // и у меня их нет !!! if (!cur) cur = GetMinCardWithOutVz(); // лабуду if (!cur) cur = mCards.maxInSuit(mast); if (!cur) cur = mCards.maxFace(); } mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // game, my move is second Card *AiPlayer::MyGame2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { CardList aMaxCardList; eGameBid tmpGamesType = mMyGame; Card *cur = 0; Card *MaxLeftCard = 0; int mast = aRightCard->suit(); int koz = mMyGame-(mMyGame/10)*10; // набираем списки loadLists(aLeftPlayer, aRightPlayer, aMaxCardList); recalcTables(aMaxCardList, 23); cur = mCards.maxInSuit(mast); if (!cur) { // Нет Масти if (!aLeftPlayer->mCards.cardsInSuit(mast)) { // У левого тож нету MaxLeftCard = aLeftPlayer->mCards.maxInSuit(koz); // k8: это заебись, а чо, если у нас нихуя козыря нет? cur = mCards.greaterInSuit(MaxLeftCard); // k8: тогда тут тоже нет нихуя if (!cur) cur = mCards.lesserInSuit(MaxLeftCard); // k8: и тут тоже нихуя if (!cur) cur = GetMinCardWithOutVz(); // лабуду if (!cur) cur = mCards.minFace(); } else { // Есть масть у левого cur = mCards.minInSuit(koz); // k8: это заебись, а чо, если у нас нихуя козыря нет? // k8: копипасты? if (!cur) cur = GetMinCardWithOutVz(); // лабуду if (!cur) cur = mCards.minFace(); } } else { // У меня есть масть if (aLeftPlayer->mCards.cardsInSuit(mast)) { //У левого есть MaxLeftCard = aLeftPlayer->mCards.maxInSuit(mast); cur = mCards.greaterInSuit(MaxLeftCard); if (!cur) cur = mCards.lesserInSuit(MaxLeftCard); } else { // У левого нет if (!aLeftPlayer->mCards.cardsInSuit(koz)) { // И козырей нет cur = mCards.greaterInSuit(aRightCard); if (!cur) cur = mCards.minInSuit(mast); } else { // есть у левого козыря cur = mCards.minInSuit(mast); } } } mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // game, my move is third Card *AiPlayer::MyGame3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; Card *maxInSuit; eGameBid tmpGamesType = mMyGame; CardList aMaxCardList; int mast = mMyGame-(mMyGame/10)*10; // набираем списки loadLists(aLeftPlayer, aRightPlayer, aMaxCardList); recalcTables(aMaxCardList, 23); if (mCards.cardsInSuit(aLeftCard->suit())) { // у меня есть масть, в которую зашел левый if (aLeftCard->suit() == aRightCard->suit()) { // постараемся ударить cur = mCards.greaterInSuit(aLeftCard); if (!cur) cur = mCards.minInSuit(aLeftCard->suit()); } else { //aLeftCard->suit() == aRightCard->suit() if (aRightCard->suit() != mast) { // не бита козырем cur = mCards.greaterInSuit(aLeftCard); if (!cur) cur = mCards.minInSuit(aLeftCard->suit()); } else { // бита козырем, мне не надо бить cur = mCards.minInSuit(aLeftCard->suit()); } } } else { // у меня нет масти в которую зашел левый if (aLeftCard->suit() == aRightCard->suit()) { //k8:? bug? //if (*aLeftCard > *aRightCard) maxInSuit = aLeftCard; else maxInSuit = aLeftCard; if (*aLeftCard > *aRightCard) maxInSuit = aLeftCard; else maxInSuit = aRightCard; } else { if (aLeftCard->suit() != mast && aRightCard->suit() != mast) maxInSuit = aLeftCard; else maxInSuit = aRightCard; } cur = mCards.greaterInSuit(maxInSuit); if (!cur) cur = mCards.minInSuit(mast); if (!cur) cur = GetMinCardWithOutVz(); // нет коз. if (!cur) cur = mCards.minFace(); } mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // whist /////////////////////////////////////////////////////////////////////////////// // мой вист или пас 1 заход - мой Card *AiPlayer::MyWhist1 (Player *aLeftPlayer, Player *aRightPlayer) { // 1 - выбить козыря 2-разиграть масти с перехватами 3-без перехватов 4-??? Card *cur = 0; eGameBid tmpGamesType = mMyGame; CardList aMaxCardList; Player *aEnemy, *aFriend; int mast; // Кто игрок а кто напарник if (aLeftPlayer->myGame() != gtPass && aLeftPlayer->myGame() != whist) { aEnemy = aLeftPlayer; aFriend = aRightPlayer; } else { aEnemy = aRightPlayer; aFriend = aLeftPlayer; } mast = aEnemy->myGame()-(aEnemy->myGame()/10)*10; // набираем списки //loadLists(aLeftPlayer,aRightPlayer,aMaxCardList); //recalcTables(aMaxCardList,1); if (aEnemy == aLeftPlayer) { // Слева игрок loadLists(aLeftPlayer, aLeftPlayer, aMaxCardList); recalcTables(aMaxCardList, 1); if (aLeftPlayer->mCards.cardsInSuit(mast) <= 2) { Card *m = mCards.maxInSuit(mast); if (!m) cur = mCards.minInSuit(aLeftPlayer->mCards.emptySuit (mast)); else if (aLeftPlayer->mCards.maxInSuit(mast)->face() < m->face()) cur = mCards.maxInSuit(mast); else cur = mCards.minInSuit(aLeftPlayer->mCards.emptySuit(mast)); } else { cur = mCards.minInSuit(aLeftPlayer->mCards.emptySuit (mast)); } if (!cur) cur = GetMinCardWithOutVz(); /* if ( mCards.exists(FACE_ACE,cur->suit()) || mCards.exists(FACE_KING,cur->suit())) { cur = 0; cur = mCards.minInSuit(aMaxCardList->emptySuit(0)); } */ if (!cur) cur = GetMaxCardWithOutPere(); if (!cur) cur = mCards.minInSuit(mast); if (!cur) cur = GetMaxCardPere(); } else { // слева - напарник loadLists(aRightPlayer, aRightPlayer, aMaxCardList); recalcTables(aMaxCardList, 1); cur = GetMaxCardWithOutPere(); if (!cur) cur = GetMaxCardPere(); if (!cur) cur = mCards.maxFace(); } mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // мой вист или пас 2 заход - мой Card *AiPlayer::MyWhist2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; eGameBid tmpGamesType = mMyGame; CardList aMaxCardList; Player *aEnemy, *aFriend; int mast; // Кто игрок а кто напарник if (aLeftPlayer->myGame() != gtPass && aLeftPlayer->myGame() != whist) { aEnemy = aLeftPlayer; aFriend = aRightPlayer; } else { aEnemy = aRightPlayer; aFriend = aLeftPlayer; } mast = aEnemy->myGame()-(aEnemy->myGame()/10)*10; // набираем списки if (aEnemy == aLeftPlayer) { // Слева игрок loadLists(aLeftPlayer, aLeftPlayer, aMaxCardList); recalcTables(aMaxCardList, 23); // Ну если он заходил под вистуза с туза if ( aRightCard->face() >= 10 ) cur = mCards.minInSuit(aRightCard->suit()); else cur = mCards.maxInSuit(aRightCard->suit()); // может умный и больше заходов у него нет в данную масть а есть козырь if (!cur) cur = mCards.maxInSuit(mast); // а у меня масти и нет !!! прибъем максимальной if (!cur) cur = GetMinCardWithOutVz(); } else { // слева - напарник loadLists(aRightPlayer, aRightPlayer, aMaxCardList); recalcTables(aMaxCardList, 23); cur = mCards.greaterInSuit(aRightCard); if (!cur) cur = mCards.minInSuit(aRightCard->suit()); if (!cur) cur = mCards.minInSuit(mast); // Нет масти пробуем козырь if (!cur) cur = GetMinCardWithOutVz(); // Нет масти и козыря } mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // мой вист или пас 3 заход - мой Card *AiPlayer::MyWhist3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; Card *maxInSuit; eGameBid tmpGamesType = mMyGame; CardList aMaxCardList; Player *aEnemy, *aFriend; int mast; // Кто игрок а кто напарник if (aLeftPlayer->myGame() != gtPass && aLeftPlayer->myGame() != whist) { aEnemy = aLeftPlayer; aFriend = aRightPlayer; } else { aEnemy = aRightPlayer; aFriend = aLeftPlayer; } mast = aEnemy->myGame()-(aEnemy->myGame()/10)*10; // набираем списки //loadLists(aLeftPlayer,aRightPlayer,aMaxCardList); //recalcTables(aMaxCardList,23); if (mCards.cardsInSuit(aLeftCard->suit())) { // у меня есть масть в которую зашел левый if (aEnemy == aLeftPlayer) { // левый - вражина loadLists(aLeftPlayer, aLeftPlayer, aMaxCardList); recalcTables(aMaxCardList, 23); if (aLeftCard->suit() == aRightCard->suit()) { if (*aRightCard > *aLeftCard) { // бить не надо cur = mCards.minInSuit(aRightCard->suit()); } else { // постараемсмя ударить cur = mCards.greaterInSuit(aLeftCard); if (!cur) cur = mCards.minInSuit(aLeftCard->suit()); } } else { //aLeftCard->suit() == aRightCard->suit() if (aRightCard->suit() != mast) { // не бита козырем cur = mCards.greaterInSuit(aLeftCard); if (!cur) cur = mCards.minInSuit(aLeftCard->suit()); } else { // бита козырем, мне не надо бить cur = mCards.minInSuit(aLeftCard->suit()); } } } else { //правый вражииина loadLists(aRightPlayer, aRightPlayer, aMaxCardList); recalcTables(aMaxCardList, 23); if (aLeftCard->suit() == aRightCard->suit()) { if (*aRightCard > *aLeftCard) { // попытаться прибить правого cur = mCards.greaterInSuit(aRightCard); if (!cur) cur = mCards.minInSuit(aRightCard->suit()); } else { // бить не надо cur = mCards.minInSuit(aRightCard->suit()); } } else { if (aRightCard->suit() == mast) { // левый зашел, а правый пригрел козырем cur = mCards.minInSuit(aLeftCard->suit()); } else { // Ух ты .... Левый друг зашел а правый пронес ерунду !!! cur = mCards.minInSuit(aLeftCard->suit()); } } } } else { // у меня нет масти в которую зашел левый if (aLeftCard->suit() == aRightCard->suit()) { //k8: wtf? //if (*aLeftCard > *aRightCard) maxInSuit = aLeftCard; else maxInSuit = aLeftCard; if (*aLeftCard > *aRightCard) maxInSuit = aLeftCard; else maxInSuit = aRightCard; } else { if (aLeftCard->suit() != mast && aRightCard->suit() != mast) maxInSuit = aLeftCard; else maxInSuit = aRightCard; } if (aEnemy == aLeftPlayer) { // Слева игрок loadLists(aLeftPlayer, aLeftPlayer, aMaxCardList); recalcTables(aMaxCardList, 23); if (maxInSuit == aLeftCard) { // попытаемся хлопнуть его карту cur = mCards.greaterInSuit(aLeftCard); } else { // Уже наша взятка... скидываем минимальную cur = mCards.minInSuit(maxInSuit->suit()); } } else { // слева - напарник loadLists(aRightPlayer, aRightPlayer, aMaxCardList); recalcTables(aMaxCardList, 23); if (maxInSuit == aLeftCard) { // Уже наша взятка... скидываем минимальную cur = mCards.minInSuit(maxInSuit->suit()); } else { //попытаемся хлопнуть его карту cur = mCards.greaterInSuit(aLeftCard); } } if (!cur) cur = mCards.minInSuit(mast); if (!cur) cur = GetMinCardWithOutVz(); // нет коз. if (!cur) cur = mCards.minFace(); } mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // pass-outs /////////////////////////////////////////////////////////////////////////////// // my passout first Card *AiPlayer::MyPass1 (Card *rMove, Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; eGameBid tmpGamesType = mMyGame; CardList aMaxCardList; CardList aTmpList, aStackStore; int doRest = 0; if (rMove != 0) { cur = mCards.minInSuit(rMove->suit()); return cur; /*aTmpList.copySuit(&mCards, (eSuit)rMove->suit()); aStackStore = mCards; mCards = aTmpList; doRest = 1;*/ //loadLists(aLeftPlayer, aRightPlayer, aMaxCardList); // !!!!!!!!! //recalcPassOutTables(aMaxCardList, 1); } if (tmpGamesType == raspass || tmpGamesType == g86) { // распасы/мизер loadLists(aLeftPlayer, aRightPlayer, aMaxCardList); // !!!!!!!!! recalcPassOutTables(aMaxCardList,1); // тема такая : 100 % отбери своё, если такового нет - мах в минимально длинной масти /*cur = GetMaxCardWithOutPere(); // за искл тех случ коды масти уже нет if (cur) { if (aLeftPlayer->mCards.cardsInSuit(cur->suit()) == 0 && aRightPlayer->mCards.cardsInSuit(cur->suit()) == 0) { cur = 0; } }*/ //if (!cur) cur = GetMaxCardPere(); //масть с перехватами (max) //if (!cur) cur = GetMinCardWithOutVz(); // лабуду // Randomization int suit[4]; int s; for (int i=0; i<4; i++) { s=0; while (s==0) { s = qrand()%4+1; for (int j=0; jmCards.greaterInSuit(cur) != 0 || aRightPlayer->mCards.greaterInSuit(cur) != 0) return cur; else cur = 0; } if (!cur) cur = mCards.minFace(); } //if (doRest) mCards = aStackStore; //mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // my passout second Card *AiPlayer::MyPass2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { Card *cur = 0; eGameBid tmpGamesType = mMyGame; int mast = aRightCard->suit(); CardList aMaxCardList; loadLists(aLeftPlayer, aRightPlayer, aMaxCardList); recalcPassOutTables(aMaxCardList, 1); ///////////////////////////////////////////////////////// if (tmpGamesType == raspass || tmpGamesType == g86) { // распасы/мизер cur = mCards.maxInSuit(mast); if (!cur) { // Нет Масти // во шара !!! Льем мах в масти где есть 100% взятки cur = GetMaxCardWithOutPere(); if (!cur) cur = GetMaxCardPere(); //масть с перехватами (max) if (!cur) cur = GetMinCardWithOutVz(); // лабуду if (!cur) cur = mCards.minFace(); } else { // У меня есть масть if (aLeftPlayer->mCards.cardsInSuit(mast)) { //У левого есть cur = mCards.lesserInSuit(aLeftPlayer->mCards.minInSuit(mast)); if (!cur) cur = mCards.lesserInSuit(aRightCard); if (!cur) cur = mCards.maxInSuit(mast); } else { // У левого нет cur = mCards.lesserInSuit(aRightCard); if (!cur) cur = mCards.maxInSuit(mast); } } } ///////////////////////////////////////////////////////// mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // my passout third Card *AiPlayer::MyPass3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer) { Card *cur=0; /*Card *maxInSuit;*/ eGameBid tmpGamesType = mMyGame; CardList aMaxCardList; //int mast = mMyGame-(mMyGame/10)*10; // набираем списки loadLists(aLeftPlayer, aRightPlayer, aMaxCardList); recalcPassOutTables(aMaxCardList, 23); if (mCards.cardsInSuit(aLeftCard->suit())) { // у меня есть масть в которую зашел левый // постараемсмя пропустить if (aLeftCard->suit() == aRightCard->suit()) { if (*aRightCard > *aLeftCard) cur = mCards.lesserInSuit(aRightCard); else cur = mCards.lesserInSuit(aLeftCard); } else cur = mCards.lesserInSuit(aLeftCard); if (!cur) cur = mCards.maxInSuit(aLeftCard->suit()); } else { // у меня нет масти в которую зашел левый cur = GetMaxCardWithOutPere(); if (!cur) cur = GetMaxCardPere(); //масть с перехватами (max) if (!cur) cur = GetMinCardWithOutVz(); // лабуду if (!cur) cur = mCards.minFace(); } mMyGame = tmpGamesType; return cur; } /////////////////////////////////////////////////////////////////////////////// // game moves /////////////////////////////////////////////////////////////////////////////// // make game move (dispatcher) Card *AiPlayer::moveSelectCard (Card *lMove, Card *rMove, Player *aLeftPlayer, Player *aRightPlayer, bool isPassOut) { Q_UNUSED(isPassOut) printf ("AiPlayer (%d) moves\n", mPlayerNo); Card *cur = 0; if (lMove == 0 && rMove == 0) { // мой заход - первый if (mMyGame == gtPass || mMyGame == whist) cur = MyWhist1(aLeftPlayer, aRightPlayer); // кто-то играет а я как бы вистую else if (mMyGame == g86catch) cur = MiserCatch1(aLeftPlayer, aRightPlayer); else if (mMyGame == g86) cur = Miser1(aLeftPlayer,aRightPlayer); else if (mMyGame == raspass) cur = MyPass1(rMove, aLeftPlayer, aRightPlayer); // ну типа распасы или мизер else cur = MyGame1(aLeftPlayer, aRightPlayer); // ну типа моя игра } if (lMove == 0 && rMove != 0) { // мой заход - второй if (mMyGame == gtPass || mMyGame == whist) cur = MyWhist2(rMove, aLeftPlayer, aRightPlayer); // кто-то играет а я как бы вистую else if (mMyGame == g86catch) cur = MiserCatch2(rMove, aLeftPlayer, aRightPlayer); else if (mMyGame == g86) cur = Miser2(rMove, aLeftPlayer, aRightPlayer); else if (mMyGame == raspass) cur = MyPass2(rMove, aLeftPlayer, aRightPlayer); // ну типа распасы или мизер else cur = MyGame2(rMove, aLeftPlayer, aRightPlayer); // ну типа моя игра } if (lMove != 0 && rMove != 0) { // мой заход - 3 if (mMyGame == gtPass || mMyGame == whist ) cur = MyWhist3(lMove, rMove, aLeftPlayer, aRightPlayer); // кто-то играет а я как бы вистую else if (mMyGame == g86catch) cur = MiserCatch3(lMove, rMove, aLeftPlayer, aRightPlayer); else if (mMyGame == g86) cur = Miser3(lMove, rMove, aLeftPlayer, aRightPlayer); else if (mMyGame == raspass) cur = MyPass3(lMove, rMove, aLeftPlayer, aRightPlayer); // ну типа распасы или мизер else cur = MyGame3(lMove, rMove, aLeftPlayer, aRightPlayer); // ну типа моя игра } mCards.remove(cur); mCardsOut.insert(cur); return cur; } /////////////////////////////////////////////////////////////////////////////// // Pass or Whist or Halfwhist eGameBid AiPlayer::moveFinalBid (eGameBid MaxGame, int HaveAWhist, int nGamerPass) { Q_UNUSED(nGamerPass) eGameBid Answer; eGameBid MyMaxGame = moveCalcDrop(); int vz = MyMaxGame/10; if (MaxGame == g86) { Answer = g86catch; // Misere goto myGame; } if (optStalingrad && MaxGame == g61) { Answer = whist; // Stalingrad goto myGame; } if (!opt10Whist && MaxGame>=101 && MaxGame<=105) { Answer = whist; goto myGame; } if (HaveAWhist == gtPass) Answer = (vz > gameWhistsMin(MaxGame)) ? whist : gtPass; else Answer = (vz > gameWhists(MaxGame)) ? whist : gtPass; //Answer = (HaveAWhist != whist && vz >= gameWhistsMin(MaxGame)) ? whist : gtPass ; //if (HaveAWhist == gtPass && vz < gameWhistsMin(MaxGame)) Answer = gtPass; myGame: if ((Answer == gtPass) && (nGamerPass == 1)) Answer = halfwhist; mMyGame = Answer; return Answer; } /////////////////////////////////////////////////////////////////////////////// // calc drop eGameBid AiPlayer::moveCalcDrop () { eGameBid GamesTypeRetVal; int f; int nMaxMastLen = 0; eSuit nMaxMast = SuitNone; tSuitProbs LocalMastTable[5]; LocalMastTable[0].tricks = 0; LocalMastTable[0].perehvatov = 0; LocalMastTable[0].sum = 0; for (f = 1; f <= 4; f++) { LocalMastTable[f] = countGameTricks((eSuit)f, 1); LocalMastTable[0].tricks += LocalMastTable[f].tricks; LocalMastTable[0].perehvatov +=LocalMastTable[f].perehvatov; LocalMastTable[0].sum += LocalMastTable[f].sum; } for (f = 1; f <= 4; f++) { // предполагаемый козырь - самая длинная масть if (mCards.cardsInSuit(f) > nMaxMastLen) { nMaxMastLen = mCards.cardsInSuit(f); nMaxMast = (eSuit)f; } } for (f = 1; f <= 4; f++) { if (mCards.cardsInSuit(f) == nMaxMastLen && nMaxMast != f) { // есть максимально длинные масти if (LocalMastTable[f].sum > LocalMastTable[nMaxMast].sum) nMaxMast = (eSuit)f; } } //масть и звятки уже посчитали GamesTypeRetVal = (eGameBid)(LocalMastTable[0].tricks*10+nMaxMast); // это то, что мы можем играть максимально return GamesTypeRetVal; } /////////////////////////////////////////////////////////////////////////////// // eGameBid AiPlayer::dropForMisere () { Card *FirstCardOut = 0, *SecondCardOut = 0; Card *tmpFirstCardOut, *tmpSecondCardOut; Card *RealFirstCardOut, *RealSecondCardOut; eGameBid Hight = g105, tmpHight = g105; for (int f = 0; f < 12; f++) { tmpFirstCardOut = mCards.at(f); mCards.removeAt(f); //for ( int j=0;j<12;j++ ) { for (int j = f+1; j < 12; j++) { // patch from Rasskazov K. (kostik450@mail.ru) if (j != f) { tmpSecondCardOut = mCards.at(j); mCards.removeAt(j); AiPlayer *tmpGamer = new AiPlayer(99); tmpGamer->mCards = mCards; tmpGamer->mCards.mySort(); tmpHight = tmpGamer->moveCalcDrop(); if ((tmpHight < Hight) || (tmpHight == Hight && tmpGamer->mSuitProb[0].perehvatov < mSuitProb[0].perehvatov)) { Hight = tmpHight; FirstCardOut = tmpFirstCardOut; SecondCardOut = tmpSecondCardOut; } delete tmpGamer; mCards.putAt(j, tmpSecondCardOut); } } mCards.putAt(f, tmpFirstCardOut); } RealFirstCardOut = mCards.maxInSuit(FirstCardOut->suit()); mCards.remove(RealFirstCardOut); mOut.insert(RealFirstCardOut); if (SecondCardOut->suit() != FirstCardOut->suit()) { RealSecondCardOut = mCards.maxInSuit(SecondCardOut->suit()); } else { RealSecondCardOut = mCards.greaterInSuit(FirstCardOut); if (!RealSecondCardOut) RealSecondCardOut = mCards.maxFace(); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 Bad algoritm } mCards.remove(RealSecondCardOut); mOut.insert(RealSecondCardOut); mCards.mySort(); return g86; } /////////////////////////////////////////////////////////////////////////////// // eGameBid AiPlayer::dropForGame () { Card *FirstCardOut = 0, *SecondCardOut = 0; Card *tmpFirstCardOut, *tmpSecondCardOut; Card *RealFirstCardOut, *RealSecondCardOut; eGameBid Hight = zerogame, tmpHight = zerogame; for (int f = 0; f < 12; f++) { tmpFirstCardOut = mCards.at(f); mCards.removeAt(f); for (int j = 0; j < 12; j++) { if (j != f) { tmpSecondCardOut = mCards.at(j); mCards.removeAt(j); AiPlayer *tmpGamer = new AiPlayer(99); tmpGamer->mCards = mCards; tmpGamer->mCards.mySort(); tmpHight = tmpGamer->moveCalcDrop(); if ((tmpHight > Hight) || (tmpHight == Hight && tmpGamer->mSuitProb[0].perehvatov < mSuitProb[0].perehvatov)) { Hight = tmpHight; FirstCardOut = tmpFirstCardOut; SecondCardOut = tmpSecondCardOut; } tmpGamer->mCards.clear(); delete tmpGamer; mCards.putAt(j, tmpSecondCardOut); } } mCards.putAt(f, tmpFirstCardOut); } RealFirstCardOut = mCards.minInSuit(FirstCardOut->suit()); mCards.remove(RealFirstCardOut); mOut.insert(RealFirstCardOut); if (SecondCardOut->suit() != FirstCardOut->suit()) { RealSecondCardOut = mCards.minInSuit(SecondCardOut->suit()); } else { RealSecondCardOut = mCards.greaterInSuit(FirstCardOut); if (!RealSecondCardOut) RealSecondCardOut = mCards.minFace(); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 Bad algoritm } mCards.remove(RealSecondCardOut); mOut.insert(RealSecondCardOut); mCards.mySort(); //Hight = moveBidding(undefined,undefined); Hight = moveCalcDrop(); if (Hight < mMyGame) { // Вот такая ерунда int tmpvz = Hight/10, tmpmast = Hight-tmpvz*10; while (tmpHight < mMyGame) { tmpvz++; tmpHight = (eGameBid)(tmpvz*10+tmpmast); } mMyGame = tmpHight; } else { mMyGame = Hight; } return mMyGame; } //ход при торговле eGameBid AiPlayer::moveBidding (eGameBid lMove, eGameBid rMove) { //mIStart = (lMove == undefined && rMove == undefined); //qDebug() << mPlayerNo << mIStart; /* if ( mMyGame == gtPass ) { mMyGame=gtPass; } else { */ //mMyGame = gtPass; if (mMyGame != gtPass) { int f; int nMaxMastLen = 0; eSuit nMaxMast = SuitNone; tSuitProbs LocalMastTable[5]; /* if (optAggPass && optPassCount > 0) { if (lMove == undefined) lMove = g71; if (rMove == undefined) rMove = g71; } */ eGameBid curMaxGame = qMax(lMove, rMove); if (optAggPass && optPassCount > 0) { if (curMaxGame < g71) curMaxGame = g65; if (lMove != gtPass && lMove != undefined && lMove < g65) lMove = g65; if (rMove != gtPass && rMove != undefined && rMove < g65) rMove = g65; } LocalMastTable[0].tricks=0; LocalMastTable[0].perehvatov=0; LocalMastTable[0].sum = 0; for (f = 1; f <= 4; f++) { LocalMastTable[f] = countGameTricks((eSuit)f, 1); LocalMastTable[0].tricks += LocalMastTable[f].tricks; LocalMastTable[0].perehvatov +=LocalMastTable[f].perehvatov; LocalMastTable[0].sum += LocalMastTable[f].sum; } // предполагаемый козырь -- самая длинная масть for (f = 1; f <= 4; f++) { if (mCards.cardsInSuit(f) > nMaxMastLen) { nMaxMastLen = mCards.cardsInSuit(f); nMaxMast = (eSuit)f; } } for (f = 1; f <= 4; f++) { if (mCards.cardsInSuit(f) == nMaxMastLen && nMaxMast != f) { // есть максимально длинные масти if (LocalMastTable[f].sum > LocalMastTable[nMaxMast].sum) nMaxMast = (eSuit)f; } } // масть и взятки уже посчитали if (curMaxGame <= g75) { mMyGame = (eGameBid)((LocalMastTable[0].tricks+1)*10+nMaxMast); } else { mMyGame = (eGameBid)((LocalMastTable[0].tricks)*10+nMaxMast); } // if first move or one player passed if ((rMove == gtPass || rMove == undefined) && (lMove == gtPass || lMove == undefined)) { if (LocalMastTable[0].tricks >= 4) { /*if (optAggPass && optPassCount > 0) mMyGame = g71; else*/ mMyGame = g61; } else { if (LocalMastTable[0].tricks == 0) { // check for misere !!! mMyGame = checkForMisere() ? g86 : gtPass ; } else mMyGame = gtPass; } } else if (mMyGame >= curMaxGame){ if ((mIStart) && (mMyGame < succBid(curMaxGame))) mMyGame = curMaxGame; else mMyGame = (eGameBid)succBid(curMaxGame); if (optAggPass && (optPassCount > 0) && (mMyGame < g71)) mMyGame = g71; } else mMyGame = gtPass; /* if( mMyGame >= curMaxGame ) { mMyGame = (eGameBid) succBid(curMaxGame); } else { }*/ // это то, что мы можем играть максимально /*if ( mMyGame > gtPass ) { if ( rMove < lMove ) { if ( lMove <= mMyGame ) { if ( lMove!=g61 ) mMyGame = lMove; // say here else mMyGame = (eGameBid) succBid(lMove); } else { mMyGame = gtPass; } } else { // rMove > lMove if ( mMyGame > rMove ) { // asm int 3; if (rMove!=undefined) { mMyGame = (eGameBid) succBid(rMove); } else { mMyGame = g61; } } else { mMyGame = gtPass; } } } else { // mMyGame > gtPass if ( (rMove==gtPass || rMove==undefined) && ( lMove==gtPass || lMove==undefined ) ) { if ( LocalMastTable[0].tricks >= 4 ) { mMyGame = g61; } else { if ( LocalMastTable[0].tricks == 0 ) { // check for miser !!! if (checkForMisere()) { mMyGame = g86; } else { mMyGame = gtPass; } } else { mMyGame = gtPass; } } } else { mMyGame = gtPass; } }*/ } //??? if (optAggPass && optPassCount > 0 && mMyGame != gtPass && mMyGame < g71) { moveBidding(g71, g71); // if (optAggPass && optPassCount > 0 && mMyGame != gtPass && mMyGame < g71) moveBidding(g72, g72); } return mMyGame; } //----------------------------------------------------------------------- /* void AiPlayer::makestatfill () { eHand lr = LeftHand; for (int m = 1; m <= 4; m++) { for (int c = FACE_ACE; c >= 7; c--) { if (!mCards.exists(c, m)) { if (lr == LeftHand) { mLeft.insert(newCard(c, m)); lr = RightHand; } else { mRight.insert(newCard(c, m)); lr = LeftHand; } } } } } */ //----------------------------------------------------------------------- /* void AiPlayer::makestatfill (int nCards, int maxmin) { int nCounter = 0; eHand lr = LeftHand; if (maxmin == 1) { for (int m = 1; m <= 4; m++) { for (int c = FACE_ACE; c >= 7; c--) { if (!mCards.exists(c, m) && !mOut.exists(c, m)) { if (lr == LeftHand) { mLeft.insert(newCard(c, m)); lr = RightHand; } else { mRight.insert(newCard(c, m)); lr = LeftHand; nCounter++; if (nCounter >= nCards) return; } } } } } else { for (int m = 1; m <= 4; m++) { for (int c = 7; c <= FACE_ACE; c++) { if (!mCards.exists(c, m) && !mOut.exists(c, m)) { if (lr == LeftHand) { mLeft.insert(newCard(c, m)); lr = RightHand; } else { mRight.insert(newCard(c, m)); lr = LeftHand; nCounter++; if (nCounter >= nCards) return; } } } } } } */ bool AiPlayer::chooseClosedWhist () { //tSuitProbs countGameTricks((eSuit)f, 1) if (qrand()%4 == 0) return true; else return false; } openpref-0.1.3/src/logic/aialphabeta.cpp0000755000175000017500000005466011265177055017611 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include #include #include "prfconst.h" #include "formbid.h" #include "kpref.h" #include "debug.h" #include "deskview.h" #include "player.h" #include "card.h" #include "cardlist.h" #include "ncounter.h" #include "plscore.h" #include "aialphabeta.h" // 1-33; 0: unused /* #define SUIT(c) (((c)-1)%4) #define FACE(c) ((((c)-1)/4)+7) #define CARD(face,suit) (((face-7)*4+(suit))+1) */ typedef unsigned char card_t; static inline card_t CARD (int face, int suit) { if (face < 7 || face > 14 || suit < 0 || suit > 3) abort(); return ((face-7)*4+suit)+1; } static inline int SUIT (int c) { return (c-1)%4; } static inline int FACE (int c) { return ((c-1)/4)+7; } static inline int compareCards (int c0, int c1) { int t0 = SUIT(c0), t1 = SUIT(c1); int r = t1-t0; if (!r) { t0 = FACE(c0), t1 = FACE(c1); r = t0-t1; } return r; } void xsortCards (card_t *arr, int len) { int f, c; for (f = 0; f < len; f++) { for (c = len-1; c > f; c--) { int cc = compareCards(arr[c], arr[f]); if (cc > 0) { int t = arr[c]; arr[c] = arr[f]; arr[f] = t; } } } } static int gTrumpSuit; // trump; global var static int gPassOutSuit; // нужная масть для первого или второго круга распасов //static int gGameBid; // >=6 //static int gMoves[4][10]; //static int gTricks[3]; //static int gE0, gE1, gMe; //static int gWhoPlays; static int gIterations; //static int gTrk = 0; static bool gPassOut; typedef struct { int faces[10]; int suits[10]; int suitCount[4]; // # of cards in each suit int suitStart[4]; // 1st card of each suit int tricks; } tHand; //static long long xStTime, cTime; static tHand xHands[3]; static int xCardsLeft; static int xDeskFaces[3], xDeskSuits[3]; //static int lastMoveF, lastMoveS; static QTime stTime; //#define ABDEBUG //#define ADVANCED_RES /* * карты должны быть отсортированы по мастям в порядке убывания "морды" * a: игрок player набрал максимум вот столько * b: игрок player+1 набрал максимум вот столько * c: игрок player+2 набрал максимум вот столько * возврат: то же самое * * идея и псевдокод взяты отсюда: http://clauchau.free.fr/gamma.html * idea and pseudocode was taken from here: http://clauchau.free.fr/gamma.html */ static void abcPrune ( int turn, int player, int a, int b, int c, int *ra, int *rb, int *rc, int *rm ) { /* * (x, y, z) := some static additive evaluation of Position, * x measuring how good is Position for the Player to move, * y measuring how good is Position for the next Player, * z measuring how good is Position for the further next Player, * the higher the better, -infinite for a defeat, +infinite for a win; * * if the game is over then return (x, y, z, "game over"); * else return ( min(x-y, x-z), min(y-x, y-z), min(z-x, z-y), "static" ); */ /* if (!xCardsLeft) { gIterations++; if (gIterations%8000000 == 0) { cTime = getTimeMs(); fprintf(stderr, "\r%i (%i seconds)\x1b[K", gIterations, (int)((cTime-xStTime)/1000)); } *ra = xHands[player].tricks; *rb = xHands[(player+1)%3].tricks; *rc = xHands[(player+2)%3].tricks; return; } */ //int lmF = lastMoveF, lmS = lastMoveS; #ifdef ABDEBUG printf("cards left: %i; turn: %i\n", xCardsLeft, turn); printStatus(turn, player, 0); #endif tHand *hand = &(xHands[player]); //int bestx = a, worsty = b, worstz = c; int bestx = -666, worsty = 666, worstz = 666; int bestm = -1; int n = 0; // will count equivalent moves int crdFace, crdSuit, tmp, who = -1; int newTurn = turn+1, newPlayer = (player+1)%3; int sDeskFaces[3], sDeskSuits[3]; sDeskFaces[0] = xDeskFaces[0]; sDeskFaces[1] = xDeskFaces[1]; sDeskFaces[2] = xDeskFaces[2]; sDeskSuits[0] = xDeskSuits[0]; sDeskSuits[1] = xDeskSuits[1]; sDeskSuits[2] = xDeskSuits[2]; if (turn == 2) { newTurn = 0; --xCardsLeft; } int crdNo = 0, crdNext, ccc = 0; for (int f = 0; f < 10; f++) if (hand->faces[f]) ccc++; if (!ccc) { abort(); } //int movesChecked = 0, firstm = -1; while (crdNo < 10) { crdFace = hand->faces[crdNo]; if (!hand->faces[crdNo]) { crdNo++; continue; } crdNext = crdNo+1; crdSuit = hand->suits[crdNo]; if (!turn) { // первый ход может быть любой ваще, если это не первый и не второй круг распасов if (gPassOutSuit >= 0 && crdSuit != gPassOutSuit && hand->suitCount[gPassOutSuit]) { // не, это очень херовая масть, начнём с верной масти tmp = hand->suitStart[gPassOutSuit]; if (tmp == crdNo) abort(); // а такого не бывает if (tmp < crdNo) break; // ну нет у нас такой, и уже всё, что было, проверили // скипаем и повторяем выборы crdNo = tmp; continue; } goto doMove; } // check for valid move // выход в правильную масть? if (crdSuit == xDeskSuits[0]) goto doMove; // не, не та масть; ну-ка, чо у нас на руках ваще? // нужная масть у нас есть? if (hand->suitCount[xDeskSuits[0]]) { // таки есть, потому это очень хуёвый вариант; ходим сразу с нужной масти tmp = hand->suitStart[xDeskSuits[0]]; if (tmp < crdNo) break; // всё, нечего больше искать if (tmp > crdNo) { // скипаем crdNo = tmp; continue; } // вот этой и ходим goto doMove; } // не, нужной масти нет // а козырь есть? if (gTrumpSuit <= 3) { // игра козырная, есть козыри? if (hand->suitCount[gTrumpSuit]) { // таки есть tmp = hand->suitStart[gTrumpSuit]; if (tmp < crdNo) break; // всё, нечего больше искать if (tmp > crdNo) { // скипаем crdNo = tmp; continue; } // вот этой и ходим goto doMove; } else { // не, и козырей нет, можно кидать чо попало goto doMove; } } else { // игра бескозырная, тут любая карта пойдёт, хули goto doMove; } doMove: /* movesChecked++; if (firstm < 0) firstm = crdNo; */ // проскипаем последовательность из плавно убывающих карт одной масти // очевидно, что при таком раскладе похуй, какой из них ходить int scnt = hand->suitCount[crdSuit]; if (scnt > 1) { // в этой масти есть ещё карты // проверим, есть ли у кого ещё эта масть if (xHands[0].suitCount[crdSuit]+xHands[1].suitCount[crdSuit]+xHands[2].suitCount[crdSuit] <= scnt) { // единственный гордый владелец этой масти; пробуем только одну её карту int tsuit = crdSuit+1; while (tsuit <= 3 && hand->suitCount[tsuit] == 0) tsuit++; crdNext = tsuit>3 ? 11 : hand->suitStart[tsuit]; } else { // такая масть есть ещё у кого-то int tface = crdFace+1; while (crdNext <= 10 && hand->suits[crdNext] == crdSuit && hand->faces[crdNext] == tface) { crdNext++; tface++; } } } // кидаем карту на стол xDeskSuits[turn] = crdSuit; xDeskFaces[turn] = crdFace; // убираем карту из руки hand->suitCount[crdSuit]--; if (crdNo == hand->suitStart[crdSuit]) hand->suitStart[crdSuit]++; hand->faces[crdNo] = 0; //lastMoveF = crdFace; lastMoveS = crdSuit; int y, z, x; if (turn == 2) { // the turn is done, count tricks //who = whoTakes(pdesk, gTrumpSuit); // а кто, собственно, забрал? if (gTrumpSuit <= 3) { // trump game if (xDeskSuits[0] == gTrumpSuit) { // нулевой козырнул who = 0; tmp = xDeskFaces[0]; if (xDeskSuits[1] == xDeskSuits[0] && xDeskFaces[1] > tmp) { tmp = xDeskFaces[1]; who = 1; } if (xDeskSuits[2] == xDeskSuits[0] && xDeskFaces[2] > tmp) who = 2; } else if (xDeskSuits[1] == gTrumpSuit) { // первый козырнул who = 1; tmp = xDeskFaces[0]; if (xDeskSuits[2] == xDeskSuits[1] && xDeskFaces[2] > tmp) who = 2; } else if (xDeskSuits[2] == gTrumpSuit) { // второй козырнул who = 2; } else { // никто не козырял who = 0; tmp = xDeskFaces[0]; if (xDeskSuits[1] == xDeskSuits[0] && xDeskFaces[1] > tmp) { tmp = xDeskFaces[1]; who = 1; } if (xDeskSuits[2] == xDeskSuits[0] && xDeskFaces[2] > tmp) who = 2; } } else { // notrump game who = 0; tmp = xDeskFaces[0]; if (xDeskSuits[1] == xDeskSuits[0] && xDeskFaces[1] > tmp) { tmp = xDeskFaces[1]; who = 1; } if (xDeskSuits[2] == xDeskSuits[0] && xDeskFaces[2] > tmp) who = 2; } who = (who+player+1)%3; xHands[who].tricks++; // прибавили взятку #ifdef ABDEBUG printf("==%i takes; cards left: %i; turn: %i\n", who, xCardsLeft, turn); printStatus(turn, player, 1); #endif if (xCardsLeft < 0) abort(); if (!xCardsLeft) { // всё, отбомбились, даёшь коэффициенты gIterations++; if (gIterations%1000000 == 0) { if (stTime.elapsed() >= 5000) { stTime.start(); //cTime = getTimeMs(); //fprintf(stderr, "\r%i (%i seconds)\x1b[K", gIterations, (int)((cTime-xStTime)/1000)); fprintf(stderr, "\r%i\x1b[K", gIterations); } } /* y = xHands[newPlayer].tricks; z = xHands[(newPlayer+1)%3].tricks; x = xHands[(newPlayer+2)%3].tricks; */ x = xHands[player].tricks; y = xHands[newPlayer].tricks; z = xHands[(player+2)%3].tricks; if (gPassOut) { x = 10-x; y = 10-y; z = 10-z; } #ifdef ADVANCED_RES if (player == gWhoPlays) { // я играю; выиграл ли? if (x < gGameBid) { // нет, обезлаплен x = -gGameBid-1; /*y = z = 666;*/ } else { // да, взял своё x = 20+gGameBid; /* switch (gGameBid) { case 6: if (y < 2) y = -666+y; // bad if (z < 2) z = -666+z; // bad break; case 7: case 8: case 9: if (y < 1) y = -666+y; // bad if (z < 1) z = -666+z; // bad break; } */ } } else { // я вистую; получилось ли? if (xHands[gWhoPlays].tricks < gGameBid) { // по любому засадили чувачка //x = 666-(gGameBid-xHands[gWhoPlays].tricks); // на сколько // чувак в жопе if (gWhoPlays == newPlayer) { //y = -xHands[gWhoPlays].tricks-1; //z = 666; } else { //z = -xHands[gWhoPlays].tricks-1; //y = 666; } } else { // нет, чувак, увы, взял своё; а я? /* switch (gGameBid) { case 6: if (x < 2) x = -15-x; else x = 15+x; break; case 7: case 8: case 9: if (x < 1) x = -15-x; else x = 15+x; break; } if (gWhoPlays == newPlayer) { y = 666; switch (gGameBid) { case 6: if (z < 2) z = -15-z; else z = 15+z; break; case 7: case 8: case 9: if (z < 1) z = -15-z; else z = 15+z; break; } } else { z = 666; switch (gGameBid) { case 6: if (y < 2) y = -15-y; else y = 15+y; break; case 7: case 8: case 9: if (y < 1) y = -15-y; else y = 15+y; break; } } */ } } #endif //printStatus(2, player, 0); } else { // рекурсивно проверяем дальше //abcPrune(newTurn, newPlayer, -c, -a, b, &y, &z, &x, NULL); if (who == player) { // я же и забрал, снова здорово abcPrune(0, player, a, b, c, &x, &y, &z, NULL); } else if (who == newPlayer) { // следующий забрал; красота и благолепие abcPrune(0, newPlayer, -c, -a, b, &y, &z, &x, NULL); } else { // предыдущий забрал; вот такие вот параметры вышли; путём трэйсинга, да abcPrune(0, who, -b, c, -a, &z, &x, &y, NULL); } } // брали взятку? восстановим статус кво xHands[who].tricks--; } else { // рекурсивно проверяем дальше abcPrune(newTurn, newPlayer, -c, -a, b, &y, &z, &x, NULL); } // восстановим стол xDeskFaces[0] = sDeskFaces[0]; xDeskFaces[1] = sDeskFaces[1]; xDeskFaces[2] = sDeskFaces[2]; xDeskSuits[0] = sDeskSuits[0]; xDeskSuits[1] = sDeskSuits[1]; xDeskSuits[2] = sDeskSuits[2]; // вернём в руку карту hand->suitCount[crdSuit]++; hand->faces[crdNo] = crdFace; if (crdNo+1 == hand->suitStart[crdSuit]) hand->suitStart[crdSuit]--; // проверим, чо нашли if (bestm >= 0 && x == bestx) { // we've found an equivalent move //if (bestm < 0) abort(); n++; if (y < worsty) worsty = y; if (z < worstz) worstz = z; //if (myrand()%n == n-1) bestm = crdNo; // hands are sorted, so take the smallest possible card if (bestm < 0 || crdFace < hand->faces[bestm]) bestm = crdNo; } else if (x > bestx) { // we've found a better move n = 1; bestm = crdNo; bestx = x; worsty = y; worstz = z; if (x > b || x > c) break; // всё, дальше искать не надо, всё равно мы крутые; goto done; if (x > a) a = x; } // берём следующую карту crdNo = crdNext; } xDeskFaces[0] = sDeskFaces[0]; xDeskFaces[1] = sDeskFaces[1]; xDeskFaces[2] = sDeskFaces[2]; xDeskSuits[0] = sDeskSuits[0]; xDeskSuits[1] = sDeskSuits[1]; xDeskSuits[2] = sDeskSuits[2]; if (turn == 2) { xCardsLeft++; } *ra = bestx; *rb = worsty; *rc = worstz; if (rm) *rm = bestm; /* if (rm) *rm = bestm>=0?bestm:firstm; if (bestm < 0) { fprintf(stderr, "first: %i (%i)\n", firstm, movesChecked); } */ //lastMoveF = lmF; lastMoveS = lmS; } //static card_t hands[3][10]; static const char *cFaceS[8] = {" 7"," 8"," 9","10"," J"," Q"," K"," A"}; static const char *cSuitS[4] = {"s","c","d","h"}; static void printHand (tHand *hand) { int z; for (z = 0; z < 10; z++) { if (hand->faces[z]) { printf(" %s%s(%2i)", cFaceS[hand->faces[z]-7], cSuitS[hand->suits[z]], CARD(hand->faces[z], hand->suits[z])); } else { printf(" ..."); } } printf(" 0:(%i,%i); 1:(%i,%i); 2:(%i,%i); 3:(%i,%i)", hand->suitCount[0], hand->suitStart[0], hand->suitCount[1], hand->suitStart[1], hand->suitCount[2], hand->suitStart[2], hand->suitCount[3], hand->suitStart[3]); printf("\n"); } static void printDesk (int cnt) { printf("desk:"); for (int z = 0; z < cnt; z++) { printf(" %s%s(%2i)", cFaceS[xDeskFaces[z]-7], cSuitS[xDeskSuits[z]], CARD(xDeskFaces[z], xDeskSuits[z])); } printf("\n"); } /* * aLeftPlayer: next in turn * aRightPlayer: prev in turn * 0, 1th * 1th, 2nd */ Card *CheatPlayer::moveSelectCard (Card *lMove, Card *rMove, Player *aLeftPlayer, Player *aRightPlayer, bool isPassOut) { printf ("CheatPlayer (%d) moves\n", mPlayerNo); card_t hands[3][10]; card_t desk[3]; int crdLeft = 0; int trumpSuit = 0; Player *movePlrObj = 0, *plst[3]; //again: plst[0] = plst[1] = plst[2] = 0; plst[mPlayerNo-1] = this; plst[aLeftPlayer->number()-1] = aLeftPlayer; plst[aRightPlayer->number()-1] = aRightPlayer; // build hands for (int c = 0; c < 3; c++) { if (!plst[c]) abort(); CardList *clst = &(plst[c]->mCards); //for (int f = 0; f < 10; f++) hds[c][f] = hands[c][f] = 0; int pos = 0; for (int f = 0; f < clst->size(); f++) { Card *ct = clst->at(f); if (!ct) continue; hands[c][pos++] = CARD(ct->face(), ct->suit()-1); if (pos > crdLeft) crdLeft = pos; } for (int f = pos; f < 10; f++) hands[c][f] = 0; xsortCards(hands[c], pos); } if (!lMove && !rMove && crdLeft == 10) { return AiPlayer::moveSelectCard(lMove, rMove, aLeftPlayer, aRightPlayer, isPassOut); } // find game eGameBid bid; if (mMyGame == gtPass || mMyGame == whist) { bid = aLeftPlayer->myGame(); if (bid == gtPass || bid == whist) { bid = aRightPlayer->myGame(); movePlrObj = aRightPlayer; } else movePlrObj = aLeftPlayer; } else { bid = mMyGame; movePlrObj = this; } gPassOut = (bid == g86 || bid == g86catch || bid == raspass); trumpSuit = bid%10-1;//(bid-(bid/10)*10)-1; /* if (bid == g86catch || bid == g86 || bid == raspass) { return Player::moveSelectCard(lMove, rMove, aLeftPlayer, aRightPlayer); } */ if (bid == g86catch || bid == g86 || bid == raspass) { trumpSuit = 4; } if (trumpSuit < 0) trumpSuit = 4; fprintf(stderr, "po:%s; lm:%s, rm:%s\n", isPassOut?"y":"n", lMove?"y":"n", rMove?"y":"n"); if (isPassOut && rMove && !lMove) { // это распасы, первый или второй круг, первый ход gPassOutSuit = rMove->suit()-1; fprintf(stderr, "pass-out: %i\n", gPassOutSuit); rMove = 0; } else gPassOutSuit = -1; // build desk int turn = 0; if (lMove) { desk[turn++] = CARD(lMove->face(), lMove->suit()-1); if (rMove) desk[turn++] = CARD(rMove->face(), rMove->suit()-1); } else if (rMove) { desk[turn++] = CARD(rMove->face(), rMove->suit()-1); } // build hands for (int f = 0; f < 3; f++) { xHands[f].suitCount[0] = xHands[f].suitCount[1] = xHands[f].suitCount[2] = xHands[f].suitCount[3] = 0; xHands[f].suitStart[0] = xHands[f].suitStart[1] = xHands[f].suitStart[2] = xHands[f].suitStart[3] = 11; xHands[f].tricks = plst[f]->tricksTaken(); int st; for (int z = 0; z < 10; z++) { if (hands[f][z]) { xHands[f].faces[z] = FACE(hands[f][z]); st = xHands[f].suits[z] = SUIT(hands[f][z]); if (xHands[f].suitCount[st]++ == 0) xHands[f].suitStart[st] = z; } else xHands[f].faces[z] = 0; } } // build desk for (int f = 0; f < turn; f++) { xDeskFaces[f] = FACE(desk[f]); xDeskSuits[f] = SUIT(desk[f]); } int a, b, c, move; int me = this->number()-1; xCardsLeft = crdLeft; gTrumpSuit = trumpSuit; gIterations = 0; printf("%shand 0:", this->number()==0?"*":" "); printHand(&(xHands[0])); printf("%shand 1:", this->number()==1?"*":" "); printHand(&(xHands[1])); printf("%shand 2:", this->number()==2?"*":" "); printHand(&(xHands[2])); printDesk(turn); // оптимизации /* if (turn > 0) { // можем вообще взять? if (hands[me].suitCount( } */ stTime = QTime::currentTime(); stTime.start(); abcPrune(turn, me, -666, 666, 666, &a, &b, &c, &move); qDebug() << "face:" << FACE(hands[me][move]) << "suit:" << SUIT(hands[me][move])+1 << "move:" << move << "turn:" << turn << "moves:" << crdLeft << "trump:" << trumpSuit << "iters:" << gIterations << ""; /* for (int h = 0; h < 3; h++) { fprintf(stderr, (h == me)?"*":" "); fprintf(stderr, "hand %i:", h); for (int f = 0; f < 10; f++) { if (hands[h][f]) { fprintf(stderr, " %2i.%i(%3i)", FACE(hands[h][f]), SUIT(hands[h][f]), hands[h][f]); } else { fprintf(stderr, " %2i.%i(%3i)", 0, 0, hands[h][f]); } } fprintf(stderr, "\n"); } fprintf(stderr, "desk:"); for (int f = 0; f < turn; f++) { fprintf(stderr, " %2i.%i(%3i)", FACE(desk[f]), SUIT(desk[f]), desk[f]); } fprintf(stderr, "\n"); */ if (move < 0) { fprintf(stderr, "fuck!\n"); //goto again; abort(); } Card *moveCard = newCard(FACE(hands[me][move]), SUIT(hands[me][move])+1); qDebug() << "move:" << moveCard->toString(); mCards.remove(moveCard); mCardsOut.insert(moveCard); return moveCard; } /////////////////////////////////////////////////////////////////////////////// CheatPlayer::CheatPlayer (int aMyNumber, DeskView *aDeskView) : AiPlayer(aMyNumber, aDeskView) { mInvisibleHand = false; } /* CheatPlayer &CheatPlayer::operator = (const Player &pl) { Player::clone(&pl); mInvisibleHand = false; return *this; } CheatPlayer &CheatPlayer::operator = (const CheatPlayer &pl) { Player::clone(&pl); if (allowDebugLog) mInvisibleHand = false; return *this; } */ openpref-0.1.3/src/logic/logic.pri0000755000175000017500000000035511265177055016453 0ustar kostyakostyaDEPENDPATH += $$PWD INCLUDEPATH += $$PWD HEADERS += \ $$PWD/player.h \ $$PWD/aiplayer.h \ $$PWD/human.h \ $$PWD/aialphabeta.h SOURCES += \ $$PWD/player.cpp \ $$PWD/human.cpp \ $$PWD/aiplayer.cpp \ $$PWD/aialphabeta.cpp openpref-0.1.3/src/logic/logic.cmake0000644000175000017500000000041311265177055016731 0ustar kostyakostyaproject(openpref) SET ( HEADERS ${HEADERS} src/logic/player.h src/logic/aiplayer.h src/logic/human.h src/logic/aialphabeta.h ) SET ( SOURCES ${SOURCES} src/logic/player.cpp src/logic/human.cpp src/logic/aiplayer.cpp src/logic/aialphabeta.cpp )openpref-0.1.3/src/logic/human.cpp0000755000175000017500000001604511265177055016461 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include #include "prfconst.h" #include "formbid.h" #include "kpref.h" #include "deskview.h" #include "player.h" #include "card.h" #include "cardlist.h" #include "ncounter.h" #include "plscore.h" #include "human.h" HumanPlayer::HumanPlayer (int aMyNumber, DeskView *aDeskView) : Player(aMyNumber, aDeskView) { internalInit(); } HumanPlayer &HumanPlayer::operator = (const Player &pl) { Player::clone(&pl); return *this; } HumanPlayer &HumanPlayer::operator = (const HumanPlayer &pl) { Player::clone(&pl); return *this; } void HumanPlayer::clear () { Player::clear(); mInvisibleHand = false; } // eGameBid HumanPlayer::dropForMisere () { mClickX = mClickY = 0; mWaitingForClick = true; moveSelectCard(0, 0, 0, 0); //mDeskView->mySleep(1); moveSelectCard(0, 0, 0, 0); mWaitingForClick = false; return g86; } // eGameBid HumanPlayer::dropForGame () { //mWaitingForClick = 1; //mClickX = mClickY = 0; eGameBid tmpGamesType; moveSelectCard(0, 0, 0, 0); //!.!mDeskView->mySleep(1); moveSelectCard(0, 0, 0, 0); formBid->enableAll(); formBid->disableItem(whist); //formBid->disableItem(halfwhist); formBid->bhalfvist->setEnabled(false); formBid->disableItem(gtPass); if (mMyGame != g86) formBid->disableItem(g86); formBid->disableLessThan(mMyGame); formBid->showbullet->setEnabled(true); if (optWithoutThree) formBid->bwithoutthree->setEnabled(true); do { tmpGamesType = mDeskView->selectBid(zerogame, zerogame); if (tmpGamesType == 0) { // clearCardArea(); returnDrop(); moveSelectCard(0, 0, 0, 0); //mDeskView->mySleep(1); moveSelectCard(0, 0, 0, 0); } else if (tmpGamesType == 1) { // kpref->slotShowScore(); } } while (tmpGamesType <= 1); if ( tmpGamesType != withoutThree) mMyGame = tmpGamesType; formBid->enableAll(); mWaitingForClick = false; return tmpGamesType; } // eGameBid HumanPlayer::moveBidding (eGameBid lMove, eGameBid rMove) { eGameBid tmpGamesType; mClickX = mClickY = 0; mWaitingForClick = true; //fprintf(stderr, "select bid\n"); formBid->enableAll(); /*if (optAggPass && optPassCount > 0) { if (lMove == undefined) lMove = g71; if (rMove == undefined) rMove = g71; }*/ if (optAggPass && optPassCount > 0) formBid->disableLessThan(g71); if (qMax(lMove, rMove) != gtPass) { // If HumanPlayer started bid, he can stay //mIStart = (lMove == undefined && rMove == undefined); if (mIStart) formBid->disableLessThan(qMax(lMove, rMove)); // otherwise he must increase else formBid->disableLessThan(qMax((eGameBid)succBid(lMove), (eGameBid)succBid(rMove))); } if (mMyGame != undefined) formBid->disableItem(g86); formBid->enableItem(gtPass); formBid->disableItem(whist); //formBid->disableItem(halfwhist); formBid->bhalfvist->setEnabled(false); formBid->showbullet->setEnabled(true); formBid->bwithoutthree->setEnabled(false); do { tmpGamesType = mDeskView->selectBid(lMove, rMove); if (tmpGamesType == 0) { // ( ) clearCardArea(); returnDrop(); moveSelectCard(0, 0, 0, 0); //mDeskView->mySleep(1); moveSelectCard(0, 0, 0, 0); } else if (tmpGamesType == 1) { // show pool kpref->mDesktop->mShowPool = true; kpref->slotShowScore(); } } while (tmpGamesType <= 1); mMyGame = tmpGamesType; mWaitingForClick = false; formBid->enableAll(); return mMyGame; } //move Card *HumanPlayer::moveSelectCard (Card *lMove, Card *rMove, Player *aLeftPlayer, Player *aRightPlayer, bool isPassOut) { Q_UNUSED(aLeftPlayer) Q_UNUSED(aRightPlayer) Q_UNUSED(isPassOut) printf ("HumanPlayer (%d) moves\n", mPlayerNo); Card *res = 0; mClickX = mClickY = 0; mWaitingForClick = true; kpref->HintMove(); draw(); while (!res) { if (mDeskView) mDeskView->mySleep(-2); int cNo = cardAt(mClickX, mClickY, !invisibleHand()); if (cNo == -1) { mClickX = mClickY = 0; //draw(); continue; } //qDebug() << "selected:" << cNo << "mClickX:" << mClickX << "mClickY:" << mClickY; Card *Validator; int koz = trumpSuit(); Validator = res = mCards.at(cNo); if (lMove || rMove) { Validator = lMove ? lMove : rMove; } if (!Validator || !res) continue; // check if move accords with rules if (!((Validator->suit() == res->suit()) || (!mCards.minInSuit(Validator->suit()) && (res->suit() == koz || ((!mCards.minInSuit(koz))))) )) { kpref->MoveImpossible(); res = 0; } } clearCardArea(); mPrevHiCardIdx = -1; mCards.remove(res); mCardsOut.insert(res); mClickX = mClickY = 0; mWaitingForClick = false; kpref->HintBar->clearMessage(); draw(); return res; } eGameBid HumanPlayer::moveFinalBid (eGameBid MaxGame, int HaveAVist, int nGamerPass) { Q_UNUSED(HaveAVist) //Q_UNUSED(nGamerVist) //fprintf(stderr, "whist/pass\n"); if (MaxGame == g86) { mMyGame = g86catch; } else if (!opt10Whist && MaxGame>=101 && MaxGame<=105) { mMyGame = whist; } else { // Stalingrad? formBid->disableAll(); if (optStalingrad && MaxGame == g61) formBid->disableItem(gtPass); else formBid->enableItem(gtPass); //formBid->enableItem(gtPass); formBid->enableItem(whist); if (nGamerPass == 1) formBid->bhalfvist->setEnabled(true); mMyGame = mDeskView->selectBid(zerogame, zerogame); formBid->enableAll(); } return mMyGame; } void HumanPlayer::hilightCard (int lx, int ly) { //qDebug() << "lx:" << lx << "ly:" << ly; if (!mWaitingForClick) { // not in "card selection" mode if (mPrevHiCardIdx == -1) return; // nothing selected --> nothing to redraw mPrevHiCardIdx = -1; } else { int cNo = cardAt(lx, ly, !invisibleHand()); if (cNo == mPrevHiCardIdx) return; // same selected --> nothing to redraw //qDebug() << "mPrevHiCardIdx:" << mPrevHiCardIdx << "cNo:" << cNo; mPrevHiCardIdx = cNo; } draw(); kpref->HintBar->clearMessage(); } bool HumanPlayer::chooseClosedWhist () { return kpref->WhistType(); } openpref-0.1.3/src/logic/aiplayer.h0000755000175000017500000001020111265177055016610 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef AIPLAYER_H #define AIPLAYER_H #include "prfconst.h" #include "card.h" #include "cardlist.h" #include "ncounter.h" #include "player.h" #include "plscore.h" #include "deskview.h" class AiPlayer : public Player { public: AiPlayer (int aMyNumber, DeskView *aDeskView=0); public: virtual Card *moveSelectCard (Card *lMove, Card *rMove, Player *aLeftPlayer, Player *aRightPlayer, bool isPassOut); // virtual eGameBid moveBidding (eGameBid lMove, eGameBid rMove); // virtual eGameBid moveFinalBid (eGameBid MaxGame, int HaveAWhist, int nGamerWhist); // - virtual eGameBid dropForGame (); virtual eGameBid dropForMisere (); virtual bool chooseClosedWhist (); virtual void clear (); protected: bool checkForMisere (); eGameBid moveCalcDrop (); // tSuitProbs countGameTricks (eSuit, int a23); tSuitProbs countTricks (eSuit, CardList &, int a23); tSuitProbs countPassTricks (eSuit, CardList &); // tSuitProbs calcProbsForMax (CardList &my, CardList &enemy); // 1 tSuitProbs calcProbsForMaxH23 (CardList &my, CardList &enemy); // 2 3 tSuitProbs calcProbsForMin (CardList &my, CardList &enemy); // void recalcTables (CardList &aMaxCardList, int a23); // tSuitProbs mSuitProb[5]; void recalcPassOutTables (CardList &aMaxCardList, int a23); // void loadLists (Player *aLeftPlayer, Player *aRightPlayer, CardList &aMaxCardList); // Card *GetMaxCardPere (); Card *GetMaxCardWithOutPere (); Card *GetMinCardWithOutVz (); Card *Miser1 (Player *aLeftPlayer, Player *aRightPlayer); Card *Miser2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); Card *Miser3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); Card *MyGame1 (Player *aLeftPlayer, Player *aRightPlayer); // 1 - Card *MyGame2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); // 2 - Card *MyGame3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); // 3 - Card *MyWhist1 (Player *aLeftPlayer, Player *aRightPlayer); // 1 - Card *MyWhist2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); // 2 - Card *MyWhist3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); // 3 - // !!! Card *MyPass1 (Card *, Player *aLeftPlayer, Player *aRightPlayer); Card *MyPass2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); // 2 - Card *MyPass3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); // 3 - Card *MiserCatch1 (Player *aLeftPlayer, Player *aRightPlayer); Card *MiserCatch2 (Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); Card *MiserCatch3 (Card *aLeftCard, Card *aRightCard, Player *aLeftPlayer, Player *aRightPlayer); protected: tSuitProbs mSuitProb[5]; }; #endif openpref-0.1.3/src/logic/aialphabeta.h0000755000175000017500000000255711265177055017254 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef AIALPHABETA_H #define AIALPHABETA_H #include "aiplayer.h" #include "prfconst.h" #include "card.h" #include "cardlist.h" #include "ncounter.h" #include "plscore.h" #include "deskview.h" #include "player.h" class CheatPlayer : public AiPlayer { public: CheatPlayer (int aMyNumber, DeskView *aDeskView=0); Card *moveSelectCard (Card *lMove, Card *rMove, Player *aLeftPlayer, Player *aRightPlayer, bool isPassOut); // }; #endif openpref-0.1.3/src/logic/player.h0000755000175000017500000000722411265177055016311 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef PLAYER_H #define PLAYER_H #include "prfconst.h" #include "card.h" #include "cardlist.h" #include "ncounter.h" #include "plscore.h" #include "deskview.h" class Player { public: Player (int aMyNumber, DeskView *aDeskView=0); Player (const Player &pl); virtual ~Player (); Player &operator = (const Player &pl); virtual void clear (); virtual bool invisibleHand () const; virtual void setInvisibleHand (bool invis); virtual void setCurrentStart (bool start); virtual void sortCards (); virtual void dealCard (Card *aCard); // get dealed card virtual Card *moveSelectCard (Card *lMove, Card *rMove, Player *aLeftPlayer, Player *aRightPlayer, bool isPassOut) = 0; //move virtual eGameBid moveBidding (eGameBid lMove, eGameBid rMove) = 0; // virtual eGameBid moveFinalBid (eGameBid MaxGame, int HaveAWhist, int nGamerWhist) = 0; // -- virtual eGameBid dropForGame () = 0; // virtual eGameBid dropForMisere () = 0; // virtual void returnDrop (); // virtual bool chooseClosedWhist () = 0; virtual void getLeftTop (int *left, int *top); virtual void draw (); virtual void hilightCard (int lx, int ly); // ( , ) inline void setMessage (const QString &msg) { mMessage = msg; } inline const QString &message () const { return mMessage; } inline int number () const { return mPlayerNo; } inline eGameBid myGame () const { return mMyGame; } inline void setMyGame (eGameBid game) { mMyGame = game; } inline int tricksTaken () const { return mTricksTaken; } virtual void gotTrick (); virtual void gotPassPassTricks (int cnt); protected: virtual void internalInit (); virtual void clone (const Player *pl); virtual void drawAt (DeskView *aDeskView, int left, int top, int selNo=-1); virtual void clearCardArea (); // at least 28 ints (14 int pairs); return # of used ints; the last int is -1 // result: ofs, cardNo, ..., -1 virtual int buildHandXOfs (int *dest, int startX, bool opened); virtual int cardAt (int lx, int ly, bool opened=true); public: DeskView *mDeskView; ScoreBoard mScore; CardList mCards; // my cards CardList mLeft; // cards of left player (supposed or open) CardList mRight; // cards of right player (supposed or open) CardList mOut; // dropped cards (my or supposed) CardList mCardsOut; // // this part for miser catches Card *mCardCarryThru; int mClickX, mClickY; bool mWaitingForClick; protected: QString mNick; QString mMessage; int mPlayerNo; // my number bool mInvisibleHand; eGameBid mMyGame; int mTricksTaken; int mPrevHiCardIdx; bool mIStart; }; #endif openpref-0.1.3/src/logic/human.h0000755000175000017500000000354611265177055016130 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef HUMAN_H #define HUMAN_H #include "prfconst.h" #include "card.h" #include "cardlist.h" #include "ncounter.h" #include "plscore.h" #include "deskview.h" #include "player.h" class HumanPlayer : public Player { public: HumanPlayer (int aMyNumber, DeskView *aDeskView=0); HumanPlayer &operator = (const Player &pl); HumanPlayer &operator = (const HumanPlayer &pl); virtual void clear (); virtual Card *moveSelectCard (Card *lMove, Card *rMove, Player *aLeftPlayer, Player *aRightPlayer, bool isPassOut=false); // virtual eGameBid moveBidding (eGameBid lMove, eGameBid rMove); // virtual eGameBid moveFinalBid (eGameBid MaxGame, int HaveAVist, int nGamerVist); // - virtual eGameBid dropForGame (); // virtual eGameBid dropForMisere (); virtual bool chooseClosedWhist (); virtual void hilightCard (int lx, int ly); }; #endif openpref-0.1.3/src/logic/player.cpp0000755000175000017500000001412611265177055016643 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include #include #include "player.h" Player::Player (int aMyNumber, DeskView *aDeskView) : mDeskView(aDeskView), mIStart(false), mPlayerNo(aMyNumber) { internalInit(); } Player::Player (const Player &pl) { internalInit(); clone(&pl); } Player::~Player () { clear(); } inline void Player::internalInit () { clear(); } Player &Player::operator = (const Player &pl) { clone(&pl); return *this; } void Player::clone (const Player *pl) { if (pl && pl != this) { mDeskView = pl->mDeskView; mCards = pl->mCards; mLeft = pl->mLeft; mRight = pl->mRight; mOut = pl->mOut; mCardsOut = pl->mCardsOut; mCardCarryThru = pl->mCardCarryThru; mNick = pl->mNick; mMessage = pl->mMessage; mPlayerNo = pl->mPlayerNo; mInvisibleHand = pl->mInvisibleHand; mMyGame = pl->mMyGame; mTricksTaken = pl->mTricksTaken; mPrevHiCardIdx = pl->mPrevHiCardIdx; } } void Player::clear () { mCards.clear(); mLeft.clear(); mRight.clear(); mOut.clear(); mCardsOut.clear(); mCardCarryThru = 0; mMessage.clear(); mInvisibleHand = (mPlayerNo != 1); mMyGame = undefined; mTricksTaken = 0; mWaitingForClick = false; mPrevHiCardIdx = -1; } inline bool Player::invisibleHand () const { return optDebugHands ? false : mInvisibleHand; } inline void Player::setInvisibleHand (bool invis) { mInvisibleHand = invis; } inline void Player::setCurrentStart (bool start) { mIStart = start; } inline void Player::sortCards () { mCards.mySort(); } inline void Player::dealCard (Card *aCard) { mCards.insert(aCard); } void Player::returnDrop () { if (mCardsOut.at(0)) mCards.insert(mCardsOut.at(0)); if (mCardsOut.at(1)) mCards.insert(mCardsOut.at(1)); mCardsOut.clear(); } inline void Player::gotTrick () { mTricksTaken++; } inline void Player::gotPassPassTricks (int cnt) { mTricksTaken = cnt; } /////////////////////////////////////////////////////////////////////////////// // game graphics /////////////////////////////////////////////////////////////////////////////// void Player::getLeftTop (int *left, int *top) { *left = 0; *top = 0; if (!mDeskView) return; switch (mPlayerNo) { case 1: *left = (mDeskView->DesktopWidth-(mDeskView->DesktopWidth/2-2*mDeskView->xBorder))/2; *top = mDeskView->DesktopHeight-(mDeskView->yBorder)-CARDHEIGHT;//mDeskView->CardHeight;//-10; break; case 2: *left = mDeskView->xBorder; *top = mDeskView->yBorder+20; break; case 3: *left = mDeskView->DesktopWidth-mDeskView->xBorder; *top = mDeskView->yBorder+20; break; default: ; } } /////////////////////////////////////////////////////////////////////////////// // build array with cards offsets and indicies // at least 28 ints (14 int pairs); return # of used ints; the last int is -1 // result: ofs, cardNo, ..., -1 int Player::buildHandXOfs (int *dest, int startX, bool opened) { int cnt = 0, oldXX = startX, *oDest = dest; Card *cur = 0, *prev = 0; CardList lst(mCards); lst.mySort(); if (mPlayerNo == 3) startX = 0; // normal startX -= opened ? SUIT_OFFSET : CLOSED_CARD_OFFSET ; for (int f = 0; f < lst.size(); f++) { Card *pp = lst.at(f); if (!pp) continue; prev = cur; cur = pp; if (opened) { startX += (prev && prev->suit() != cur->suit()) ? NEW_SUIT_OFFSET : SUIT_OFFSET ; } else startX += CLOSED_CARD_OFFSET; *dest++ = startX; int idx = mCards.indexOf(cur); *dest++ = idx; if (idx < 0) abort(); cnt++; if (cnt > 12) abort(); } *dest++ = -1; *dest = -1; if (mPlayerNo == 3 && cnt) { // righttop startX = oldXX-(oDest[(cnt-1)*2]+CARDWIDTH+4); for (int f = 0; f < cnt; f++) oDest[f*2] += startX; } return cnt; } int Player::cardAt (int lx, int ly, bool opened) { int res = -1, ofs[28]; int left, top; getLeftTop(&left, &top); buildHandXOfs(ofs, left, opened); for (int f = 0; ofs[f] >= 0; f += 2) { int x1 = ofs[f], y1 = top;//+mDeskView->yBorder; int x2 = x1+CARDWIDTH, y2 = y1+CARDHEIGHT; if (x1 < lx && lx < x2 && y1 < ly && ly < y2) res = ofs[f+1]; } return res; } void Player::drawAt (DeskView *aDeskView, int left, int top, int selNo) { int ofs[28]; DeskView *oDesk = mDeskView; if (!aDeskView) return; mDeskView = aDeskView; int cnt = buildHandXOfs(ofs, left, !invisibleHand()); if (cnt) left = ofs[0]; for (int f = 0; ofs[f] >= 0; f += 2) { int x = ofs[f], y = top; Card *card = mCards.at(ofs[f+1]); aDeskView->drawCard(card, x, y, !invisibleHand(), ofs[f+1]==selNo); } aDeskView->emitRepaint(); mDeskView = oDesk; } void Player::draw () { int left, top; if (!mDeskView) return; getLeftTop(&left, &top); drawAt(mDeskView, left, top, mPrevHiCardIdx); } void Player::clearCardArea () { int left, top, ofs[28]; if (!mDeskView) return; getLeftTop(&left, &top); int cnt = buildHandXOfs(ofs, left, !invisibleHand()); if (!cnt) return; for (int f = 0; ofs[f] >= 0; f += 2) { int x = ofs[f], y = top; mDeskView->ClearBox(x, y, CARDWIDTH, CARDHEIGHT); } } void Player::hilightCard (int lx, int ly) { Q_UNUSED(lx) Q_UNUSED(ly) mPrevHiCardIdx = -1; } openpref-0.1.3/src/score/0000755000175000017500000000000011265437521014647 5ustar kostyakostyaopenpref-0.1.3/src/score/plscore.cpp0000755000175000017500000001624011265177055017033 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include "plscore.h" #include "baser.h" #include "prfconst.h" static QString intList2Str (const QIntList &list, int maxItems) { QString res; int st = 1, len = list.size(); if (maxItems == 0) return QString(); if (maxItems > 0 && len > maxItems) st += (maxItems-len); for (int f = st; f < list.size(); f++) { //if (!res.isEmpty()) res += '.'; res += QString::number(list[f]); res += '.'; } return res; } /////////////////////////////////////////////////////////////////////////////// ScoreBoard::ScoreBoard () { mPool << 0; mMountain << 0; mLeftWhists << 0; mRightWhists << 0; mWhists = 0; } ScoreBoard::~ScoreBoard () { } int ScoreBoard::poolAdd (int delta) { int score = pool(); int ns = score+delta; if (ns <= optMaxPool) { mPool << ns; return 0; } else { if (optMaxPool != score) mPool << optMaxPool; return delta-(optMaxPool-score); } } void ScoreBoard::mountainDown (int delta) { if (delta == 0) return; int score = mountain()-delta; if (score >= 0) { mMountain << score; } else { score = (delta-mountain())*10/2; if (mountain()) mMountain << 0; mLeftWhists << leftWhists()+score; mRightWhists << rightWhists()+score; } } void ScoreBoard::mountainAmnesty (int delta) { if (delta == 0) return; mMountain.last() -= delta; if ((mMountain.last() == 0) || (mMountain.at(mMountain.size()-2) == mMountain.last())) mMountain.removeLast(); } void ScoreBoard::mountainUp (int delta) { if (delta == 0) return; int score = mountain(); mMountain << score+delta; } void ScoreBoard::whistsAdd (int index, int myNumber, int delta) { QIntList *dList; int score; dList = ((myNumber%3)+1 == index) ? &mLeftWhists : &mRightWhists; int pnCurrent = dList->at(dList->size()-1); score = pnCurrent+delta*10; dList->append(score); } int ScoreBoard::recordScores ( eGameBid aGamerType, eGameBid aMyType, int nGamerVz, // int nMyVz, //c int nGamer, int myNumber, int nqVist //- ) { int nGamePrice = gamePoolPrice(aGamerType); // int nGameCard = gameTricks(aGamerType); // int nVistCard = gameWhists(aGamerType); // - int score = 0, pnCurrent = 0; QIntList *dList; if (aMyType >= g61 && aMyType != g86) { // - ! if (nGamerVz >= nGameCard) { // ! return poolAdd(nGamePrice); } else { // pnCurrent = mMountain[mMountain.size()-1]; score = nGamePrice*(nGameCard-nMyVz)+pnCurrent; if (score) mMountain << score; } return 0; } //------------------------------------------------------------------------- if (aMyType == g86) { if (nMyVz) { mountainUp(nGamePrice*nMyVz); return 0; } return poolAdd(10); } //------------------------------------------------------------------------- if (aMyType == raspass) { pnCurrent = mMountain[mMountain.size()-1]; score = nGamePrice*(nMyVz)+pnCurrent; if (nMyVz && score) { mMountain << score; return 0; } if (!nMyVz) return poolAdd(1); } dList = ((myNumber%3)+1 == nGamer) ? &mLeftWhists : &mRightWhists; pnCurrent = dList->at(dList->size()-1); //------------------------------------------------------------------------- if (aMyType == gtPass && aGamerType != g86) { if (!optWhistGreedy && nGameCard-nGamerVz > 0) { // () score = nGamePrice*((nGameCard-nGamerVz)+nMyVz)+pnCurrent; } if (score) dList->append(score); } if (aMyType == halfwhist && aGamerType != g86) { score = nGamePrice*nMyVz+pnCurrent; if (score) dList->append(score); } //------------------------------------------------------------------------- if (aMyType == whist && aGamerType != g86) { if (nGameCard-nGamerVz > 0) { // () if (nqVist == 2) { // 2 // + score = nGamePrice*((nGameCard-nGamerVz)+nMyVz)+pnCurrent; } else { // 1 // + score = nGamePrice*((nGameCard-nGamerVz)+nMyVz)+pnCurrent; } } else { // ϣ if (nqVist == 2) { score = nGamePrice*(nMyVz)+pnCurrent; } else { score = nGamePrice*(10-nGamerVz)+pnCurrent; } // ! if (nVistCard > 10-nGamerVz) { if (nqVist == 2) { // 2 double d = nVistCard; d = (d/2-nMyVz)*nGamePrice; mountainUp((int)d); } else { // 1 if (nVistCard-nMyVz > 0) mountainUp(nGamePrice*(nVistCard-(10-nGamerVz))); } } } if (score) dList->append(score); } return 0; } QString ScoreBoard::poolStr (int maxItems) const { return intList2Str(mPool, maxItems); } QString ScoreBoard::mountainStr (int maxItems) const { return intList2Str(mMountain, maxItems); } QString ScoreBoard::leftWhistsStr (int maxItems) const { return intList2Str(mLeftWhists, maxItems); } QString ScoreBoard::rightWhistsStr (int maxItems) const { return intList2Str(mRightWhists, maxItems); } static void serializeIntList (QByteArray &ba, const QIntList &lst) { serializeInt(ba, lst.size()); for (int f = 0; f < lst.size(); f++) serializeInt(ba, lst[f]); } static bool unserializeIntList (QByteArray &ba, int *pos, QIntList &lst) { int t; lst.clear(); if (!unserializeInt(ba, pos, &t)) return false; while (t-- > 0) { int c; if (!unserializeInt(ba, pos, &c)) return false; lst << c; } return true; } void ScoreBoard::serialize (QByteArray &ba) { serializeIntList(ba, mPool); serializeIntList(ba, mMountain); serializeIntList(ba, mLeftWhists); serializeIntList(ba, mRightWhists); serializeInt(ba, mWhists); } bool ScoreBoard::unserialize (QByteArray &ba, int *pos) { if (!unserializeIntList(ba, pos, mPool)) return false; if (!unserializeIntList(ba, pos, mMountain)) return false; if (!unserializeIntList(ba, pos, mLeftWhists)) return false; if (!unserializeIntList(ba, pos, mRightWhists)) return false; if (!unserializeInt(ba, pos, &mWhists)) return false; return true; } openpref-0.1.3/src/score/score.pri0000755000175000017500000000015311265177055016503 0ustar kostyakostyaDEPENDPATH += $$PWD INCLUDEPATH += $$PWD HEADERS += \ $$PWD/plscore.h SOURCES += \ $$PWD/plscore.cpp openpref-0.1.3/src/score/plscore.h0000755000175000017500000000432711265177055016503 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef PLSCORE_H #define PLSCORE_H #include #include "prfconst.h" class ScoreBoard { public: ScoreBoard (); ~ScoreBoard (); int recordScores (eGameBid aGamerType, eGameBid aMyType, int nGamerVz, int nMyVz, int nGamer, int myNumber, int nqVist); inline int pool () const { return mPool[mPool.size()-1]; } inline int mountain () const { return mMountain[mMountain.size()-1]; } inline int leftWhists () const { return mLeftWhists[mLeftWhists.size()-1]; } inline int rightWhists () const { return mRightWhists[mRightWhists.size()-1]; } int poolAdd (int delta); void whistsAdd (int index, int myNumber, int delta); void mountainDown (int delta); void mountainAmnesty (int delta); void mountainUp (int delta); QString poolStr (int maxItems=-1) const; QString mountainStr (int maxItems=-1) const; QString leftWhistsStr (int maxItems=-1) const; QString rightWhistsStr (int maxItems=-1) const; inline QString whistsStr () const { return QString::number(mWhists); } inline int whists () const { return mWhists; } inline void setWhists (int w) { mWhists = w; } void serialize (QByteArray &ba); bool unserialize (QByteArray &ba, int *pos); private: QIntList mPool; QIntList mMountain; QIntList mLeftWhists; QIntList mRightWhists; int mWhists; }; #endif openpref-0.1.3/src/score/score.cmake0000644000175000017500000000016711265177055016773 0ustar kostyakostyaproject(openpref) SET ( HEADERS ${HEADERS} src/score/plscore.h ) SET ( SOURCES ${SOURCES} src/score/plscore.cpp )openpref-0.1.3/src/prfconst.cpp0000755000175000017500000001025511265177055016107 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include #include "prfconst.h" #include "card.h" bool optStalingrad = true; bool opt10Whist = false; bool optWhistGreedy = true; int optMaxPool = 10; eGameBid gCurrentGame; #ifndef WIN32 // May be #ifdef POSIX? QString optHumanName = getenv("USER"); #else QString optHumanName = ""; #endif QString optPlayerName1 = "Player 1"; bool optAlphaBeta1 = false; QString optPlayerName2 = "Player 2"; bool optAlphaBeta2 = false; bool optDebugHands = false; bool optAggPass = false; int optPassCount = 0; bool optWithoutThree = true; bool optDealAnim = true; bool optTakeAnim = true; bool optPrefClub = false; int CARDWIDTH = 71; int CARDHEIGHT = 96; int trumpSuit (void) { return gCurrentGame-(gCurrentGame/10)*10; } int succBid (eGameBid game) { switch (game) { case g86: return g91; // after misere case g105: return g105; // last case gtPass: return g61; // first default: ; } if (game != undefined) { int vz = game/10, mast = game-vz*10; if (mast != 5) { mast++; } else { mast = SuitSpades; vz++; } return vz*10+mast; } return g61; //return gtPass; } int gameTricks (eGameBid gType) { if (gType >= g71 && gType <= 75) return 7; if (gType >= g81 && gType <= 85) return 8; if (gType == g86) return 0; if (gType >= g91 && gType <= 95) return 9; if (gType >= g101 && gType <= 105) return 10; return 6; } int gameWhists (eGameBid gType) { if (gType >= g71 && gType <= 75) return 2; if (gType >= g81 && gType <= 85) return 1; if (gType == g86) return 0; if (gType >= g91 && gType <= 95) return 1; if (gType >= g101 && gType <= 105) { if (opt10Whist) return 1; else return 0; } return 4; } int gameWhistsMin (eGameBid gType) { if (gType >= g71 && gType <= 75) return 2; if (gType >= g81 && gType <= 85) return 1; if (gType == g86) return 0; if (gType >= g91 && gType <= 95) return 1; if (gType >= g101 && gType <= 105) return 0; return 3; } int gamePoolPrice (eGameBid gType) { if (gType >= g71 && gType <= 75) return 4; if (gType >= g81 && gType <= 85) return 6; if (gType == g86) return 10; if (gType >= g91 && gType <= 95) return 8; if (gType >= g101 && gType <= 105) return 10; if (gType == raspass) return 1; return 2; } eGameBid gameName2Type (const QString &s) { if (s == "raspass") return raspass; if (s == "whist") return whist; if (s == "undefined") return undefined; if (s == "pass") return gtPass; if (s == "g61") return g61; if (s == "g62") return g62; if (s == "g63") return g63; if (s == "g64") return g64; if (s == "g65") return g65; if (s == "g71") return g71; if (s == "g72") return g72; if (s == "g73") return g73; if (s == "g74") return g74; if (s == "g75") return g75; if (s == "g81") return g81; if (s == "g82") return g82; if (s == "g83") return g83; if (s == "g84") return g84; if (s == "g85") return g85; if (s == "g86") return g86; if (s == "g91") return g91; if (s == "g92") return g92; if (s == "g93") return g93; if (s == "g94") return g94; if (s == "g95") return g95; if (s == "g101") return g101; if (s == "g102") return g102; if (s == "g103") return g103; if (s == "g104") return g104; if (s == "g105") return g105; return undefined; } openpref-0.1.3/src/kpref.h0000755000175000017500000000510011265177055015016 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef KPREF_H #define KPREF_H #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #include "desktop.h" #include "deskview.h" class Kpref : public QMainWindow { Q_OBJECT public: Kpref(); ~Kpref(); void init(); void initMenuBar(); //QPainter *p; //pthread_t thread; //int flthread; void adjustDesk (); // Messages void MoveImpossible (); void HintMove (); bool WhistType (); public slots: void forceRepaint (); void slotNewSingleGame (); void slotShowScore (); void slotFileOpen (); void slotFileSave (); void slotHelpAbout (); void slotRules (); void slotOptions (); void slotDeckChanged (); void slotQuit (); //void slotAbortBid (); private: void saveOptions (); void loadOptions (); private: QMenu *netgameMenu; QMenu *fileMenu; QMenu *viewMenu; QMenu *helpMenu; QAction *actNewGame; QAction *actFileOpen; QAction *actFileSave; QAction *actQuit; QAction *actOptions; QAction *actAboutQt; public: PrefDesktop *mDesktop; DeskView *mDeskView; bool mWaitingMouseUp; bool mInMouseMoveEvent; bool mInPaintEvent; QStatusBar * HintBar; QLabel * Hint; protected: void paintEvent (QPaintEvent *); void mousePressEvent (QMouseEvent *); void mouseMoveEvent (QMouseEvent *); void keyPressEvent (QKeyEvent *); void closeEvent(QCloseEvent *event); void resizeEvent(QResizeEvent *event); }; extern Kpref *kpref; #endif openpref-0.1.3/src/main.cpp0000755000175000017500000000466311265177055015203 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include #include #include #include #include #include "main.h" #include "debug.h" #include "prfconst.h" #include "kpref.h" #include "formbid.h" #ifndef LOCAL #define i18n_PATH QCoreApplication::applicationDirPath()+"/../share/openpref/i18n" #else #define i18n_PATH "." #endif using namespace std; int main (int argc, char *argv[]) { QCoreApplication::setOrganizationName("OpenPref"); QCoreApplication::setOrganizationDomain("openpref.sourceforge.net"); QCoreApplication::setApplicationName("OpenPref"); #if !defined(WIN32) && !defined(_WIN32) char *e = getenv("DEBUG"); if (!(!e || !strcmp(e, "0") || !strcasecmp(e, "off") || strcasecmp(e, "on"))) allowDebugLog = 1; #endif for (int f = 1; f < argc; f++) { if (!strcmp(argv[f], "-d")) { for (int c = f; c < argc; c++) argv[c] = argv[c+1]; argc--; f--; allowDebugLog = 1; } else if (!strcmp(argv[f], "-o")) { optAlphaBeta1 = false; optAlphaBeta2 = false; } } qsrand((unsigned)time(0)); QApplication a(argc, argv); QString translationCode = QLocale::system().name(); QString qtFilename = QString(i18n_PATH) + "/openpref_" + translationCode + ".qm"; QTranslator qtTranslator(0); qtTranslator.load(qtFilename); a.installTranslator(&qtTranslator); //a.setFont (QFont("helvetica", FONTSIZE)); kpref = new Kpref(); formBid = new FormBid(kpref); formBid->hide(); kpref->init(); kpref->show(); bool exitCode = a.exec(); return exitCode; } openpref-0.1.3/src/main.pri0000755000175000017500000000071611265177055015206 0ustar kostyakostyaDEPENDPATH += $$PWD INCLUDEPATH += $$PWD HEADERS += \ $$PWD/kpref.h \ $$PWD/prfconst.h \ $$PWD/main.h SOURCES += \ $$PWD/kpref.cpp \ $$PWD/prfconst.cpp \ $$PWD/main.cpp FORMS += \ $$PWD/ui/optform.ui \ $$PWD/ui/newgameform.ui \ $$PWD/ui/helpbrowser.ui include($$PWD/util/util.pri) include($$PWD/cardutil/cardutil.pri) include($$PWD/forms/forms.pri) include($$PWD/score/score.pri) include($$PWD/logic/logic.pri) include($$PWD/desk/desk.pri) openpref-0.1.3/src/prfconst.h0000755000175000017500000000540511265177055015555 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef PRFCONST_H #define PRFCONST_H #include #include typedef QList QIntList; //typedef QList QIntList; // choose card size: // standard deck /* #define CARDWIDTH 71 #define CARDHEIGHT 96 */ /* // PrefClub deck #define CARDWIDTH 56 #define CARDHEIGHT 67 */ extern int CARDWIDTH; extern int CARDHEIGHT; #define FONTSIZE 10 #define SUIT_OFFSET 22 #define NEW_SUIT_OFFSET ((CARDWIDTH)+8) #define CLOSED_CARD_OFFSET ((CARDWIDTH)*0.55) //#define PEVENTMILLISECOND 50 #define CARDINCOLODA 32 #define MAXMASTLEN 8 #define MAXGAMELEN 1024 enum eHand { LeftHand=0, RightHand, NoHand }; enum eSuit { SuitSpades=1, SuitClubs, SuitDiamonds, SuitHearts, SuitNone, }; enum eGameBid { zerogame=0, showpool=1, g86catch=56, raspass=57, whist=58, halfwhist=59, undefined=55, withoutThree=54, gtPass=60, g61=61,g62,g63,g64,g65, g71=71,g72,g73,g74,g75, g81=81,g82,g83,g84,g85,g86, g91=91,g92,g93,g94,g95, g101=101,g102,g103,g104,g105 };// g86 - miser typedef struct { int tricks; int perehvatov; int len; int sum; } tSuitProbs; extern bool optStalingrad; extern bool opt10Whist; extern bool optWhistGreedy; extern int optMaxPool; extern QString optHumanName; extern QString optPlayerName1; extern bool optAlphaBeta1; extern QString optPlayerName2; extern bool optAlphaBeta2; extern bool optDebugHands; extern eGameBid gCurrentGame; extern bool optAggPass; extern int optPassCount; extern bool optWithoutThree; extern bool optDealAnim; extern bool optTakeAnim; extern bool optPrefClub; int succBid (eGameBid game); const QString &sGameName (eGameBid game); int trumpSuit (); int gameTricks (eGameBid gType); int gameWhists (eGameBid gType); int gameWhistsMin (eGameBid gType); int gamePoolPrice (eGameBid gType); eGameBid gameName2Type (const QString &s); #endif openpref-0.1.3/src/cardutil/0000755000175000017500000000000011265437521015343 5ustar kostyakostyaopenpref-0.1.3/src/cardutil/card.h0000755000175000017500000000415411265177055016437 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef CARD_H #define CARD_H #include #include const int FACE_JACK = 11; const int FACE_QUEEN = 12; const int FACE_KING = 13; const int FACE_ACE = 14; class Card { public: inline int face () const { return mFace; } inline int suit () const { return mSuit; } inline bool isValid () const { return mValid; } int pack () const; QString toString () const; friend int operator > (const Card &c0, const Card &c1); friend int operator < (const Card &c0, const Card &c1); friend int operator >= (const Card &c0, const Card &c1); friend int operator <= (const Card &c0, const Card &c1); friend int operator == (const Card &c0, const Card &c1); friend int operator != (const Card &c0, const Card &c1); friend Card *newCard (int aFace, int aSuit); friend void initCardList (); private: void validate (); int compareWith (const Card &c1) const; Card (int aFace, int aSuit); ~Card (); private: int mFace; // 7,8,9,10,11j,12q,13k,14a int mSuit; // 1 4 bool mValid; }; typedef QList QCardList; void initCardList (); Card *newCard (int aFace, int aSuit); Card *newCard (int aPacked); Card *cardFromName (const char *str); #endif openpref-0.1.3/src/cardutil/card.cpp0000755000175000017500000000767611265177055017006 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include "card.h" Card::Card (int aFace, int aSuit) { mFace = aFace; mSuit = aSuit; validate(); } Card::~Card () { } void Card::validate () { mValid = (mFace >= 7 && mFace <= 14 && mSuit >= 1 && mSuit <= 4); } int Card::pack () const { if (!mValid) return 0; return mFace*10+mSuit; } int Card::compareWith (const Card &c1) const { int r = mSuit-c1.mSuit; if (!r) r = mFace-c1.mFace; return r; } QString Card::toString () const { QString res("???"); if (!mValid) return res; switch (mFace) { case 7: res = " 7"; break; case 8: res = " 8"; break; case 9: res = " 9"; break; case 10: res = "10"; break; case 11: res = " J"; break; case 12: res = " Q"; break; case 13: res = " K"; break; case 14: res = " A"; break; default: return res; } switch (mSuit) { case 1: res += "s"; break; case 2: res += "c"; break; case 3: res += "d"; break; case 4: res += "h"; break; default: res = "???"; } return res; } /////////////////////////////////////////////////////////////////////////////// int operator > (const Card &c0, const Card &c1) { return (c0.compareWith(c1) > 0) ? 1 : 0; } int operator < (const Card &c0, const Card &c1) { return (c0.compareWith(c1) < 0) ? 1 : 0; } int operator >= (const Card &c0, const Card &c1) { return (c0.compareWith(c1) >= 0) ? 1 : 0; } int operator <= (const Card &c0, const Card &c1) { return (c0.compareWith(c1) <= 0) ? 1 : 0; } int operator == (const Card &c0, const Card &c1) { return (c0.compareWith(c1) == 0) ? 1 : 0; } int operator != (const Card &c0, const Card &c1) { return (c0.compareWith(c1) != 0) ? 1 : 0; } /////////////////////////////////////////////////////////////////////////////// static Card *cList[33]; static bool inited = false; void initCardList () { if (inited) return; for (int f = 0; f < 32; f++) cList[f] = new Card(f/4+7, f%4+1); /* cList[32] = new Card(7, 1); cList[32]->mFace = 0; cList[32]->mSuit = 0; cList[32]->mValid = false; */ cList[32] = 0; inited = true; } Card *newCard (int aFace, int aSuit) { initCardList(); int no = 32; if (aFace >= 7 && aFace <= FACE_ACE && aSuit >= 1 && aSuit <= 4) no = (aFace-7)*4+(aSuit-1); return cList[no]; } Card *cardFromName (const char *str) { int face = -1, suit = -1; if (!str) return 0; while (*str && (unsigned char)(*str) <= ' ') str++; switch (*str++) { case '7': face = 7; break; case '8': face = 8; break; case '9': face = 9; break; case '1': if (*str++ != '0') return 0; face = 10; break; case 'J': case 'j': face = 11; break; case 'Q': case 'q': face = 12; break; case 'K': case 'k': face = 13; break; case 'A': case 'a': face = 14; break; default: return 0; } while (*str && (unsigned char)(*str) <= ' ') str++; switch (*str++) { case 'S': case 's': suit = 1; break; case 'C': case 'c': suit = 2; break; case 'D': case 'd': suit = 3; break; case 'H': case 'h': suit = 4; break; default: return 0; } return newCard(face, suit); } openpref-0.1.3/src/cardutil/cardlist.h0000755000175000017500000000621111265177055017327 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ //--------------------------------------------------------------------------- #ifndef CARDLIST_H #define CARDLIST_H #include #include "prfconst.h" #include "card.h" // doesn't own the cards class CardList { public: CardList (); CardList (const CardList &cl); ~CardList (); void clear (); void mySort (); Card *exists (int aFace, int aSuit) const; Card *exists (Card *cc) const; Card *minInSuit (int aSuit) const; Card *maxInSuit (int aSuit) const; Card *minFace () const; Card *maxFace () const; bool hasSuit (int aSuit) const; Card *greaterInSuit (int aFace, int aSuit) const; // Card *lesserInSuit (int aFace, int aSuit) const; // Card *greaterInSuit (Card *card) const; // Card *lesserInSuit (Card *card) const; // void copySuit (const CardList *src, eSuit aSuit); // copy only selected suit int cardsInSuit (int aSuit) const; int count () const; int emptySuit (int aSuit) const; // ( ) inline int indexOf (Card *cc) const { if (!cc) return -1; return mList.indexOf(cc); } inline Card *at (int idx) const { if (idx < 0 || idx >= mList.size()) return 0; return mList[idx]; } inline void putAt (int idx, Card *c) { if (idx < 0) return; while (idx >= mList.size()) mList << 0; mList[idx] = c; } inline void removeAt (int idx) { if (idx >= 0 && idx < mList.size()) mList[idx] = 0; } inline void remove (Card *c) { removeAt(mList.indexOf(c)); } inline int insert (Card *c) { int idx = mList.indexOf(0); if (idx < 0) { idx = mList.size(); mList << c; } else mList[idx] = c; return idx; } inline int size () const { return mList.size(); } void serialize (QByteArray &ba) const; bool unserialize (QByteArray &ba, int *pos); CardList &operator = (const CardList &cl); CardList &operator = (const CardList *cl); CardList &operator << (Card *cc); void newDeck (); void shuffle (); protected: //void removeNulls (); void shallowCopy (const CardList *list); void shallowCopy (const CardList &list); protected: QCardList mList; }; #endif openpref-0.1.3/src/cardutil/cardutil.cmake0000644000175000017500000000025711265177055020163 0ustar kostyakostyaproject(openpref) SET ( HEADERS ${HEADERS} src/cardutil/card.h src/cardutil/cardlist.h ) SET ( SOURCES ${SOURCES} src/cardutil/card.cpp src/cardutil/cardlist.cpp )openpref-0.1.3/src/cardutil/cardutil.pri0000755000175000017500000000022111265177055017667 0ustar kostyakostyaDEPENDPATH += $$PWD INCLUDEPATH += $$PWD HEADERS += \ $$PWD/card.h \ $$PWD/cardlist.h SOURCES += \ $$PWD/card.cpp \ $$PWD/cardlist.cpp openpref-0.1.3/src/cardutil/cardlist.cpp0000755000175000017500000001375611265177055017676 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #include "cardlist.h" #include "baser.h" CardList::CardList () { } CardList::CardList (const CardList &cl) { shallowCopy(cl); } CardList::~CardList () { clear(); } void CardList::clear () { mList.clear(); } Card *CardList::exists (int aFace, int aSuit) const { Card *c = newCard(aFace, aSuit); return exists(c); } // can compare pointers, 'cause cards are singletones Card *CardList::exists (Card *cc) const { if (!cc) return 0; if (mList.indexOf(cc) >= 0) return cc; return 0; } Card *CardList::minFace () const { return minInSuit(-1); } Card *CardList::maxFace () const { return maxInSuit(-1); } Card *CardList::minInSuit (int aSuit) const { Card *res = 0; foreach (Card *c, mList) { if (!c) continue; if (aSuit > 0 && c->suit() != aSuit) continue; if (!res || res->face() > c->face()) res = c; } return res; } Card * CardList::maxInSuit (int aSuit) const { Card *res = 0; foreach (Card *c, mList) { if (!c) continue; if (aSuit > 0 && c->suit() != aSuit) continue; if (!res || res->face() < c->face()) res = c; } return res; } int CardList::cardsInSuit (int aSuit) const { int res = 0; foreach (Card *c, mList) if (c && c->suit() == aSuit) res++; return res; } int CardList::count () const { int res = 0; foreach (Card *c, mList) if (c) res++; return res; } void CardList::mySort () { int cnt = mList.size(); // bubble sort for (int f = 0; f < cnt; f++) { for (int c = cnt-1; c > f; c--) { Card *cf = mList[f], *cc = mList[c]; if (cf || cc) { int r = 0; if (cf && cc) { r = (cf->suit())-(cc->suit()); if (!r) r = (cc->face())-(cf->face()); } else if (!cf) r = 1; // so nulls will go down if (r > 0) mList.swap(f, c); } else { // both empty } } } } Card *CardList::greaterInSuit (int aFace, int aSuit) const { if (aFace > FACE_ACE) return 0; if (aFace < 7) aFace = 7; while (aFace <= FACE_ACE) { Card *found = exists(aFace, aSuit); if (found) return found; aFace++; } return 0; } Card *CardList::greaterInSuit (Card *card) const { if (!card) return 0; return greaterInSuit(card->face(), card->suit()); } Card *CardList::lesserInSuit (int aFace, int aSuit) const { if (aFace < 7) return 0; if (aFace > FACE_ACE) aFace = FACE_ACE; while (aFace >= 7) { Card *found = exists(aFace, aSuit); if (found) return found; aFace--; } return 0; } // Card *CardList::lesserInSuit (Card *card) const { if (!card) return 0; return lesserInSuit(card->face(), card->suit()); } bool CardList::hasSuit (int aSuit) const { foreach (Card *c, mList) { if (c && c->suit() == aSuit) return true; } return false; } int CardList::emptySuit (int aSuit) const { for (int f = 1; f <= 4; f++) { if (f == aSuit) continue; //k8:bug? break; if (!hasSuit(f)) return f; } return 0; } void CardList::copySuit (const CardList *src, eSuit aSuit) { // remove existing cards /* QMutableListIterator i(mList); while (i.hasNext()) { Card *c = i.next(); if (c->suit() == (int)aSuit) i.remove(); } */ for (int f = mList.size()-1; f >= 0; f--) { Card *c = mList[f]; if (c && c->suit() == aSuit) mList[f] = 0; } // copy cards foreach (Card *c, src->mList) { if (c && c->suit() == (int)aSuit) insert(c); } } void CardList::shallowCopy (const CardList *list) { clear(); if (!list) return; foreach (Card *c, list->mList) mList << c; } void CardList::shallowCopy (const CardList &list) { clear(); foreach (Card *c, list.mList) mList << c; } void CardList::serialize (QByteArray &ba) const { serializeInt(ba, mList.size()); for (int f = 0; f < mList.size(); f++) { Card *c = mList[f]; int i = 0; if (c) i = (c->face()-7)*10+c->suit(); serializeInt(ba, i); } } bool CardList::unserialize (QByteArray &ba, int *pos) { clear(); int cnt; if (!unserializeInt(ba, pos, &cnt)) return false; while (cnt-- > 0) { int t; if (!unserializeInt(ba, pos, &t)) return false; if (t < 1 || t > 74) t = 0; if (t) { int face = (t/10)+7, suit = t%10; if (face >= 7 && face <= FACE_ACE && suit >= 1 && suit <= 4) mList << newCard(face, suit); else mList << 0; } else mList << 0; } return true; } CardList &CardList::operator = (const CardList &cl) { if (&cl != this) shallowCopy(cl); return *this; } CardList &CardList::operator = (const CardList *cl) { if (cl != this) shallowCopy(cl); return *this; } CardList &CardList::operator << (Card *cc) { if (cc) insert(cc); return *this; } void CardList::newDeck () { mList.clear(); for (int suit = 1; suit <= 4; suit++) { for (int face = 7; face <= FACE_ACE; face++) { mList << newCard(face, suit); } } } void CardList::shuffle () { // remove nulls QMutableListIterator i(mList); while (i.hasNext()) { Card *c = i.next(); if (!c) i.remove(); } // Fisher-Yates shuffler for (int f = mList.size()-1; f >= 0; f--) { int n = (qrand()/256)%(f+1); // 0<=n<=f mList.swap(f, n); } } openpref-0.1.3/src/main.h0000755000175000017500000000220111265177055014632 0ustar kostyakostya/* * OpenPref - cross-platform Preferans game * * Copyright (C) 2000-2009 OpenPref Developers * (see file AUTHORS for more details) * Contact: annulen@users.sourceforge.net * * OpenPref 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see file COPYING); if not, see * http://www.gnu.org/licenses */ #ifndef MAIN_H #define MAIN_H #include #include "prfconst.h" #include "kpref.h" /*class OpenPrefApp : public QApplication { Q_OBJECT public: OpenPrefApp(); ~OpenPrefApp(); }*/ #endif openpref-0.1.3/src/src.cmake0000644000175000017500000000162711265177055015336 0ustar kostyakostyaproject(openpref) INCLUDE_DIRECTORIES( src ) SET ( HEADERS ${HEADERS} src/kpref.h src/prfconst.h src/main.h ) SET ( SOURCES ${SOURCES} src/kpref.cpp src/prfconst.cpp src/main.cpp ) SET ( UIS ${UIS} src/ui/optform.ui src/ui/newgameform.ui src/ui/helpbrowser.ui ) # tell cmake to process CMakeLists.txt in that subdirectory #add_subdirectory(util) #add_subdirectory(cardutil) #add_subdirectory(forms) #add_subdirectory(score) #add_subdirectory(logic) #add_subdirectory(desk) include(src/util/util.cmake) include(src/cardutil/cardutil.cmake) include(src/forms/forms.cmake) include(src/score/score.cmake) include(src/logic/logic.cmake) include(src/desk/desk.cmake) INCLUDE_DIRECTORIES( src ) INCLUDE_DIRECTORIES( src/util ) INCLUDE_DIRECTORIES( src/cardutil ) INCLUDE_DIRECTORIES( src/forms ) INCLUDE_DIRECTORIES( src/score ) INCLUDE_DIRECTORIES( src/logic ) INCLUDE_DIRECTORIES( src/desk ) openpref-0.1.3/BUGS0000644000175000017500000000017211265177055013433 0ustar kostyakostyaKnown Issues 1. AI algorithm for choose of maximum bid is not perfect 2. "Save" menu saves only score, not cards in handsopenpref-0.1.3/NEWS0000644000175000017500000000054611265177055013454 0ustar kostyakostyaOpenPref 0.1.3 New game features: * Closed whist * Without three * Improved old AI for misere and pass-out * Fixed bug in bidding after pass-out * Amnesty for pass-out Other improvements * Clean exit without sending abort() * Two card decks are available * Options (animation and card deck) can be changed game * Save/open functionality * Resizable window openpref-0.1.3/TODO0000644000175000017500000000046611265177055013446 0ustar kostyakostyaFor OpenPref 0.1.4: * Improve bidding algorithm * Refactoring for future network game support * Add help system * Start micro version for mobile devices For OpenPref 0.2.0: * Network game via XMPP protocol * AI improvement * Different AI's with their own bidding schemes * Interactive help system * Artworkopenpref-0.1.3/pics/0000755000175000017500000000000011265437521013703 5ustar kostyakostyaopenpref-0.1.3/pics/xcf/0000755000175000017500000000000011265437521014463 5ustar kostyakostyaopenpref-0.1.3/pics/xcf/bidinfo.xcf0000755000175000017500000001321311265177055016605 0ustar kostyakostyagimp xcf fileSCBB 6 gimp-commentgimp-image-grid(style solid) (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) (xspacing 10.000000) (yspacing 10.000000) (spacing-unit inches) (xoffset 0.000000) (yoffset 0.000000) (offset-unit inches) SC Background     PSChSCDP|9T7T7T#TT#TT$TT$TT$TT$TT$TT$TT$TT$TT$TT$TT$TT$TT$TT T TT TT TT TTTTTTTTTTTTTTTTTTTTTTT TTT!TTT"TTT#TT$TT$TT$TT$TT$TT$TT#TTT"TTT!TTT TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TTT T T TT T T*T T*T T,TT.TT.TT0TT2TT2T4T8TT7T6T2TTTT,99T8T%T%TT%TT%TT%TT%TT%TT%TT%TT%TT%TT%TT%TT%TT%TT! T TT TT TT TTTTTTTTTTTTTTTTTTTTTTT TTT!TTT"TTT#TT$TT$TT$TT$TT$TT$TT#TTT"TTT!TTT TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TTT T T TT T T*T T*T T,T T.TT.TT0TT2TT2T4T9T8T7T6T,9TT7T;T#TT#TT$TT$TT$TT$TT$TT$TT$TT$TT$TT$TT$TT$TT$TT TTT TT TT TT TTTTTTTTTTTTTTTTTTTTT TTT!TTT"TTT#TT$TT$TT$TT$TT$TT$TT#TTT"TTT!TTT TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TTT T T TT T T-T T-T T/TT1TT1TT3TT5TT5T7T;TT;T;T8TTTTT,989:;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<;:9TTTTTTTTT T T TT TTTTTT TT T  T TTTTTTTTTTTTT T T TT TTTTTT TT T   TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TT TT TTT TTTTTTTTTTTT TTT TT T T T^ T6TT6T8T8;: T) T) T*  )!SCSelection Mask SC6SCRTeqD<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<9<;:  )!openpref-0.1.3/pics/xcf/digits.xcf0000755000175000017500000000577311265177055016472 0ustar kostyakostyagimp xcf fileXBBG gimp-commentCreated with GIMPgimp-image-grid(style solid) (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) (xspacing 10.000000) (yspacing 10.000000) (spacing-unit inches) (xoffset 0.000000) (yoffset 0.000000) (offset-unit inches) a X 0123456789M     gimp-text-layer(text "0123456789M") (font "Terminus Bold") (font-size 14.000000) (font-size-unit pixels) (hinting no) (antialias yes) (language "en-us") (base-direction ltr) (color (color-rgb 1.000000 0.000000 0.000000)) (justify left) (box-mode dynamic) (box-unit pixels) XUXn   PPP00,X 0123456789P     gimp-text-layer(text "0123456789P") (font "Terminus Bold") (font-size 14.000000) (font-size-unit pixels) (hinting no) (antialias yes) (language "en-us") (base-direction ltr) (color (color-rgb 0.000000 0.000000 0.000000)) (justify left) (box-mode dynamic) (box-unit pixels) 8XP Xd !   PPP05,P Background      P P (openpref-0.1.3/pics/xcf/imove.xcf0000755000175000017500000000370411265177055016316 0ustar kostyakostyagimp xcf fileBB gimp-image-grid(style solid) (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) (xspacing 10.000000) (yspacing 10.000000) (spacing-unit inches) (xoffset 0.000000) (yoffset 0.000000) (offset-unit inches)  Background     6JZUUUU UU UUU U U U U U U U U U UUUUU U UUܪܪܪܪUܪܪܪܪܪUܪܪܪܪܪܪUܪܪܪܪUܪܪܪܪܪUܪܪUUUUUU UUUU UU UUU U U U U U U U U U UUUUU U UUUUUUUUUUUUU UUUU UUU U U U U U U U U U U U UUUUUUUUUUUUUUUUUU Selection Mask -AQ<8openpref-0.1.3/pics/xcf/presskey.xcf0000755000175000017500000000705111265177055017043 0ustar kostyakostyagimp xcf fileI'BB-G gimp-commentCreated with GIMPgimp-image-grid(style solid) (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) (xspacing 10.000000) (yspacing 10.000000) (spacing-unit inches) (xoffset 0.000000) (yoffset 0.000000) (offset-unit inches) I' Background     ]I'uI' 67:TTT4TTT0TTTT0TTT0TT3;;;33     5         329T667:TT4TTT0TTTT0TTT0TT3::733 TTTTTT TTTTTTTTT TTTTTTT TTTTTTT TTTTTTTTTT5TT TTTTT TTTTTT TTTTT TTTTTT TTTTTTTT TTTTTTTTTTTTTT TT TTTT TT328667TCTTT;TT0TTTTT0TTTT1TT3 T3T T T T T T5T T T T T TT TTT  T  T3 2TGT59:;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:98=<7?TTTTTTTTTTTTT%TTTTTTTTTTTT%TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT%$openpref-0.1.3/pics/bids/0000755000175000017500000000000011265437521014624 5ustar kostyakostyaopenpref-0.1.3/pics/bids/s101.png0000755000175000017500000000053711265177055016031 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX EQmfLܳL"d)`J1e;;]-X8u8a6ؼp*@µ n4 CNA½}Ɲk[nt~bK{$@%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s102.png0000755000175000017500000000055011265177055016025 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATXױ EQ0/RMgq` tmc2ys:rZ`oYkyOP~9maګ?z_VW9˼܍GՆe}g}@ (^(`%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s103.png0000755000175000017500000000057211265177055016032 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX 0DkS(hR˼[@ӝh1e}!87g%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s104.png0000755000175000017500000000060511265177055016030 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX El͹h({Z Sʑ.n]@l]U!Iݟf%eUVn_czq^b$F^JږEM\>|N֥6]p8$ .:x5%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s105.png0000755000175000017500000000056511265177055016036 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATXK WJmA7[D!Eֻ ӞzvXbp#,eQ)&N7 \,n"Xn B!-l.!%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s61.png0000755000175000017500000000055511265177055015756 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATXK P4ʸ2Ěb#y;|,#RDDD Ma@c5?I&Nw&7ѻ^N; i/%.git`Vtp^@*- STu2OpeF /{\"L%#%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s62.png0000755000175000017500000000055511265177055015757 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX; LeS8c0m,"PpjIɐ3֛~r s]?fJ"X8QYD{aϣuy!qkՑ;\2n?˼̼GO:3c}G@ I 5(k %tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s63.png0000755000175000017500000000061611265177055015756 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX YldU׊dq=LBHAĖKI( ƔIgUYտĥRB٩ak"յOdF7=l!*:-hvt{E%5buIm9n{~ڠކe`gY \r.J'x9<$ ZA%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s64.png0000755000175000017500000000063111265177055015754 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATXK0W 77]B W2-8o>&L' â=c4+i3w.պVPog'tir `Ǎm,{x`CWNPǡGoz}ia\ ZX#H\5`⚪3^`#o!gCq;~&c%B.8m8/LE%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s65.png0000755000175000017500000000057611265177055015765 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX 0/דul잗^"ZFDD\˼ST'ZOו>̹*&:COV|`4pN`bQՍXV v<0hUG nAg5Tyxu&}ĭpҮůs/ݪtvWuv4S%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s71.png0000755000175000017500000000054011265177055015751 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATXA 0 D*u& do#64E㈽>lnz tf pTAq͎׎Qw*]6 8'qpYq3j]u9nWb)%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s72.png0000755000175000017500000000054111265177055015753 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX; EQt ᅏxOcB ơs]Д6Ɯ=k4[;=|EZIxׯO\JO (8q~ +K_YBGW6?n}%%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s73.png0000755000175000017500000000057611265177055015764 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATXK x+ 77B}Rbk_nF ꪚ? 8$aYY@ߘEjraǩ xl-L hq0Y`!SbGt2PЌ+qDߪER`08 3qpF.->Z%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s74.png0000755000175000017500000000061711265177055015761 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATXQ Cx+!ĔNReBm1҃糡QJ 7uky&uΣ>X1/BϯkSZ/ՕשԀgB?8.VOz:==/v:Ǖػ:.qp0r.\Za B!l*@['%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s75.png0000755000175000017500000000055611265177055015764 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX CO,!B@<(@3!"p`ʁzy~k*Ѿɸ Z7lRBY:s6VxFq$[V95]^>?gצ:ɸ-u8U3n9X3L! vpAg' IDATX aHnIi1.[91s{j`c(& )lX,s"+#Iq|F[~}qv\v9&#%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s82.png0000755000175000017500000000054011265177055015753 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX@0 @2kMIGl,hJ@bڹ]~sHo.&7,A{l vpAg' IDATX EY=-˘(SQB 1aD@܈H}žY?8t˹P:!-@7'K$q ԯk7t,͛'*P+fck$&͡. wJG,@]O?B J '%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s84.png0000755000175000017500000000063211265177055015757 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX Dex0yb2+&pj %ǝi,[@0a){L':/5دnq/A(b=cHq qy:A?VC~DUQv/LOâ͡oo)ݸ^sr5pVyٕ KBb߫@*S%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s85.png0000755000175000017500000000056511265177055015765 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX Cٲew"KHD:uwb*V!B fRMO'L^AZ <x'g^6[{9P!jU pL8%. {g8=O coxB!dnMK4 v%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s91.png0000755000175000017500000000054411265177055015757 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX FQmfDD~L \N1 L||I5 l]NP|g$8k>9eǝ{LDot%uhޝNϸ|:/0/bm%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s92.png0000755000175000017500000000055211265177055015757 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATX; WƊIgm(4&J8|*8񇴂= 8#QggZ8kc ?&µF >.7,{q}x. "z}Ge7#B %tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s93.png0000755000175000017500000000060611265177055015760 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATXK DW"|۔"F2a,K)8Q6ҚL vpAg' IDATXI Ex+ׅ! t[o%q$u"&D$l qd"`{='h ge]2|J.i篨-m!ͅ0=7?R v\Js _m>q||w#V݁/ 7):)׮E%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/bids/s95.png0000755000175000017500000000057111265177055015763 0ustar kostyakostyaPNG  IHDR'IbKGD X pHYsHHFk> vpAg' IDATXK 0 Dx+ו|&uk|!8r0I}֯tX׉\|4z_г[z q*n#43cp=d\W/[V0z jZp8h9Ea74@?Ɍs@Zm*q%L!/7f.,jI3%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/cards/0000755000175000017500000000000011265437521014777 5ustar kostyakostyaopenpref-0.1.3/pics/cards/prefclub/0000755000175000017500000000000011265437521016601 5ustar kostyakostyaopenpref-0.1.3/pics/cards/prefclub/1000.png0000755000175000017500000000115611265177055017700 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭ IDATh[Qr \2InлrKOC!DTagku]GkTxmLTG$WR ptŋc"Yi1X 1R bV?Qq(!*pZmd"DzCz];u7i[sZ?l U]%sZ9*+9ZTfz3k2㨚g-k_?eh`tfe_: !i-X+:Us!: oLe}iꦲu &9|k?R0%` Y:`w;`&2N^Edp`4G b2X>.Es3X"Gpn.x|2OR`M>yX3J`O\4DS6Dfg޵!DW2 wc ldJ)=:T|ĻKӈz!^r-x /IENDB`openpref-0.1.3/pics/cards/prefclub/empty.png0000755000175000017500000000042011265177055020447 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDATh1 D+Cڇ4&X}ƚHu~]*[}Az@FKZZ 7ȶ"N㐤j+⮵H/@z ^ H/@z ^ H/@z ^ H/@zJ۶=m5^{$ +NgLo ? QIENDB`openpref-0.1.3/pics/cards/prefclub/71.png0000755000175000017500000000104011265177055017537 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDAThr0eQd! dS +,[N?Sy^Y@$ȑdObADx'Zۮ`k?NS]$ qUx1!J͐4`~b%|> gj3((3l fh~#*7D"Hg=ADxȋI)5G0DM|}I(Z|<(M \{T&p\5n;p ECN&Sr+dVݯ `ܙފo$B3"Ic{\ƾicEaIENDB`openpref-0.1.3/pics/cards/prefclub/73.png0000755000175000017500000000120411265177055017543 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭6IDATh[K ;yfh_j$XP (JG?: <|#(N ̹@nP/ɜ N SH@2y^c@2(L4ql)+ImsJC`]da jn|~Mgޛ~.FgXZF&ieifGM D%D7FA~'\s4vpV$pDpZdp._L Ͳ,pDtL{}3rُ`R^ߌ}g2Q2ju9ԡ#ѧl x>:_-+>u7fҧ."Ӷ @~#rВWF{Z_Fըg6梻V&^(%/\j-ۼ(]-)X2.\jg^.I ZZx42>\j9X|˥g5O.ޢ]'ٮ-N4$ud[e$q'$"V$ۢ1чawtSm3v`oz]ʬr5gt Rq̔IENDB`openpref-0.1.3/pics/cards/prefclub/81.png0000755000175000017500000000113511265177055017545 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDAThr!!e{ѥ5%t"=NRՈZZ$ d]Mdi #a3vD'a8uR T[4}&q E>Q)%o&m/EA"81#&uEsc6[ZћJ=A"㉶>MZ`SvDLm4,Vej>tRV]̂W}EF(ϡ0j1%0*yzŊ`{֡ۃQwQ -لR>hmh;tIzbG GhUf%l`>:v-sp<ڮe%]wܝ#PKI8LzbGtiWKv']HO`ҝw~΋E7H-~0s<yBʾ^kDۋŽR_^4f&?IENDB`openpref-0.1.3/pics/cards/prefclub/82.png0000755000175000017500000000123411265177055017546 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭NIDATh edž@jofo6`´vK\)jDDJW-p{qD-MrH$#y.Nl4Ob8=cK)[gۀ&q\ [E.w{mkRJJغnI`[4 O4z rSG+.u:7`CA& xz(T%;II\Û_-{H#gj}d59AQ{nX@7&f #MD[~|lfOUHd#ov>ٮfXt=f3Yl|{g;v+CKnw 3X$e׉\킭VgŴͶgpDgp&.?+kEuY1u@镞&Z/f+"*qY1#\{Z#ꢽ&H] MxHF 67o~0_Vڶ]ٷB3"QFdJ9^f֦ɝL2M^XqN6}56\ 3x%JQZ"m,T$BM0|ck ZqY4rrD8&r^99r;ۯ6P@|9#V & ?LGo|m"Hns&C7_.8fNq&$p̶,,dn$s̎TVdi%Äɜf[M/'Ml.i}<|%"Wlsij>m 4k[ͶSyfv~PjW6[l5ۚՒm@"j9"Oq8;o#]k[gKe ZEu1yH-mf["u^@nb1f@g5-YٖHvZvO nժٖ! T=ٌՃe,RKStV D =%K?#{pHA¹~~]&IENDB`openpref-0.1.3/pics/cards/prefclub/84.png0000755000175000017500000000116511265177055017553 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭'IDATh[ N}Wfl T3L5; S>JW#"Tjۋ#"I +SQUD"0H3m;U6ɪn)4ZH}-@D8ÈEI!0r܍/0Rf8*ctkX3cיBBr JOHE r3Uzug1pA0z3o+VH\("_9#ga_Eufa!s2 g+tx-*4k3p벨m961oǴv4bm)Q>V2!lsĿhʘUdڷ7OGF Zf<Հj4;M^tklgr--]jeזH&)]z$$jֳKOVo9pOFӥV7=]X<%>;]z q6KZmlV;f{cE3EmȀ1E)}U fV `3=Ot]KLj>#l/ a_uk*3IENDB`openpref-0.1.3/pics/cards/prefclub/91.png0000755000175000017500000000114111265177055017543 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDAThю!ECXe$mFīE&1e;pKi_n/E@VUUD"0H "pkuSJE3q6$r,ri|FsRJOn4-4e3 IZS}Rg>gdrZgZ?MfAmׄHj޾[^P͠T묇Q`58_^L=jwfβ |`[(9 ZGcY2E_g}4avV޻%`Ymۚ*GLtH5 njlG?'lsoN&gdaلUol >+&"ltR+GgaGs;']ڝ.՜~bGtIr֪wҥv']O`W\#.bf#]nxWR(r54/FB~knS3"I+c{er8{IENDB`openpref-0.1.3/pics/cards/prefclub/92.png0000755000175000017500000000126211265177055017550 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭dIDAThZ N:"~D;Lor$+hX[o$m'`ȥ/GD`88I"(nta "9"y@Dx#.ߛRD E $Dtldk%|<RJOaZPDjP r)H~*#9,H&E8a_gj,fi L rRrDSk_ ]T#3RAQiZ{&-G4wEtĶ[m[q%۩vKVlӀu/jۻFHcSg2tt>" fTŶqWƉ-E^6c8b#:-Q^Em${좫Zɬ^Eg)jBsϴpDY`=9 TTDz*GԄ4He0\M:e1JDl\j0o f)stoN5tL7, PU6J}(l?bR:9|CG0Ul{#}pnZ3]ɨn膽1Dqf`&e3o^}Td$gtw4mtr; &ho> K w G-Gg3lGbjؓ \ldUb[csvx0#GSb[ >Il#':S5=szC.GNWKmbsT9Y5bb|T W%r9yA\j_'kRmx7fvf,`[~ _}؎Y13ȖWZĶW2{c$ǴΘ(7# {;29 fzv _ XF BWvZ YPnxG(IENDB`openpref-0.1.3/pics/cards/prefclub/102.png0000755000175000017500000000123311265177055017616 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭MIDAThZۮ!˞SDn$mZ]-Ih{Pr)=#"0^8I"(FQ9f)%WY`MjTKg)ji(Q bS&j&z*jB,epyGMx&gH8)㨉E68j⨉6&vTfiНoKY}p]Գݕ'F4a`Yxn$|v ϐ$r7Ǔ.NWqL<IENDB`openpref-0.1.3/pics/cards/prefclub/103.png0000755000175000017500000000126411265177055017623 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭fIDAThr ELCMBZF>PqM!2ĕW#"4ZUZU ) TqU*2XO "<j."E2ϾQp׮4ij}4< K(7)m{_'r/P:h)@f"3 K \)X֚](]5N/ +:L]?a?nP|m/w/XI4 Zfٺ1AIufÖ Fzz=ߡu\(@ Af{Lmxi̶2V̶v0 f[[7S̶j{wf3h=N;D]X{Jmc~k1Gmc:[Ͷ#ペe}0%׏7چ۸4ffRmI#"sɶ<4|mS̶>lY疓DFTo=:зmhKl:| zi|֋q̶hKg$vMuvwfxS&ߪE=f(P ff۞fdOM+Zy؟f*+yDѾT3"*EUˇf{~IENDB`openpref-0.1.3/pics/cards/prefclub/104.png0000755000175000017500000000115711265177055017625 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭!IDATh[۲ $/sjPL aߊ, F ;2 Hj ]HH: Bq(̒;),R 3sN`}-$']7]g$1n ,Jm܉e89E#9R`"9gr}+j:Ϡ4Ჟ`%BpZZ8d$Z8Ahn98D- ,LgpVB<^ D{chϠ,{ޘlK[nc7fk|C3$/7#1-SVf;b+?Q@y 6;+^j@Z54_YOviVlGRH4.EFw 3Dx>qﴰIENDB`openpref-0.1.3/pics/cards/prefclub/111.png0000755000175000017500000000165511265177055017626 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭_IDATh[q0^Gɐ"dQb[kkbY PFVLh\ xIÓcHL$77܄ &`cb{m97lcJq[]wInBdl};քc814Ad1D{מ!Dts ?D#NW$ۏziHud WA**1Cs'Bki90Bpa+ꍢd[ch q߷\v՗՟AO%h ]뒩PAxXϘ+j<<`mRUP3vFTm+y!Z}62g-|P^~3IV~NJ~j6 7s'$Dϩ4, w]R[!=SY[PfX~iߊSh1ui$h!χ݊{pb 5ԻM5l]:uWPݹ%^Wv'"ctPnq4QQV{Gh&ƍK-V(b6dk] , [&γDQ] ?[͇#9@G+Q Z}77'ݰG"ҋhw:NF7 ULTWejwV=rk|˾?m0.&7Ek6'.W(H(a?EE} ު?E_W* @oR5JYPV.zN݊@*A\ti]T|֟UF\D pMuz}widwcxq}c .IENDB`openpref-0.1.3/pics/cards/prefclub/112.png0000755000175000017500000000214111265177055017616 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDAThq ^G Y I  8Η&/HN8R/#"0.x{8$@(һ4A"p6Rٙ"'\k)%H)"Dn}|ƩteǵUV؏Cw¾WJ\e=evPTd b̉W8:H IN" Wu52g9mãn~|b\~jKuկ 72"&Jp~I]4{e=JN_`+gy(JޱH5;#.Į[hjWD*fenc#ATefr3-RŨ*<@BioI ãeE- ̂}1IG`ehي(v1x,?lF2*,K [`b-W=GǿW~Qw >c>5G\uR3]suw^G! J | ټ2: 0K|'DE;RYo賃uQ˸ӝUR]K?)=}F= t2wIENDB`openpref-0.1.3/pics/cards/prefclub/113.png0000755000175000017500000000211711265177055017622 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDAThݛm0 !2HFPx!#CɔH=\AX)K0av%Q VHDcIHTֆM:K1$AccGΝ-"+2PzxmcuyU_h{)/ǚp;O*:D6).eI6ꫜ!轭Jvzk9'7֎c8փh P/Z%p\֨@OƯ%Юe_&JzIì0z!`1˱ zjcд`q t 8^2cH^sT`m5{Ƙdlq ?Hm b;ۥ Y{V%PO5/ѣgj"=?hUmFtOJžC̀E;Dqk4 ks?ۛ`o<<=Do;Z&fL Q[aɜyCʰNX"1򠺢ulO9qnz?Lޠ&yĚK R>9vZEIU M,Slʢ|KxB?%9Fl5[J~+K##{۸Z 2)ܞX"I+}R nkxW5ye2ƴ#(~"tj50;r,Jڵ sĂcljY:+X m3I׃E1œw-^dAzNQ &ִ?$O߇*ttg]"7$nOA}m8q?IENDB`openpref-0.1.3/pics/cards/prefclub/121.png0000755000175000017500000000174311265177055017625 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDAThˍ0 2UԲmC:b4M8b~@pF%R6kU%LBj=/#"0.xz8$@n.Q& 8Hݭ "Vk]*22Spup/r)Kׯ ̥5˴:X$_ю3\RW%ݷeV@9S$(7#)?Ru? ?z2N8T&qyz+Ͳ,;Ƶ,84Pb%dZVL,e\5KTWxi3L沕d\&zZd9 H-nZbd&1[7rfx|EDz0,#F+SLtjxr\=lxzo O.`ޒ6VE3yĈ,V~o)G٤ԜLs*υ@;Έe2|yRѬ,s00ܺۆD{!XKd^B8dЍ$쐨 ِdeVh Ȭ{Ze7։u@c <׾,~:VspZpdxo '-eA58X_6Z3Hфܾƀ ' M֋.a#mM B[\81tx B,fgt#lxa-qpk$~7Bf8Ʉ?%d8 fgxIȂ+f='wWi,o ?lA^vnASxr& #OcX;}nz/J?NpaiYrLq7_r@V޸S/# Jo,鿁Ծ># tO-fʽ2IENDB`openpref-0.1.3/pics/cards/prefclub/122.png0000755000175000017500000000174211265177055017625 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDAThݛ͑0 v @܄FZIڠrMLs¡h#y3;#kI%s$\HD@>=+d@IGA I-u{ ȝs+C *[ "2uDvNu2ݓ;KjTjڛqryKtrZ\ K[:5UCCCZà4cL[N{j ̀D1S {Kk,.rZKaE j/s+nw@/]熠QӺūiЕ y2.PJ+uL38g9)u t)V9: O0Rۛdҥԝ.m0%* &Mszܥ6:91@.ySYU.WNbZW(P ǙVƯlY;'3XjA-ԪH\m͌Q4泃˔+BUm:BfYnz]|kKC9py9f;W﬉c{%-7Kcp7 5g:dX 7 gl7-.6^||!sYd $w2bؗ;azmQ0==^~9 HtqIzl!)um|ODC!~al/1qOԒW&rp%B'z_/N%pZ;OXQuQ­viR<r$]ԛY$=oKhQs ZrYrQIGuP; s}<,J?~q9cK{œ~-~N帓 W 6 鰠Ru$0ܴQG /`^W:oz\z]gߦli[# bpҊ(WlALlLԤZtȠyӢh ,OⳭhAigXB-XP>IWȯE õҲ!,!G ( qf!Rr#[3U H{!cjUO*~Um[> ]_uQ"2oth*M? L<ǭ eyklљ^։Rݥ;Kg KonY{u_] _}룹IENDB`openpref-0.1.3/pics/cards/prefclub/124.png0000755000175000017500000000223411265177055017624 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭NIDATh[0\n&"&R#A $w2+B(OUKs9 xIO!I2Aְ 2AL`cb#;Dof/hQO)ߋ$~"# ?k(2Y+(5lHpY^G'gI~F \gT_tYFӢ.ڧg~4dpR^WK_Ȑ)GOPj\ Ҥcb\&{6F02 haz5ۏlN&2ɗ]5lfڂ%01B"Bz<']:euS c/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9ǯ}\= Vx}UçKw=ՙ %CLp{ nÎ_dwnIENDB`openpref-0.1.3/pics/cards/prefclub/133.png0000755000175000017500000000215611265177055017627 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭ IDATh[m0} RÞj%T6RKP%Ԑ `LQ󥨬+#jv$<$$x=Gl 5=AEB?Vҟ=c;b]4 #$*ZSEMK*ia:')Z^#Hd$!RZo/?[S"?VtAro}z V<-J:Gg2gUp}nOR^e˚ Z뭒l;*>q[]v)@ʐ*#K rvt;Z5U]hoլOGXy-[kfGkPIxMLu.:MQOxho-Tlvd;=ձw_|7QIGi.J#ANffG$BتTn4S4Gp~-dHWljq!<6-vtn=ˮ"ĞL jYG @Cܧ GN:6?}˜IV ܌y~Sk"8,%=ֽL0K+HdqMQWH&!LpUX$rC{w-ll dflVIv(ww6\)刈'x{rN6.|I{@DЍ)l/ZZ*R b "cjs2=y"GpRVo$SH[t'>&/x)rWldiDL}!Z1&hZt!盦!_|\1 xk .vypBlKFHdx CQ; 7ZqP]X=!^lRs)8nGC?>`@Fj""il}ʋPZs 7H;XIeHB />=2iDnp{\VTlرIENDB`openpref-0.1.3/pics/cards/prefclub/141.png0000755000175000017500000000115211265177055017621 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDAThQ @ӣ=S~4FA0e%WJ^GDjrD-I! D`HlsADm`)q*3ג~놷#iAUFP;kᎏGnj'*S-NÂ,QL_MH=HKɈmVJ՘`fҒ= 4#YslW+f$6"1M-+ hQKtxMŌG=.Մ\M)E%̂r#C$"rX%w-x%W-%hZr`Zry]KN ֱPZ25G`ꃚ9XI̓JI (Bҫp냵߅588n&uw_յk0;`v.t&W" vxJj^+XDnq!Aݥ.>#K$=ys!vTIENDB`openpref-0.1.3/pics/cards/prefclub/142.png0000755000175000017500000000122311265177055017621 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭EIDAThQ0@({=g]2+BHKj$-;9r눈W-QK +|cY~ D`H3ؑsAD芾4(X>na p;l7}iI.A fֵ![%o˄Ff5V]լbA뮅{>~SR>RRT-\ x;Ek( -O&;}^ gNӮ^*J1LR&35EAײ`E5|eB2K ROJG#ZV[1XAnbe=H#-^=_Hb&(L G=!V-"p䕓$%1$aנę;EԒ#QڲPKNRKNRKNM [r1OQk=9LYK RAHn׆AkzH#xMIB'TԊC=HKޓ Opu[0m77dU2xXȇe#]Z%c$ψ%u8G|*IENDB`openpref-0.1.3/pics/cards/prefclub/143.png0000755000175000017500000000117311265177055017626 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭-IDAThu @ҙ:g.#QK@_8Z|@$V?K.u #rI,ʽ~" "IYs7wrc L)"o}' $ضmlqB'!'t%k^("-ŏi%L >R&ՠbD;UKgh֢]̡> v˯E9lK5 W2'rAGRYT@3HV2M{rCJ~M#JRkQIͱv^7țQ$1Ku=HLrx˲ $|齈&S"V"=. \NJIrt ϵdY@j2e*zrOGpr vpAgG`brzCIDATxn0EA*5 C$[ HOnS!,k)Vx]ضm;#RJYeÝ'/Zt#iρ/pn׮g}pϞsksjݲOxl׷Ń;oius~2> ~捾>oZ߉__7F-<8F_w |n_8|C>88|Nߟ>q^|4qxq?|}:h::9}:t^{t^u^st>8:?888|qxu~Gqxqxqק:?8::Ou~q!Mu^u>O_8|C>88|Nߟ>q^|4qxq淪E}=kyxUʺb}8>e9_WIENDB`openpref-0.1.3/pics/cards/classic/empty.png0000644000175000017500000000042011265177055020263 0ustar kostyakostyaPNG  IHDR8Cc pHYs 7˭IDATh1 D+Cڇ4&X}ƚHu~]*[}Az@FKZZ 7ȶ"N㐤j+⮵H/@z ^ H/@z ^ H/@z ^ H/@zJ۶=m5^{$ +NgLo ? QIENDB`openpref-0.1.3/pics/cards/classic/71.png0000644000175000017500000000167511265177055017371 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzHIDATxr Dq*?dԼwKⲧU= 9R:ϔ+<u]mRJqǑRua!c|{`ڐ8`8%$&Ĥi֐S!j8$ބKTT=aS8jU6!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|#qZESL WK~Nu24wzpz*^i pzVk9QNv6ਵ| pz.,]Ө?P+0م{cC+5;vVn,sr LLN0Pp_ed;2`p2kq ,vV/"8o]6'c"q퓉Vg U=~m t4Fapۜ9~mq`":'O&Z=[Bɢ퓉VJ08Y}2NmLz'Ow=8 a{?[gg ~\=~Nt=~mŨG88ϴXC08?zzmY v֟~AʫU}yn:<n|[taq 8 ϷF{9~4tzw_z>h dz:ڨ3Ee&'NsA5ڨs:Nx!_IENDB`openpref-0.1.3/pics/cards/classic/81.png0000644000175000017500000000175611265177055017372 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzyIDATxR ř"4fڡg+eK9ɾ!~8HRJٶm۶R'!È@o"r>zWe5fQx98F+0kGqTeSME)I+jzNOUQϻ5,zk^@EqЦHiElWC 8k5A3 zGS*i郭q6ay:/EO]nD?Žj,`8Wu1L,@5Uh.geY[YGO7[G?pU=͌8ZԱHpZ(k_L#BGHg,Uv=ivF]qX6Mqؚ0akfSntb?JqDNԬd(2p8ٛMOwLJ4is75K%Ԭ.=.3D.dƙ.z4,z3ά}Xg`EܭGǑ9@9ϢTed+MO,dtl ҁMhz-ÿtU]gdS;Z)2qf8rSzW#\o[w٫0܍笁ӞU5wϳxs X,g;lzcdoFSx41i=˟U uFiWU"2ps,e֎29w80{#\o受_MU2?NIENDB`openpref-0.1.3/pics/cards/classic/82.png0000644000175000017500000000176111265177055017367 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brz|IDATxr Dq?}Qji^f-#L癄_|O\uHR:8OׯK-d}>F(8^Ĥ9q2V0{Gq*ߚvKRqUx#QUea,jƍV聭qlz`#㠿3TU:,4'Ϊ"lx6=O)}lz,}lfMOn!=.*m¦F WMϏMUx/OwfXgӽ4]{roch,)#uk%(q UU&j߃U|=}Lcw=8qfU6ͦC ]hX}e*n6=5`k#\hX]z\,On6=WU' fj,*qșPlUGJ vpAgG`brzkIDATxn Dq>DR69/(c[)^q^^_qHRJٶm۶R̓0&?D`V̕3]az/iqf qDGtqcɖ%I mPX:*QY5qcY'Ҩ|gtSoG{915 qZ0@Cx$(s[Ǚ=ڹ=@CH`9x#qHI,W7OH(g7QH}ZM"q jo#FXjocpV{#q>`V{#q~yZO_AI6aoL8ol@`qc?#_ qcV[ $aL*81Q=W1'?K{?bu;kW wa8b.sn%}NF q`޿|1c`g{ q 6aY}3J !qD*—1l8kIػ68RJDۏ/?* $xa2Q-RIENDB`openpref-0.1.3/pics/cards/classic/84.png0000644000175000017500000000171111265177055017364 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzTIDATxr D!ןkT"[htg8ŕ5n44?ӔPw<RJ)sN$/g ->oKKڃ5 0׃GT§aF58`a*SS$#`T5r4=5J1ׯDӳM5~j.5>q1 Pqa4op/*8O1(ph={mMO͉5,qm#ljpT=_VbzzLU1J,\É<ΧaN,188E00"Z;-M6ݴ߻sOz8` n_ LJ~)D wGS#dZ=[+<7F5jzѳM~69/ vpAgG`brzIDATxr Dq?w2BKXղœƃVHzY$ZX8 ajuy^ zw[DodqXlz:JgA6ZG73b Doc caUZٔs>z%8bw(ZՐq7U@f}}+Xc [VEy8Yj\X E7 9N譖Q%Q6/{ q2BCgXqșU?R՛2-L)~+˗?^~B9n-IENDB`openpref-0.1.3/pics/cards/classic/92.png0000644000175000017500000000203511265177055017363 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzIDATxr0 DMΟs2nsɸ6l{^2`v#L癄_|߸z)tq)e_ #ZZ}""&߭F(8n/bҜ8R0{50!20xj-S:n*.jR3jE9[U6P65@1u 0OnX6=͉3ZH}6lz>f>6=%}[Ug ǻ8,}ч9ˌ[eU)lzj4r ߫ڭuMObU5jb^'̰:bE㱊٠8OQ‡j.kyd%0_Ue=X'K߃Mq4vk#L'ژnz`*n6=O{au_}nU!|T=]̆2_եafSbyU|ܮi=QF 8B+8^BY z18CNam{GA>q((}0UUk_T>{Efgo`޾W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B=g[ ϻj}_{TǣDT@6=aCqxCDkQ܍S Φ=&Ƥ?U)K50Ez|yLl ߺMH?Z 6cK S gSEl>dK8OF64z{qR `3G;ɕk cݝ ֳ1JFW+5:{- [~[UeWFwW)-C<Q:izaY=0a$-%J wH7dx[eOs0ƩxethgVg XTv7NeWFzcJ Ϊ'q4AD F`ˆw,>J9R}.˗?~vx f_يIENDB`openpref-0.1.3/pics/cards/classic/102.png0000644000175000017500000000213411265177055017433 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzIDATxے DT>}Hy'KEvԌ&J# f3J9$+p]FBqqtu)`D wxDUkMorGʯvZ>OdxE, aB#Lbd;jn]Ԫh@ g8!8hzMOqj-Ve^ /}AǦϜo?~}ނT n3ZeRK0UT'juGY߬%EjUժ\*|Uyjչ(Q7|Ö?V |QqMqJ[jk V.sY,,9NoV@snrzg4@ `ɕ`g1 c'Yfnd5%dGG\tAzTut|f>6=%}n9n6=5  aBեDŽxwtdž{Ulj̪q5qj}A>h}6=9rlzx?{M*lzj:GD#L9V~?6=5*Xf,z<4['|[jܗ*,(:*;uه;׀ %dߋ~,UQ&)zG`B8h @/%4B87O"L3Z5Hn8NUjvqw܂ELԲ|BK[Uên=qY> hހ^s_:Ϋb9q,~>6=%}öTH0[0c<|v=6p\z458l 9M*izUDЧwGPar1ۚqY??)gJ—xR7VVO0IENDB`openpref-0.1.3/pics/cards/classic/103.png0000644000175000017500000000176411265177055017444 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzIDATxr@ D??g^6a<u7.ASA$,kk־Yf¶m۳Fƴڲ,˲,˜3@_b8yRqS# #.UYaqLtaqLDlsG qAX5>`q- (^`}`h!B tdz$qgԮ_bgLuю8Y P-=;!wBOϤg-,^]la&'x`3l0 ^rf?-0rfT 3zrp<3L*TFg{#oG͍n̆HW"s&W=>`q r- 8=laFǗ8Bgu|c: jA%cB  z<c $N2y^(N2y~X@ 8ǂ%>"q taqLtaqLDTw3ps,0z|h s$0z|@&V:Why}gAn6@Ts;X Կ=ɨ{ՓV@џ!L@$Χhfs#q r8fALyCqgN"qОւ4Q9w?nVclX'yx03O8-#Œ~%H31dqP[Ǔ⸖"q taqL0;sƑvM3<9GgWk~2HcRe+v??ElIENDB`openpref-0.1.3/pics/cards/classic/104.png0000644000175000017500000000202011265177055017427 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzIDATxQ ?=8*!Mf]b)-KJ뚞,K"䃽/뺮6"$r9甊Oua/P McD:?AĹ2LGnU%0s"!"h"ބQ.=G:JCEsqP?PϷ Ԃ]BS8iCq&gIÏs3c6^E1AqJ{{XߣdZk=3[QzlhUv^zlqj;0Zh0`"*a ?b^FA :8[UKtPXB7Ly 9:`Ts/M&2Nho&.Vo]2 ;c]ܭ=`g ,V:݀/6z#8%Pq`Ϸ0#V0N!R@4={S@<3S@~["oUaq3 %r$Χi|{"NhzUѥ "CD8DPCD4F`KiYRzr_nU4?K2ӕHE(IENDB`openpref-0.1.3/pics/cards/classic/111.png0000644000175000017500000000406211265177055017435 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzIDATx]ۖ*fןGj:@(}7pU\Wx\>iaV'BfVŖj:~k^E$R~s%L/y=W6gyM=܉P@ٓ}A͹2nze0^>Zo,ێgp)AO{1]rbGZ~m/NjAvkR) PlQYQzvT v9bI stqƮoE=H]tp8>GȫkII"G!Mk%`0k /t4*ްeƛ@g]6SvI$^F5%dim"#yǹpE<:Bkaf5~$wH-´#;^ i?NA+a2+ݕh(}M/,465co["ߕ~w P5߾B0v'mg̳8mj"V/;X&; a2E/:ϯssΣfõȩɃd!G̓%IsIUq@$隓BXPP"e2X!µ$Ѯn<8R"wY1^MeGGgCyQ.e,8REIM5犬Z#UPa]6Qq^UGKۃ_=xڈM 6q6L0aK=agÄp{0;--Ά RzSލ> ?\&F?2]/+1IENDB`openpref-0.1.3/pics/cards/classic/112.png0000644000175000017500000000422611265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=8(AqLº΃5p˗TGq$#BIENDB`openpref-0.1.3/pics/cards/classic/132.png0000644000175000017500000000406011265177055017436 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzIDATx\ْ* tN͇sR\AM츑Puq|>x@@΋?|>WqzG $H{ {⏾8ERI2I~!q&A )?$38TEQ 1q0+'8*LI cxzr(58t@ZVqq4qתjЉ0%+i3{{IQ}^Z QJ>cLhw!LZU͆RUI!:(Xߋ8m,RJ5,80ڡIwlƾ>r;W?{Zfc[XEivhb q=ZӤ AO%ܻ 0a9qzOMO] !I0ZCLFs6YrІe+X^u Jz</9*I+JOo4]VaT/MW ,@l_=U4)xIWO{S[?Kٶ>/ΒJߎk%TeeanC%Ar(&(ǂr-xtܩ*נ07HTGo^=#P2 x8 h;>O S?z}9a90 *jaPhբDDʠr]jv,_N~8Gc=m@T Itϟe;܊%7$,$:IRI!Ǘ$PZ ƙS@ީ$.=h 8"NCq(F#sCf磻X8D08m˟ZP6\naoIXFK÷SsW #L=ZƲ;IƑNw??~ ՐF&҆`<ߴ?|?FK:cnϿWaıwb'# [,'N1HOc&!mq7A8=@~s+%XkH# 'q.%|T-&ygcTw)ze`ЌzוĶ#U Q观t݁Ǖ/ UڱY:TPvѫ76Ѹ4`ܬrݎ #@6}Cm'[9_ XR 1kzyJm#ZڳǶ6 UIm+tړ2%I(GNJH2S-^r(#Xm}rQ:?iFp%THw&gcR|Q9-Ԩ>}rj?|Tb!l:Fk%c-L8zOqFNKUj] vG5Ο q'\QZpCCaS,Y^߾.nU ;n[ۭu L] li`+6*Jc{x_knNMe\{ &(y?+KwqVdqu+>s}Ot ݎ6Wt)ܫ\X7vᰚAByz qH ,ݎr 8o_\TU(— 7LBIENDB`openpref-0.1.3/pics/cards/classic/133.png0000644000175000017500000000435311265177055017444 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzvIDATx]۶ Mg͇;]A."҉1q㺞zx>w^7^׫u]x<Uxx^03/*&BLz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H;qjtߐ'5Ծ 7z[K+JM*P؈*L.@? 'N0qtF0y ^+aFȭ8V´M wX +F܈3Kt8nq.ж<%$@tiaEmę-U8O #u ]ZVQRϙUZVѡzq*,'/KQ['ڈb9q$UQ>NuWaqh{eq]5J-_YˈYre.Cⴢ]h*D+ű^ڼհ Hgo5'IoV[CU{$ǺcFSӊeimގhݯyfӺ_;NBg,'ӓ_nbdviǵȮr*TV_-V&ӲCMxqF' +ά (,?9E5a#8"P L"N0{A^Z.8Niڷ+AP8qbu8g֥ 3 q`9 $9P{T Ƞ]׎crάk8Θjq`D0"Sj"kAP8ΩErU(xq@y)gJ}|qmmzChIENDB`openpref-0.1.3/pics/cards/classic/142.png0000644000175000017500000000131411265177055017436 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzWIDATxQO0bsadU6 傳9/FĄKK36ϭ-Kk{.޷eYZkmiZ[s2=~,C5@ow C$ζi4O-le;<5h"9jS{z`v8W"`c:8K3ٻGHw1"{JW˭נq>85\^r8{1U"OׯGc< *"Cd78c]*"fM"CDp!"8D"C$^?i · !"8DAoArYѬѕk&2y=@eýH\5u}W&8[mu~;OL}>SQzi"CDp!"8D"CĒCw/j"g0388:GAIw38eN5!"8}`8Eܽ{C88=~(oy @nS{5`Ξz8E=gPGkVU3:/%8E\/[CDpk\p6ϭ7 vpAgG`brz;IDATxn@ѡysza?`#{˶$&~"0ӮomM7x/a~gu]ut`Xb _iC8"H1y*2q~ 3y*1q,gnҘ<]" &'@vf+&[y'ȓ.땘8D'&' 3 n9|"'DCdA8kϸS3`* >ǡ 81,>#"Vs,!9}"!R8'ES0 k<_0op`Fa l&H87ȯ!/!"YyF8DCD8DCD8DCD8DCD8DCD8DCD8DSֶ)gSƾ)LA8DCD8w̲ᔱᔳϲᔵmُp\/&LvCD8jߦQuzIh{62qHO3qN>p\9 szs-H8e컧p}6vC槏k/ )>F~DIENDB`openpref-0.1.3/pics/cards/classic/144.png0000644000175000017500000000130511265177055017440 0ustar kostyakostyaPNG  IHDRG`bKGD X pHYsHHFk> vpAgG`brzPIDATxn@Ev> g x6\ѧ1)K86M86w/L4ZkmaZ;n?&CxO30*1q~Ҙ<8Dp'n!r IcTU8gXԄ`z2q> N쪈ҳβW`E|HzzveTbCD8DV98َs4TpP`* 8[pQű`*"""!""!""!""!""!""'V^:/'ދgָP8@P8H pHp^M{[^(T0gO'ͬ`8? 3s|B8_#ppY5$GCD8DCD8DCD8DCD8DCD8DCD8e_L8夷6&2L8;:QpTNY.N{XgV}L"!PՍ>~!"n,MtqlWUskt51qHǏ8ݺecJ8Dӽ/$2}4pki("ckocw^~X@1~IENDB`openpref-0.1.3/pics/openpref.ico0000755000175000017500000002267611265177055016240 0ustar kostyakostya00 %(0` )7' BBBULLL222oCNNNS,555AmmmQQQ Q" aaaLLLLLLMMMNNNOOOMMMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMM??? - VVV""".444Y~~~ \\\AAAHHH  Li"""*** 555H@"jBBBJJJ MMM=a&/Allluuu [[[w'( K  *S]waaaeee """7-U```XXXggg||| NNNIk*%vgc~^^^{{{  sssG)2/DUtAd777yyy 1K-332.6\www )))[c0Z4]:233*Nqvvv ???d=dCiAg@1331 8///}}}uuu qqq^KoQtOrMqG0333'\{<<>>OOOmmmYYY 5`LLLwwwYYY 555wwwZZZ!777mmmttteeePPP=ccc۔iiiRRR```dddaaappp"""c $$$i!!!k!!!j!!!j!!!j"""j$$$j'''j***j(((j'''j)))j"""j!!!j!!!j!!!j!!!j!!!j!!!j!!!j!!!j!!!j j j!!!j!!!j###j;openpref-0.1.3/pics/openpref.png0000755000175000017500000000571511265177055016245 0ustar kostyakostyaPNG  IHDR00WgAMA7tEXtSoftwareAdobe ImageReadyqe< _IDATxZilT3`ƻml*B%RiKhPU*jP !DTPE Q@%(k ccx|׹ތQH={[ww7o8𚒔ڝlnW#1+5^ʫ1běׯdƌ~Ѐx)jjj hz 5Vs]d[5jƍ3׬Y -K pTUU!::6m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-~9z(?cuS,.@lƴmNΑ3ʑ"0{3ݓ]y\Yb۷Ypndugks҃]_Hޭ[H{y#^+OYۊO.~ H&_]8h=~=~PTL/IENDB`openpref-0.1.3/pics/bidinfo.png0000644000175000017500000000137111265177055016030 0ustar kostyakostyaPNG  IHDRSCd9sRGBIDATxͲ0jqW(t 教/AeL16$Hf@ ] omd|TY'rPAy"HRUO:0a:Lra:LznXm2w`V90X h1G~`O9 vpAg *ʳvIDAT8A 0 7OGr? `)sKJe mAkDDDEDDZ2%33`ffk2,[#j`ffUUU'wɧ; ?(<-B.=b(+%tEXtcreate-date2009-05-20T16:44:15+03:00%tEXtmodify-date2009-05-20T16:10:55+03:00mTIENDB`openpref-0.1.3/pics/filesave.png0000644000175000017500000000150611265177055016214 0ustar kostyakostyaPNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxb?% X@ĒGqr }? _~g ×/~w Ow0\x @.XO?iˎɞG`>:z̟?oN+{ _a셯_1|:?>6V~c߿b7?116 s QTŘ!߽RĘ=*rǎ5C!Z @C!;++#3#';!^.W@O?  @; 4Xr`G(a= .]@@^ tf`|i ' Y_?>'v?A O80‚ hׯ ?;Û7؁3 LL@W`@~@Ac0?Pd 4ϟpb/^axSEׯO@ Z`F_??#Çׯ} @_7778l (Iׯ3 `2  IENDB`openpref-0.1.3/pics/pass.png0000644000175000017500000000162711265177055015370 0ustar kostyakostyaPNG  IHDRasRGBbKGD pHYs  #utIME;JKSIDAT8ˍn#U3όgƞFqV q"7 EBH4 BT ((@PnvQ2׋Dˌr\ծ(Њ/Gz'+~}oss*7 p8bS/7?}{hFF#j^p0ٱ.k۪4|~:6h\|gx8N F;}u"UU^uAl)~dGGGF&zimm㪪SJ}_v]aBu!9W|`f3?ʄmJzot]A16664۶UEs]!f3s24sV*Gju9 !I,K0 i0Mk, C$D`A$D)Be)1o5HͶ^$ Cp!ib>OeYjO&W]}vrr"iN2CeBRjiU?E1m[Eq e%JCp7XV.k:;57 e7/e?LG)[Y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NV1tN}=ZzL}(5/櫐Uїq BC)0jLM,in°ztq١* 2_o(~~ #B ~_C{`X뾽pׄ~)3e%GT?(3e!&'=blCG8, W$;&b zx>ټіhX5]ֶt WVc֍:VOa);i(jrxqf1P:2ˆ[8ԩ~V8@zvle{LsY-G5Ɯձ#}—^]=G+#fv;NBw "Qu~)7Tuz_V#S"2)`rCGf<exi8dr`4ueܛG)S9t?`P>AL戭̦F#[%SZ%8>|X|'j>`FHZMSY1o)Yi|2ce猘{w'~|'ZKL9HSφDUm(55b]5}z}x zTI 05Wꪎr۪MWZ*xqd14tb+W{`K/l):Ǒ5$'ٴRt+/B G*.fϝQChv ?eig(&p{+0fjqJx+EA^S I9E72l[7;YMڎ x-g3V5eWAyf2XJ#v!YJqX>Zsg\]R8%ooajr|Lhu !>#wzX Aq3uQ il(}* zQ)i3㝝D BE <57-]g̅|< 2^-M` #Sl2u'"Byg%QoqgF?z+f<]nRJw4.ۭB݃ sy2ҏzhA2R8|]#K/0VԢNV E@Zcސp q:˩uԶ®)\&e4n%tEXtcreate-date2009-09-27T21:25:32+04:00A%tEXtmodify-date2002-04-23T11:51:27+04:001iIENDB`openpref-0.1.3/pics/imove.png0000644000175000017500000000053711265177055015540 0ustar kostyakostyaPNG  IHDRsRGBIDATHV˕0 I:^Ƨl!TpCAj`8{93$? 6H M "H&,Net/"qYϗdjMZ„}^>#x_x6s]SI|:BG'~)M6)@EUF=HUY̓ۜoU|I7ޞ<^\qfK%UN'g0}Z=R^'4r.F"w};ڟ^ UK6?+"VU hɎjh *AIENDB`openpref-0.1.3/pics/fileopen.png0000644000175000017500000000207011265177055016214 0ustar kostyakostyaPNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxb?% XT1X0|/Ьc'^2Xd'_X8X}>v#uo}uh8?b߼_ q_9YQׯ v V_Yt?FEĢʛ/?  ??I d˗@'108:7@  &6V/L  ~`)_GRW[o?@C/ëtD,$0# 0@t oy0X(Á @/T~p)qn}fQUF  @~s2:O f/_ @sGt`e4{sßOXA?++fv1| r< : 21 A{! h4y؅N\g`xà wcxó><|{!#.c3d*Ѐ1ǯ ~gJ8l$.ƿs/by'*?P 3w0 70&_0>y;܀\4$8} 7`}H߿~,3#@U4733 D (yp{S3nv&`S_7d C0gdeamIENDB`openpref-0.1.3/pics/exit.png0000644000175000017500000000147611265177055015375 0ustar kostyakostyaPNG  IHDRasBIT|dtEXtSoftwarewww.inkscape.org<IDAT81lWo[H. v F$!20w #+HV !ni넄qؿX]9:s'cnP*=̥Ry:~{ms<57],-рhQJ)s:zm2dS.s8=1{&Ov:(Ɛi4{" ˌ2i6(Ϟ%ekm Y]%Z=F̙3Lܸə~}2YRt\("XYAE{u>)\/O"/^p:ћĴ*^1u";aXP9֌ul?~LjQvɅ<{F둮T&9ϟgg}ﶷv:H.(}Ztu 2(zqΑAD/_F>GVpΡbkIΝ$h="8΀N&IW*|`<" ~M2ĝ;YYᏥ%rF)R0U6ZњVcKԓ'{HyO6#}pa*!$Ẕ5*n1~IƄ!UG(%(#Gr>-/-- uJA  2F}^]EbL$BjmQf! Z;m></4IENDB`openpref-0.1.3/pics/whist.png0000644000175000017500000000162511265177055015556 0ustar kostyakostyaPNG  IHDRasRGBbKGD pHYs  #utIME$;)IDAT8ˍ=Dg6{Bpo+]rh4-M(tҀI RN'H )voswk{c=T O,o ^oeow'' Y\{e9on|ry/ fgάgϾ;[[csek7w߾}n?-䝾oޚ]&uH,ll\{*}baFƳMAvpm/w*yD){p0 H ƹqðäjqjZ* W\)`m͢tJ99  cqXME+RJ ڭV[ISA\( 1xBbD C$&SPZE BHI1- tqNTITR0vOt4jD4YFIO8M;;0%\3, {/;:M ( $e3Wv GGL>~&jΗCȄؤ.pp]6sy[q>\\q]pv+Vn!y\RƝ4|,%)ׄJ}AD|sv u8Ͽ`>;Ux̩M%rwfу6(~v/NCNhm;L>+ǩ0qx G}><ݷZEFтAT k5_Yoڄ .B3e&ߦ}a&B y#t_~?~ɧWp2;+՝:Х"iG&cx;1&X:O]Z, -7b 07ov G/7W#\weSY"W|i@(dCuH^UtmleA4{}g |xu~l,_4 gk5Ȭ*8>utS8TڞAfя0?-;vt-ѵs E2R)X8w.S[Ӊzݙp:}ݍdׅ$dL&S [SqW65P/~-;NĮd2ʆo6:+՝.GDEs `1X_&јIENDB`openpref-0.1.3/pics/newgame.png0000644000175000017500000000176511265177055016050 0ustar kostyakostyaPNG  IHDRa pHYs  gAMA|Q cHRMz%u0`:o_FkIDATxb?:HLL̢ rrr LLL @ToΜ9avvv55k9{K.t X$$$d-V\aii)cUUU0h(ÿ~ Xrs8ppxE~f ؀w2HII~@1); P?f z_@0\tM{ O%@0^=oZ~2cfe/// @a  ;w1M}a`1|@ p{]Nֿ1 V%=O˰j*  ,?(pss3 Ƿ~302032$ǁ1ùs܀{]x'O0ܺu=UGO:uׯ߀ v0i39;GGGW;vիW ;i[IENDB`openpref-0.1.3/pics/presskey.png0000644000175000017500000000117711265177055016267 0ustar kostyakostyaPNG  IHDRI'CesRGB9IDATh횻0 E/&_V\El 2q˗Q [Gy-1bJAYa&@xCҴ< z<_RzОM2-%%y|=_AJD7@-@uؽCsο n=*(2AJ/K\ރܝ8do`]ҥĴ(*F73b(pNwνK/ڪM׿&(%9Wt8]];`I)W#|QN[堩m,m 1*4!5暩h(mN0\a,t/șƨ&l᭺- [ h՜dD7uVSҜ *j.@@Z7l PnL}10Xq@nr `aΖaܤk(c iX?h3pd)`6[&gl^nMvW WDQuG)9G VUIң;,QDЬO- }jVxO: ՚q;'P@},3Ø ;'IENDB`openpref-0.1.3/cmake/0000755000175000017500000000000011265437521014025 5ustar kostyakostyaopenpref-0.1.3/cmake/cmake_uninstall.cmake.in0000755000175000017500000000172711265177055020622 0ustar kostyakostyaIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) STRING(REGEX REPLACE "\n" ";" files "${files}") FOREACH(file ${files}) MESSAGE(STATUS "Uninstalling \"${file}\"") IF(EXISTS "${file}") EXEC_PROGRAM( "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) IF("${rm_retval}" STREQUAL 0) ELSE("${rm_retval}" STREQUAL 0) MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") ENDIF("${rm_retval}" STREQUAL 0) ELSE(EXISTS "${file}") MESSAGE(STATUS "File \"${file}\" does not exist.") ENDIF(EXISTS "${file}") ENDFOREACH(file) EXEC_PROGRAM( "@CMAKE_COMMAND@" ARGS "-E remove_directory \"${CMAKE_INSTALL_PREFIX}/share/openpref\"" )openpref-0.1.3/cmake/FindLinguist.cmake0000755000175000017500000000245111265177055017436 0ustar kostyakostya# First remove these from cache set(QT_LRELEASE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE) FIND_PROGRAM(QT_LRELEASE_EXECUTABLE NAMES lrelease-qt4 lrelease PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" $ENV{QTDIR}/bin ) if(QT_LRELEASE_EXECUTABLE) message(STATUS "Found lrelease: ${QT_LRELEASE_EXECUTABLE}") else(QT_LRELEASE_EXECUTABLE) message(FATAL_ERROR "Could NOT find lrelease") endif(QT_LRELEASE_EXECUTABLE) mark_as_advanced(QT_LRELEASE_EXECUTABLE) # QT4_WRAP_TS(outfiles infiles ...) # outfiles receives .qm generated files from # .ts files in arguments # a target lupdate is created for you # update/generate your translations files # example: QT4_WRAP_TS(foo_QM ${foo_TS}) MACRO (QT4_WRAP_TS outfiles) FOREACH (it ${ARGN}) GET_FILENAME_COMPONENT(it ${it} ABSOLUTE) GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}.qm) ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_LRELEASE_EXECUTABLE} ARGS -removeidentical -silent ${it} -qm ${outfile} DEPENDS ${it} ) SET(${outfiles} ${${outfiles}} ${outfile}) ENDFOREACH (it) ENDMACRO (QT4_WRAP_TS) openpref-0.1.3/cmake/COPYING-CMAKE-SCRIPTS0000644000175000017500000000245611265177055017035 0ustar kostyakostyaRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. openpref-0.1.3/README0000644000175000017500000000165611265177055013640 0ustar kostyakostyaOpenPref is an open source implementation of European trick-taking game Preferans (or Preference). It is written using cross-platform Qt4 framework and is portable between may operating systems including Windows and major Unix flavours. Some information about game's rules and strategy can be easily found in Wikipedia. There is an issue with OpenPref: when you exit game clicking on Close button in the main window, it can remain in memory. To prevent it, exit the game via menu Game->Quit (Ctrl-Q) or clicking on Close button in bidding window. To run OpenPref you need QtCore and QtGui libraries (Windows package includes them). To compile OpenPref from source code you need also Qt4 headers and development tools: qmake, moc, uic, lrelease. Please, submit all bugs and desired features to project's website http://sourceforge.net/projects/openpref, section Development->Tracker Contact e-mail: annulen at users.sourceforge.net openpref-0.1.3/THANKS0000644000175000017500000000023411265177055013662 0ustar kostyakostyaO. Gromov, U. Zhumaev, V. Savin, G. Veryasov and ZTX18 - testing of snapshot builds Cloth texture was taken from BillardGL project (http://www.billardgl.de)openpref-0.1.3/openpref.pro0000644000175000017500000000130511265177055015307 0ustar kostyakostyaTEMPLATE = app TARGET = openpref QT += gui CONFIG += qt warn_on CONFIG += debug_and_release QMAKE_CXXFLAGS += -DLOCAL #QMAKE_CFLAGS_RELEASE ~= s/\-O./-Os #QMAKE_CXXFLAGS_RELEASE ~= s/\-O./-Os ##QMAKE_CFLAGS_RELEASE ~= s/\-O./-O2 ##QMAKE_CXXFLAGS_RELEASE ~= s/\-O./-O2 #QMAKE_CFLAGS_RELEASE += -march=native #QMAKE_CXXFLAGS_RELEASE += -march=native #QMAKE_CFLAGS_RELEASE += -mtune=native #QMAKE_CXXFLAGS_RELEASE += -mtune=native QMAKE_LFLAGS_RELEASE += -s DESTDIR = . OBJECTS_DIR = _build/obj UI_DIR = _build/uic MOC_DIR = _build/moc RCC_DIR = _build/rcc #include($$PWD/src/qtstatemachine/src/qtstatemachine.pri) include($$PWD/src/main.pri) RESOURCES += $$PWD/gfx.qrc TRANSLATIONS = openpref_ru.ts openpref-0.1.3/CMakeLists.txt0000644000175000017500000000560211265177055015513 0ustar kostyakostyaproject(openpref) set(openpref_VERSION_MAJOR 0) set(openpref_VERSION_MINOR 1) set(openpref_VERSION_PATCH 3) set(openpref_VERSION "${openpref_VERSION_MAJOR}.${openpref_VERSION_MINOR}") set(openpref_VERSION_FULL "${openpref_VERSION}.${openpref_VERSION_PATCH}") include(src/src.cmake) CMAKE_MINIMUM_REQUIRED( VERSION 2.4.0 ) SET( CMAKE_COLOR_MAKEFILE ON ) SET( CMAKE_VERBOSE_MAKEFILE ON ) SET( CMAKE_INCLUDE_CURRENT_DIR TRUE ) SET( CMAKE_MODULE_PATH ${openpref_SOURCE_DIR}/cmake ) if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo) endif (NOT CMAKE_BUILD_TYPE) message(STATUS "The build type is ${CMAKE_BUILD_TYPE}") include (CheckCXXCompilerFlag) SET(CPACK_PACKAGE_CONTACT "annulen@users.sourceforge.net") SET(CPACK_SOURCE_IGNORE_FILES "/.git/;/build/;_build/") set (CPACK_PACKAGE_VERSION_MAJOR ${openpref_VERSION_MAJOR}) set (CPACK_PACKAGE_VERSION_MINOR ${openpref_VERSION_MINOR}) set (CPACK_PACKAGE_VERSION_PATCH ${openpref_VERSION_PATCH}) set (CPACK_PACKAGE_VERSION ${openpref_VERSION_MAJOR}.${openpref_VERSION_MINOR}.${openpref_VERSION_PATCH}) set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") IF( UNIX AND NOT APPLE ) SET(CPACK_BINARY_DEB ON) SET(CPACK_BINARY_RPM ON) ENDIF( UNIX AND NOT APPLE ) IF( APPLE ) SET( PROGNAME OpenPref ) SET( MACOSX_BUNDLE_ICON_FILE OpenPref.icns ) SET( MACOSX_BUNDLE_SHORT_VERSION_STRING 0.1.3 ) SET( MACOSX_BUNDLE_VERSION 0.1.3 ) SET( MACOSX_BUNDLE_LONG_VERSION_STRING Version 0.1.3 ) ELSE( APPLE ) SET( PROGNAME openpref ) ENDIF( APPLE ) if (WIN32) add_definitions( -DWIN32 ) endif (WIN32) include(CPack) IF( MINGW ) # resource compilation for MinGW ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/openprefres.o COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/openprefres.rc -o ${CMAKE_CURRENT_BINARY_DIR}/openprefres.o ) SET( SOURCES ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/openprefres.o) ELSE( MINGW ) # SET( SOURCES ${SOURCES} openpref.rc) ENDIF( MINGW ) SET ( RCS gfx.qrc ) SET ( QM_SRCS openpref_ru.ts ) set(QT_MIN_VERSION "4.4.0") FIND_PACKAGE( Qt4 REQUIRED ) find_package(Linguist) INCLUDE( ${QT_USE_FILE} ) QT4_ADD_RESOURCES( RC_SRCS ${RCS} ) QT4_WRAP_UI( UI_HEADERS ${UIS}) QT4_WRAP_CPP( MOC_SRCS ${HEADERS} ) QT4_WRAP_TS( QMS ${QM_SRCS} ) INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ) ADD_EXECUTABLE( openpref ${SOURCES} ${MOC_SRCS} ${RC_SRCS} ${UI_HEADERS} ${QMS} ) TARGET_LINK_LIBRARIES( openpref ${QT_LIBRARIES} ) INSTALL (TARGETS openpref DESTINATION "games") install(FILES ${QMS} DESTINATION "share/openpref/i18n") # Add support for an uninstall target configure_file( "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ) openpref-0.1.3/.kdbgrc.openpref0000644000175000017500000000023111265177055016016 0ustar kostyakostya[General] DebuggerCmdStr= DriverName=GDB FileVersion=1 OptionsSelected= ProgramArgs= TTYLevel=7 WorkingDirectory= [Memory] ColumnWidths=80,0 NumExprs=0 openpref-0.1.3/.gitignore0000644000175000017500000000004611265177055014740 0ustar kostyakostya_* *.o *.a Makefile* z* openpref buildopenpref-0.1.3/gfx.qrc0000644000175000017500000001061411265177055014245 0ustar kostyakostya pics/cards/classic/71.png pics/cards/classic/72.png pics/cards/classic/73.png pics/cards/classic/74.png pics/cards/classic/81.png pics/cards/classic/82.png pics/cards/classic/83.png pics/cards/classic/84.png pics/cards/classic/91.png pics/cards/classic/92.png pics/cards/classic/93.png pics/cards/classic/94.png pics/cards/classic/101.png pics/cards/classic/102.png pics/cards/classic/103.png pics/cards/classic/104.png pics/cards/classic/111.png pics/cards/classic/112.png pics/cards/classic/113.png pics/cards/classic/114.png pics/cards/classic/121.png pics/cards/classic/122.png pics/cards/classic/123.png pics/cards/classic/124.png pics/cards/classic/131.png pics/cards/classic/132.png pics/cards/classic/133.png pics/cards/classic/134.png pics/cards/classic/141.png pics/cards/classic/142.png pics/cards/classic/143.png pics/cards/classic/144.png pics/cards/classic/1000.png pics/cards/classic/empty.png pics/cards/prefclub/71.png pics/cards/prefclub/72.png pics/cards/prefclub/73.png pics/cards/prefclub/74.png pics/cards/prefclub/81.png pics/cards/prefclub/82.png pics/cards/prefclub/83.png pics/cards/prefclub/84.png pics/cards/prefclub/91.png pics/cards/prefclub/92.png pics/cards/prefclub/93.png pics/cards/prefclub/94.png pics/cards/prefclub/101.png pics/cards/prefclub/102.png pics/cards/prefclub/103.png pics/cards/prefclub/104.png pics/cards/prefclub/111.png pics/cards/prefclub/112.png pics/cards/prefclub/113.png pics/cards/prefclub/114.png pics/cards/prefclub/121.png pics/cards/prefclub/122.png pics/cards/prefclub/123.png pics/cards/prefclub/124.png pics/cards/prefclub/131.png pics/cards/prefclub/132.png pics/cards/prefclub/133.png pics/cards/prefclub/134.png pics/cards/prefclub/141.png pics/cards/prefclub/142.png pics/cards/prefclub/143.png pics/cards/prefclub/144.png pics/cards/prefclub/1000.png pics/cards/prefclub/empty.png pics/cloth.png pics/filenew.png pics/fileopen.png pics/filesave.png pics/newgame.png pics/tool.png pics/exit.png pics/paper.png pics/pass.png pics/whist.png pics/halfwhist.png pics/cancel.png pics/bidinfo.png pics/presskey.png pics/imove.png pics/digits/digits.png pics/bids/s101.png pics/bids/s102.png pics/bids/s103.png pics/bids/s104.png pics/bids/s105.png pics/bids/s61.png pics/bids/s62.png pics/bids/s63.png pics/bids/s64.png pics/bids/s65.png pics/bids/s71.png pics/bids/s72.png pics/bids/s73.png pics/bids/s74.png pics/bids/s75.png pics/bids/s81.png pics/bids/s82.png pics/bids/s83.png pics/bids/s84.png pics/bids/s85.png pics/bids/s91.png pics/bids/s92.png pics/bids/s93.png pics/bids/s94.png pics/bids/s95.png openpref-0.1.3/AUTHORS0000644000175000017500000000032511265177055014020 0ustar kostyakostyaAzarniy I.V., initial developer of KPref Fedotov A.V., developer of OpenPref 0.1.0 Ketmar Dark, author of new alphabeta engine, Qt4 port and massive refactorization Konstantin Tokarev, developer of 0.1.2 and 0.1.3openpref-0.1.3/openpref_ru.qm0000644000175000017500000002170311265177055015636 0ustar kostyakostya&;28AB0 &HalfWhistFormBid &875@&MisereFormBid&0A&PassFormBid &8AB&WhistFormBid ">@38BiddingFormBidB<5=8BL 83@C A HB@0D>< 2 B@8 =54>1@0==K5 27OB:8. 8ABK =5 ?8HCBAOGCancel game with penalty of three untaken tricks. No whists are writtenFormBidLK 459AB28B5;L=> E>B8B5 ?>:8=CBL 83@C?$Do you really want to quit the game?FormBidOpenPrefOpenPrefFormBid !&G5BS&coreFormBidJB>1@0605B ?C;N A @0AAG8B0==K< AG5B><&Show game table with calculated scoresFormBid&57 B@5EWithout &ThreeFormBid157 :>7K@Ono trumpFormBid$@028;0 ?@5D5@0=A0Preferans Rules HelpBrowser* &?@>3@0<<5 OpenPref&About OpenPrefKpref &3@0&GameKpref&!?@02:0&HelpKpref&>20O 83@0... &New game...Kpref&B:@KBL...&Open...Kpref&0@0<5B@K... &Options...Kpref,&@028;0 ?@5D5@0=A0...&Preferans Rules...Kpref K&E>4&QuitKpref&!>E@0=8BL&SaveKpref>&:070BL&ShowKpref<h2>OpenPref 0.1.3</h2>>;LH5 8=D>@<0F88 =0 A09B5 <br/><a href="http://sourceforge.net/projects/openpref">http://sourceforge.net/projects/openpref</a><br/>>;CG8B5 ?>A;54=85 8AE>4=8:8 =0<br/><a href="http://gitorious.org/openprefqt4">http://gitorious.org/openprefqt4</a><br/>(new line) <br/>Copyright (c) 2000-2009,  07@01>BG8:8 OpenPref:<br/>I.Azarniy, A.V.Fedotov, Ketmar Dark, K.Tokarev<br/><br/>OpenPref - MB> A2>1>4=>5 ?@>3@0<<=>5 >15A?5G5=85; 2K <>65B5 @0A?@>AB@0=OBL 8/8;8 87<5=OBL<br/>53> A>3;0A=> GNU General Public License (A<>B@8B5 D09;<br/>COPYING 8;8 <a href="http://www.gnu.org/licenses">http://www.gnu.org/licenses</a>)L

OpenPref 0.1.3

More information on
http://sourceforge.net/projects/openpref
Get latest sources on
http://gitorious.org/openprefqt4

Copyright (c) 2000-2009, OpenPref Developers:
I.Azarniy, A.V.Fedotov, Ketmar Dark, K.Tokarev

OpenPref is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License (see file
COPYING or http://www.gnu.org/licenses)Kpref ?@>3@0<<5AboutKpref & Qt About &QtKpref$K15@8B5 B8? 28AB0Choose whist typeKprefLK 459AB28B5;L=> E>B8B5 ?>:8=CBL 83@C?$Do you really want to quit the game?KprefPK E>B8B5 28AB>20BL A >B:@KBK<8 :0@B0<8?'Do you want to whist with opened cards?Kpref!?@02>G=0O A8AB5<0 ?>:0 =5 @50;87>20=0! !<>B@8B5 http://ru.wikipedia.org/wiki/@5D5@0=ATHelp system has not been implemented yet! See http://en.wikipedia.org/wiki/PreferansKprefOpenPrefOpenPrefKpref3@>: 1Player 1Kpref3@>: 2Player 2Kpref$@028;0 ?@5D5@0=A0Preferans RulesKpref!&G5B... S&core...Kpref"!=5A8B5 425 :0@BKSelect two cards to dropKpref&-B>B E>4 =54>?CAB8<This move is impossibleKpref8>1@> ?>60;>20BL 2 OpenPref!Welcome to OpenPref!Kpref0H E>4 Your moveKpref&;>1A:89 28AB &Greedy whist NewGameDialog6&KE>4 87 @0A?0A>2 6-7-7...&Pass-out exit 6-7-7... NewGameDialog&!B0;8=3@04 &Stalingrad NewGameDialog&57 B@5E&Without three NewGameDialog5AOB5@=0O 83@010 game NewGameDialog$;3>@8B< ;LD05B0AlphaBeta algorithm NewGameDialogB<5=8BL 83@C A HB@0D>< 2 B@8 =54>1@0==K5 27OB:8. 8ABK =5 ?8HCBAOGCancel game with penalty of three untaken tricks. No whists are written NewGameDialog@>25@O5BAOCheck NewGameDialog!>3;0H5=8O Conventions NewGameDialogt 45AOB5@=>9 28ABCNI89 >1O7C5BAO 27OBL E>BO 1K >4=C 27OB:C/In 10 game whister must take at least one trick NewGameDialogb 83@5 H5ABL ?8: >10 ?@>B82=8:0 >1O70=K 28AB>20BL.In six of spades game all opponents must whist NewGameDialog&#25;8G8BL A;>6=>ABLIncrease difficulty NewGameDialog2<O ?@>B82=8:0 (4;O ?C;8)Name of opponent (for chart) NewGameDialog<O:Name: NewGameDialog>20O 83@0New Game NewGameDialog3@>: 1 (A;520)Player 1 (left) NewGameDialog 3@>: 2 (A?@020)Player 2 (right) NewGameDialog 07<5@ ?C;8: Pool size: NewGameDialog>340 2A5 83@>:8 =018@0NB MB> :>;8G5AB2> >G:>2 2 ?C;5, 83@0 70:0=G8205BAO7When all players reach this score in pool the game ends NewGameDialog8ABC5BAOWhist NewGameDialog&0H5 8<O (4;O ?C;8)Your name (to display in chart) NewGameDialog0H5 8<O: Your name: NewGameDialog$=8<8@>20BL &A40GC Animate &deal OptDialog&=8<8@>20BL &27OB:8Animate &takes OptDialog=8<0F8O Animation OptDialog0@0<5B@KOptions OptDialogPref&Club RemixPref&Club Remix OptDialog4&>:070BL :0@BK :><?LNB5@0Sho&w AI cards (debug) OptDialog10 157 :>7K@O 10 no trump PrefDesktop6 157 :>7K@O 6 no trump PrefDesktop7 157 :>7K@O 7 no trump PrefDesktop8 157 :>7K@O 8 no trump PrefDesktop9 157 :>7K@O 9 no trump PrefDesktop 875@Misere PrefDesktop"!=5A8B5 425 :0@BKSelect two cards to drop PrefDesktop8>AB0@09B5AL 70?><=8BL :0@BKTry to remember the cards PrefDesktop2B5<=CNclose PrefDesktop?>;28AB0 half of whist PrefDesktop2 >B:@KBCNopen PrefDesktop?0Apass PrefDesktop4C<0N... thinking... PrefDesktop28ABwhist PrefDesktop157 B@5E without three PrefDesktopopenpref-0.1.3/openpref_ru.ts0000644000175000017500000004156711265177055015661 0ustar kostyakostya FormBid Show game table with calculated scores Отображает пулю с рассчитанным счетом &Pass &Пас &Whist &Вист &Misere &Мизер S&core С&чет Without &Three &Без трех &HalfWhist По&лвиста &Halfwhist Пол&виста Bidding Торги Cancel game with penalty of three untaken tricks. No whists are written Отменить игру с штрафом в три недобранные взятки. Висты не пишутся no trump без козыря OpenPref OpenPref Do you really want to quit the game? Вы действительно хотите покинуть игру? HelpBrowser Preferans Rules Правила преферанса Kpref &Game &Игра &New game... &Новая игра... &Open... &Открыть... &Save &Сохранить &Options... &Параметры... &Quit Вы&ход &Show По&казать S&core... С&чет... &Help &Справка About О программе &About... &О программе... &Preferans Rules... &Правила преферанса... &About OpenPref О &программе OpenPref About &Qt &О Qt Player 1 Игрок 1 Player 2 Игрок 2 OpenPref OpenPref Do you really want to quit the game? Вы действительно хотите покинуть игру? This move is impossible Этот ход недопустим Your move Ваш ход Welcome to OpenPref! Добро пожаловать в OpenPref! Preferans Rules Правила преферанса Help system has not been implemented yet! See http://en.wikipedia.org/wiki/Preferans Справочная система пока не реализована! Смотрите http://ru.wikipedia.org/wiki/Преферанс Choose whist type Выберите тип виста Do you want to whist with opened cards? Вы хотите вистовать с открытыми картами? <h2>OpenPref 0.1.3</h2>More information on <br/><a href="http://sourceforge.net/projects/openpref">http://sourceforge.net/projects/openpref</a><br/>Get latest sources on <br/><a href="http://gitorious.org/openprefqt4">http://gitorious.org/openprefqt4</a><br/> <br/>Copyright (c) 2000-2009, OpenPref Developers:<br/>I.Azarniy, A.V.Fedotov, Ketmar Dark, K.Tokarev<br/><br/>OpenPref is free software; you can redistribute it and/or modify<br/>it under the terms of the GNU General Public License (see file<br/>COPYING or <a href="http://www.gnu.org/licenses">http://www.gnu.org/licenses</a>) <h2>OpenPref 0.1.3</h2>Больше информации на сайте <br/><a href="http://sourceforge.net/projects/openpref">http://sourceforge.net/projects/openpref</a><br/>Получите последние исходники на<br/><a href="http://gitorious.org/openprefqt4">http://gitorious.org/openprefqt4</a><br/>(new line) <br/>Copyright (c) 2000-2009, Разработчики OpenPref:<br/>I.Azarniy, A.V.Fedotov, Ketmar Dark, K.Tokarev<br/><br/>OpenPref - это свободное программное обеспечение; вы можете распространять и/или изменять<br/>его согласно GNU General Public License (смотрите файл<br/>COPYING или <a href="http://www.gnu.org/licenses">http://www.gnu.org/licenses</a>) Select two cards to drop Снесите две карты NewGameDialog New Game Новая игра Players Игроки Conventions Соглашения Whist type: Тип виста: &Stalingrad &Сталинград 10 game Десятерная игра Check Проверяется Whist Вистуется Pool size: Размер пули: &greedy &жлобский Pass-out: Распасы: 6-7-7... 6-7-7... 6 of spades: 6 пик: Player 1 (left) Игрок 1 (слева) AlphaBeta algorithm Алгоритм АльфаБета Name: Имя: Player 2 (right) Игрок 2 (справа) Your name: Ваше имя: Increase difficulty Увеличить сложность Name of opponent (for chart) Имя противника (для пули) In six of spades game all opponents must whist В игре шесть пик оба противника обязаны вистовать When all players reach this score in pool the game ends Когда все игроки набирают это количество очков в пуле, игра заканчивается Your name (to display in chart) Ваше имя (для пули) In 10 game whister must take at least one trick В десятерной вистующий обязуется взять хотя бы одну взятку &Greedy whist &Жлобский вист &Pass-out exit 6-7-7... &Выход из распасов 6-7-7... Cancel game with penalty of three untaken tricks. No whists are written Отменить игру с штрафом в три недобранные взятки. Висты не пишутся &Without three &Без трех OptDialog Options Параметры Pool size: Размер пули: Whist type: Тип виста: &greedy жлобский 10 game: Десятерная игра: &check &проверять 6 of spades: 6 пик &Stalingrad &Сталинград Deal: Сдача: Take: Взятка: &animated с &анимацией a&nimated с а&нимацией Alphabeta: Альфабета: AI cards: Карты компьютера: Sho&w (debug) По&казать Pass-out: Распасы Cancel Отмена O&K O&K Animation Анимация Animate &deal Анимировать &сдачу Animate &takes Анимировать &взятки Sho&w AI cards (debug) &Показать карты компьютера Pref&Club Remix Pref&Club Remix PrefDesktop thinking... думаю... PASS ПАС WHIST ВИСТ whist вист pass пас 6 no trump 6 без козыря 7 no trump 7 без козыря 8 no trump 8 без козыря 9 no trump 9 без козыря 10 no trump 10 без козыря Try to remember the cards Постарайтесь запомнить карты Misere Мизер Select two cards to drop Снесите две карты without three без трех close втемную open в открытую halfwhist полвиста half of whist полвиста openpref-0.1.3/INSTALL0000644000175000017500000000265611265177055014012 0ustar kostyakostyaContents: 1. Prerequisites 3. QMake build 4. CMake build 1. Prerequisites: You'll need to have these libraries (with equivalent devel versions) to build OpenPref: QtCore4 QtGui4 Also you need set of Qt4 build tools: moc uic qmake or cmake 2. QMake build To build OpenPref with QMake: $ qmake openpref.pro $ make If both Qt3 and Qt4 are installed, make sure you are using QMake from Qt4! If compilation fails, try qmake-qt4 instead of qmake. To generate translations: $ lrelease openpref.pro By default, QMake builds executable and translations in top of source tree. It could be run without installation. To install OpenPref system-wide, copy executable and translations in the same folder, e.g. /usr/local/openpref, or use CMake. 3. CMake build To build with cmake, you need cmake >= 2.4-patch 8 . You can get cmake at http://www.cmake.org . There are two ways to build OpenPref with cmake: Inside the source tree or outside. Out of source builds have the advantage that you can have builds with different options from one source directory. To build OpenPref out of source: $ mkdir build $ cd build $ cmake .. $ make $ make install To build OpenPref in the source directory: $ cmake . $ make $ make install To change build options, you can either pass the options on the command line: $ cmake .. -DOPTION=value or use the ccmake frontend which displays all options with their cached values. $ ccmake .. openpref-0.1.3/COPYING0000644000175000017500000010437411265177055014014 0ustar kostyakostya GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .