diff --git a/docs/img/quarto1.gif b/docs/img/quarto1.gif new file mode 100644 index 0000000..61de8a8 Binary files /dev/null and b/docs/img/quarto1.gif differ diff --git a/docs/img/quarto2.gif b/docs/img/quarto2.gif new file mode 100644 index 0000000..eea1621 Binary files /dev/null and b/docs/img/quarto2.gif differ diff --git a/quarto/MyArduboy.cpp b/quarto/MyArduboy.cpp index cabaaf6..293b251 100644 --- a/quarto/MyArduboy.cpp +++ b/quarto/MyArduboy.cpp @@ -8,7 +8,8 @@ PROGMEM static const uint32_t imgFont[] = { 0x0018E300, 0x1F24929C, 0x0D5D555F, 0x1145149C, 0x0725145F, 0x1155555F, 0x0114515F, 0x1D55545E, 0x1F10411F, 0x0045F440, 0x07210410, 0x1D18411F, 0x1041041F, 0x1F04F05E, 0x1F04109C, 0x0F45545E, 0x0314925F, 0x1F45D45E, 0x1B34925F, 0x0D555556, 0x0105F041, 0x0721041F, 0x0108421F, 0x0F41E41F, - 0x1D184317, 0x0109C107, 0x114D5651, 0x0045F000, 0x0001F000, 0x0001F440, 0x000C1080, 0x10410410, + 0x1D184317, 0x0109C107, 0x114D5651, 0x0045F000, 0x0001F000, 0x0001F440, 0x00284280, 0x10410410, + // 0x000C1080 }; #ifdef USE_ARDUBOY2_LIB diff --git a/quarto/common.h b/quarto/common.h index e5d9b79..6712fbf 100644 --- a/quarto/common.h +++ b/quarto/common.h @@ -8,7 +8,7 @@ #define FPS 60 #define APP_TITLE "QUARTO!" #define APP_CODE "OBN-Y08" -#define APP_VERSION "0.03" +#define APP_VERSION "0.10" #define APP_RELEASED "OCTOBER 2019" enum MODE_T { diff --git a/quarto/data.h b/quarto/data.h index 63bc995..88a80e5 100644 --- a/quarto/data.h +++ b/quarto/data.h @@ -84,7 +84,7 @@ PROGMEM static const uint8_t imgPlayer[2][22] = { // 11x11 x2 #define IMG_HINT_WIN_W 5 #define IMG_HINT_WIN_H 5 -PROGMEM static const uint8_t imgHintWin[5] = { 0x11, 0x0A, 0x04, 0x0A, 0x11 }; // 5x5 +PROGMEM static const uint8_t imgHintWin[5] = { 0x04, 0x0A, 0x11, 0x0A, 0x04 }; // 5x5 /*---------------------------------------------------------------------------*/ /* Sound Data */ diff --git a/quarto/game.cpp b/quarto/game.cpp index 63dba44..6fa4d44 100644 --- a/quarto/game.cpp +++ b/quarto/game.cpp @@ -352,7 +352,7 @@ static void newGame(void) game.restPieces = ~(1 << cursorPiece); isCancelable = false; hintWinMoves = 0; - dprint(F("New game: piece = ")); + dprint(F("New game: piece=")); dprintln(cursorPiece); /* Start animation */ @@ -424,7 +424,7 @@ static void choosePiece(void) game.currentPiece = cursorPiece; game.restPieces &= ~(1 << cursorPiece); countWinMoves(&game, false, true); - dprint(F("Next piece = ")); + dprint(F("Next piece=")); dprintln(cursorPiece); /* Start animation */ @@ -779,17 +779,31 @@ static void drawCursor(int16_t x, int16_t y) static bool cpuThinking(void) { GAME_T work = game; - int8_t depth = min(record.cpuLevel, game.turn / 2 + 1); + int8_t depth = record.cpuLevel; + unsigned long startCpuTime = millis(); + if (game.turn < 2) { + depth = 1; + } else if (game.turn < 5) { + depth = min(depth, 2); + } else { + depth = min(depth, game.turn - 2); + } + dprintln(F("CPU thinking...")); + dprint(F(" Depth=")); + dprintln(depth); nextCpuInterval = millis() + CPU_INTERVAL_MILLIS; isCpuInterrupted = false; isLastAPressed = arduboy.pressed(A_BUTTON); int eval = -alphabeta(&work, depth, -EVAL_INF, EVAL_INF); arduboy.setRGBled(0, 0, 0); if (isCpuInterrupted) { - dprintln(F("CPU was interrupted")); + dprintln(F(" Interrupted!")); return false; } else { - dprint(F("CPU's evaluation=")); + dprint(F(" Time=")); + dprint((millis() - startCpuTime) / 1000); + dprintln(F("secs")); + dprint(F(" Evaluation=")); dprintln(eval); return true; } diff --git a/quarto/info.json b/quarto/info.json new file mode 100644 index 0000000..d4f2663 --- /dev/null +++ b/quarto/info.json @@ -0,0 +1,6 @@ +{ + "title" : "Quarto!", + "description" : "A board game played on a 4x4 board with 16 unique pieces.", + "genre": "Board game", + "url": "https://community.arduboy.com/t/quarto-an-abstract-strategy-board-game/8226" +} diff --git a/quarto/title.cpp b/quarto/title.cpp index 95922da..61aece3 100644 --- a/quarto/title.cpp +++ b/quarto/title.cpp @@ -82,7 +82,7 @@ PROGMEM static const uint8_t imgLargePiece[2][52] = { // 13x32 x2 }; PROGMEM static const char instText1[] = \ - "\"QUARTO!\" IS MADE OF\0A 4X4 SQUARE BOARD\0AND OF 16 DIFFERENT\0" \ + "\"QUARTO!\" IS MADE OF\0A 4^4 SQUARE BOARD\0AND OF 16 DIFFERENT\0" \ "PIECES, EACH OF WHICH\0HAS 4 ATTRIBUTES.\0\e"; PROGMEM static const char instText2[] = \ @@ -95,7 +95,7 @@ PROGMEM static const char instText3[] = \ PROGMEM static const char instText4[] = \ "A VARIANT RULE:\0A PLAYER ALSO CAN WIN\0BY PLACING 4 MATCHING\0" \ - "PIECES IN 2X2 SQUARE.\0\0THIS IS CONFIGURABLE.\0CURRENT SETTING: \0\e"; + "PIECES IN 2^2 SQUARE.\0\0THIS IS CONFIGURABLE.\0CURRENT SETTING: \0\e"; PROGMEM static const char * const instList[] = { instText1, instText2, instText3, instText4 }; @@ -105,7 +105,7 @@ PROGMEM static const char instAttrLabels[] = \ PROGMEM static const char creditText[] = \ "- " APP_TITLE " -\0\0\0" APP_RELEASED "\0PROGREMMED BY OBONO\0\0" \ "THIS PROGRAM IS\0RELEASED UNDER\0THE MIT LICENSE.\0\0\0" \ - "ORIGINAL CONCEPT BY\0BLAISE MULLER, FRANCE\0\e"; + "ORIGINAL CONCEPT BY\0BLAISE MULLER, SWISS\0\e"; static STATE_T state = STATE_INIT; static uint8_t counter, instPage, instAttr, instPieces[BOARD_SIZE]; @@ -248,7 +248,7 @@ static void onSettings(void) { playSoundClick(); clearMenuItems(); - addMenuItem(F("APPROVE 2X2"), onSettingChange); + addMenuItem(F("APPROVE 2^2"), onSettingChange); addMenuItem(F("THINKING LED"), onSettingChange); addMenuItem(F("INVERT SCREEN"), onSettingChange); addMenuItem(F("HINT (VS CPU)"), onSettingChange); @@ -302,7 +302,7 @@ static void handleInst(void) playSoundTick(); instPage += vp; isInvalid = true; - dprint(F("instPage = ")); + dprint(F("instPage=")); dprintln(instPage); } else if (arduboy.buttonDown(A_BUTTON) || arduboy.buttonDown(B_BUTTON) && instPage == INST_PAGE_MAX - 1) { @@ -364,12 +364,12 @@ static void handleAnyButton(void) static void drawTitleImage(void) { -#ifdef DEBUG - arduboy.printEx(0, 0, F("DEBUG")); -#endif arduboy.drawBitmap(0, 2, imgTitle, 128, 24, WHITE); arduboy.drawBitmap(4, 24, imgLargePiece[0], 13, 32, WHITE); arduboy.drawBitmap(111, 24, imgLargePiece[1], 13, 32, WHITE); +#ifdef DEBUG + arduboy.printEx(0, 0, F("DEBUG")); +#endif } static void drawRecord(void)