Skip to content

Commit

Permalink
Updated the color puzzle to the new design
Browse files Browse the repository at this point in the history
  • Loading branch information
malloc-nbytes committed Jan 27, 2024
1 parent c1cfd5f commit a9b3a7f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 21 deletions.
13 changes: 12 additions & 1 deletion src/color-puzzle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@
Puzzle color_puzzle_create(long seed)
{
std::string description = utils_file_to_str("./files-color/.desc.txt");
int rand = utils_rng_roll(0, 1, seed);
std::string color_hex = rand ? "331E54" : "F4AA00";
std::string color_name = rand ? "Purple" : "Gold";

description += color_name + "</b>";
description += "<ul style=\"display: inline-block; float: right; margin-right: 50%\">"
" <li>6-character sequence,</li>"
" <li>hexadecimal color code,</li>"
" <li>uppercase letters.</li>"
"</ul>";
std::string html_content = utils_generate_html("Color Puzzle", description, seed);
utils_generate_file("./files-color/instructions.html", html_content);
return Puzzle{"files-color", "331E54F4AA00"};

return Puzzle{"files-color", color_hex};
}
11 changes: 2 additions & 9 deletions src/files-color/.desc.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
Congratulations on completing the first puzzle! You have been 0 points. This is a major accomplishment! You are now ready to move on to the next puzzle.

<b>What are the <a href="https://en.wikipedia.org/wiki/Web_colors">hex values</a> values for the Lipsomb Colors?</b>

<ul style="display: inline-block; float: right; margin-right: 50%">
<li>12-character sequence,</li>
<li>hexadecimal color codes,</li>
<li>two primary colors, and</li>
<li>uppercase letters.</li>
<li>darker color first.</li>
</ul>
Lipscombs team colors are purple and gold,
<p><b>what is the <a href="https://en.wikipedia.org/wiki/Web_colors">hex value</a> of lipscomb's color:</b>
Binary file added src/main
Binary file not shown.
8 changes: 0 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ void create_nested_zipfiles(std::vector<Puzzle> &puzzles)
}
}

void usage(const char *prog_name)
{
std::printf("Usage: %s [OPTIONS]...\n", prog_name);
std::printf(" -h, --help Print this help message and exit.\n");
std::printf(" -c, --clean Cleans the generated files.\n");
std::exit(EXIT_FAILURE);
}

int main(void)
{
long seed = utils_roll_seed();
Expand Down
2 changes: 0 additions & 2 deletions src/maze-puzzle.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <cassert>

#include "./include/maze-puzzle.h"
#include "./include/puzzle.h"
#include "./include/utils.h"
Expand Down
2 changes: 1 addition & 1 deletion src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int utils_rng_roll(int min, int max, long seed)
return utils_rng_roll(max, min, seed);
}

return rand() % (max - min) + min;
return rand() % (max - min + 1) + min;
}

int utils_roll_seed(void)
Expand Down

0 comments on commit a9b3a7f

Please sign in to comment.