Changes the unique numbers to unique colors

This commit is contained in:
2023-06-07 10:41:56 -04:00
parent 27224394b9
commit 3e50607d5d
5 changed files with 20 additions and 20 deletions

View File

@@ -125,9 +125,9 @@ function cellClicked(i, j) {
}
render_game(state);
}
function giveHand(indexOfSquare = -1, inxOfCardPlayed = -1) {
if (indexOfSquare != -1 && inxOfCardPlayed != -1) {
state.hand = numsToCard(adjust_seed(indexOfSquare, inxOfCardPlayed));
function giveHand(indexOfSquare = -1, indexOfCardPlayed = -1) {
if (indexOfSquare != -1 && indexOfCardPlayed != -1) {
state.hand = numsToCard(adjust_seed(indexOfSquare, indexOfCardPlayed));
} else {
let curr_board = prand(numToString(curr_seed))[0];
let c1 = curr_board % 30;

View File

@@ -38,7 +38,7 @@
Having large numbers. The sum of every card will be totaled and divided by two (rounded up). This will then be added to your total score.
</li>
<li>
Having a variety of numbers. Players get the number of unique cards squared in points.
Having a variety of colors. Players get the number of unique colors squared in points.
</li>
</ol>
<p><a href='/klumpy/leaderboard.php'>Click here for the leaderboard.</a></p>
@@ -87,7 +87,7 @@
<p>Single Run Score: <span id="single_run_score"></span></p>
<p>Increasing Row Score: <span id="increasing_row_across_score"></span></p>
<p>Total Sum Score: <span id="tot_sum_scores"></span></p>
<p>Unique Number Bonus: <span id="all_number_scores"></span></p>
<p>Unique Color Bonus: <span id="all_color_scores"></span></p>
<br>
<div id='winGame' class='popup'>
<div class='popup-content'>
@@ -101,9 +101,9 @@
</div>
</div>
</div>
<script src="render.js?v=1.0.1"></script>
<script src="score.js?v=1.0.1"></script>
<script src="index.js?v=1.3.1"></script>
<script src="render.js?v=1.1.0"></script>
<script src="score.js?v=1.1.0"></script>
<script src="index.js?v=1.3.2"></script>
</body>
</html>

View File

@@ -65,7 +65,7 @@
<p>Single Run Score<span title="The number of points based on the longest run of consecutive numbers in any orthogonal direction. Uses the following formula (9 - lowest_value) * (highest_value - lowest_value + 1)." style="cursor: help" class="help ui-icon ui-icon-info"></span>: <span id="single_run_score"></span></p>
<p>Increasing Row Score<span title="You get 10 points for every row where the numbers are strictly increasing." style="cursor: help" class="help ui-icon ui-icon-info"></span>: <span id="increasing_row_across_score"></span></p>
<p>Total Sum Score<span title="This is just a sum of all the numbers divided by 2." style="cursor: help" class="help ui-icon ui-icon-info"></span>: <span id="tot_sum_scores"></span></p>
<p>Unique Number Bonus<span title="A bonus of 50 points if you have all the numbers on the board" style="cursor: help" class="help ui-icon ui-icon-info"></span>: <span id="all_number_scores"></span></p>
<p>Unique Color Bonus<span title="A bonus of 50 points if you have all the numbers on the board" style="cursor: help" class="help ui-icon ui-icon-info"></span>: <span id="all_number_scores"></span></p>
<p>Score: <span id="score"></span></p>
<h3>Hand</h3>
<table class="game" id="hand">
@@ -78,8 +78,8 @@
</div>
</div>
</div>
<script src="render.js?v=1.0.1"></script>
<script src="score.js?v=1.0.1"></script>
<script src="render.js?v=1.1.0"></script>
<script src="score.js?v=1.1.0"></script>
<script src="leaderboard.js?v=1.0.2"></script>
</body>

View File

@@ -25,7 +25,7 @@ function render(state) {
"#single_run_score",
"#increasing_row_across_score",
"#tot_sum_scores",
"#all_number_scores",
"#all_color_scores",
"#score",
];
score_parts.forEach((part, i) => {

View File

@@ -188,19 +188,19 @@ function tot_sum(object) {
}
return Math.floor(ret / 2);
}
function all_numbers(object) {
const nums = [];
function all_colors(object) {
const colors = [];
for (let i = 0; i < rows; i++) {
for (let j = 0; j < cols; j++) {
if (object[i][j]) {
let curr_num = object[i][j].number;
if (nums.indexOf(curr_num) == -1) {
nums.push(curr_num);
let curr_color = object[i][j].color;
if (colors.indexOf(curr_color) == -1) {
colors.push(curr_color);
}
}
}
}
return nums.length * nums.length;
return colors.length * colors.length;
}
function calculate_score(object) {
//object is an array of four arrays each of which is an array of four objects
@@ -212,14 +212,14 @@ function calculate_score(object) {
// console.log("increasing_row_across_result: ", increasing_row_across_result);
const tot_sum_result = tot_sum(object);
// console.log("tot_sum_result: ", tot_sum_result);
const all_numbers_result = all_numbers(object);
const all_colors_result = all_colors(object);
// console.log("all_numbers_result: ", all_numbers_result);
return [
clump_result,
single_run_result,
increasing_row_across_result,
tot_sum_result,
all_numbers_result,
all_colors_result,
];
}
// End of code made with help from Raj Tiller