+
+
+ Minimize Score
+
+
The Flint
diff --git a/manageWorkers.js b/manageWorkers.js
index f574f40..3204fa0 100644
--- a/manageWorkers.js
+++ b/manageWorkers.js
@@ -19,6 +19,7 @@ let optimizeJokers = true;
let optimizeCards = true;
const toggleJokerDiv = document.getElementById('toggleJokerBtn');
const toggleCardDiv = document.getElementById('toggleCardBtn');
+const minimizeDiv = document.getElementById('toggleMinimizeBtn');
const toggleTheFlintDiv = document.getElementById('toggleTheFintBtn');
const togglePlasmaDiv = document.getElementById('togglePlasmaBtn');
const toggleObservatoryDiv = document.getElementById('toggleObservatoryBtn');
@@ -30,6 +31,18 @@ let observatory = false;
let minimize = false;
let optimizeMode = 0;
+function toggleMinimize() {
+ minimize = !minimize;
+ redrawPlayfield();
+
+ if(minimize) {
+ minimizeDiv.innerText = 'X';
+ }
+ else {
+ minimizeDiv.innerHTML = ' ';
+ }
+}
+
function toggleJoker() {
optimizeJokers = !optimizeJokers;
if(optimizeJokers) {
@@ -225,14 +238,36 @@ function workerMessage(msg) {
tmpBestLowHand = msg.data[6];
tmpTypeOfHand = msg.data[7];
}
- if(msg.data[1][1] > bestScore[1] || (msg.data[1][1] === bestScore[1] && msg.data[1][0] > bestScore[0])) {
- bestScore = msg.data[1];
- tmpBestJokers = msg.data[2];
- tmpBestCards = msg.data[3];
- tmpBestCardsInHand = msg.data[4];
- tmpBestHighHand = msg.data[5];
- tmpBestLowHand = msg.data[6];
- tmpTypeOfHand = msg.data[7];
+ if(minimize) {
+ if(msg.data[1][1] > bestScore[1] || (msg.data[1][1] === bestScore[1] && msg.data[1][0] > bestScore[0])) {
+ bestScore = msg.data[1];
+ tmpBestJokers = msg.data[2];
+ tmpBestCards = msg.data[3];
+ tmpBestCardsInHand = msg.data[4];
+ tmpBestHighHand = msg.data[5];
+ tmpBestLowHand = msg.data[6];
+ tmpTypeOfHand = msg.data[7];
+ }
+ else if(tmpBestCards.length === 0 && msg.data[3].length > 0) {
+ bestScore = msg.data[1];
+ tmpBestJokers = msg.data[2];
+ tmpBestCards = msg.data[3];
+ tmpBestCardsInHand = msg.data[4];
+ tmpBestHighHand = msg.data[5];
+ tmpBestLowHand = msg.data[6];
+ tmpTypeOfHand = msg.data[7];
+ }
+ }
+ else {
+ if(msg.data[1][1] > bestScore[1] || (msg.data[1][1] === bestScore[1] && msg.data[1][0] > bestScore[0])) {
+ bestScore = msg.data[1];
+ tmpBestJokers = msg.data[2];
+ tmpBestCards = msg.data[3];
+ tmpBestCardsInHand = msg.data[4];
+ tmpBestHighHand = msg.data[5];
+ tmpBestLowHand = msg.data[6];
+ tmpTypeOfHand = msg.data[7];
+ }
}
if(tasks === 0) {
bestJokers = tmpBestJokers.map(a => {
diff --git a/worker.js b/worker.js
index f36534a..5f11b53 100644
--- a/worker.js
+++ b/worker.js
@@ -155,7 +155,7 @@ function run(jokers = [[]]) {
switch (optimizeMode) {
default:
if(minimize) {
- thisScore = thisHand.simulateWorstHand();
+ thisScore = thisHand.simulateBestHand();
if(!bestScore) {
bestScore = thisScore;
bestCards = thisHand.cards;
@@ -168,10 +168,16 @@ function run(jokers = [[]]) {
bestJokers = jokers[j];
bestCardsInHand = thisHand.cardsInHand;
}
+ else if(bestCards.length === 0 && thisHand.cards.length > 0) {
+ bestScore = thisScore;
+ bestCards = thisHand.cards;
+ bestJokers = jokers[j];
+ bestCardsInHand = thisHand.cardsInHand;
+ }
}
else {
- thisScore = thisHand.simulateBestHand();
+ thisScore = thisHand.simulateWorstHand();
if(!bestScore) {
bestScore = thisScore;
@@ -198,7 +204,7 @@ function run(jokers = [[]]) {
switch (optimizeMode) {
default:
if(minimize) {
- thisScore = thisHand.simulateWorstHand();
+ thisScore = thisHand.simulateBestHand();
if(!bestScore) {
bestScore = thisScore;
bestJokers = jokers[j];
@@ -209,7 +215,7 @@ function run(jokers = [[]]) {
}
}
else {
- thisScore = thisHand.simulateBestHand();
+ thisScore = thisHand.simulateWorstHand();
if(!bestScore) {
bestScore = thisScore;