+ WCF
+
+
+
+
+
+ {/* fullscreen background element that you can click to close when it's open */}
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/content/communitySolutions/1/dalurness.md b/src/content/communitySolutions/1/dalurness.md
new file mode 100644
index 0000000..a747592
--- /dev/null
+++ b/src/content/communitySolutions/1/dalurness.md
@@ -0,0 +1,23 @@
+---
+descriptions: ["elixir", "I did another language too!", "and another!"]
+---
+```elixir
+writeString = case File.read("../letters.txt") do
+ {:ok, body} -> body
+ {:error, _reason} -> IO.puts("failed to get file")
+end
+|> String.split(" ", trim: true)
+|> Enum.reduce(Map.new(), fn code, acc -> case Map.has_key?(acc, String.to_integer(code)) do
+ false -> Map.put(acc, String.to_integer(code), 1)
+ true -> {_old, newMap} = Map.get_and_update!(acc, String.to_integer(code), fn current_value ->
+ {current_value, current_value + 1}
+ end)
+ newMap
+ end
+end)
+|> Enum.sort_by(fn {k,v} -> {v,k} end, :desc)
+|> Enum.reduce("", fn {k, v}, acc -> acc <> Integer.to_string(k) <> ": " <> Integer.to_string(v) <> "\n" end)
+
+{:ok, file} = File.open("output.txt", [:write])
+IO.binwrite(file, writeString)
+```
\ No newline at end of file
diff --git a/src/content/communitySolutions/2/dalurness.md b/src/content/communitySolutions/2/dalurness.md
new file mode 100644
index 0000000..4d6657a
--- /dev/null
+++ b/src/content/communitySolutions/2/dalurness.md
@@ -0,0 +1,29 @@
+---
+descriptions: ["python"]
+---
+```python
+lowercase = "abcdefghijklmnopqrstuvwxyz"
+full_alpha = [l for l in lowercase] + [l.upper() for l in lowercase]
+
+decode_map = {f"{full_alpha.index(l):02}": l for l in full_alpha}
+
+writefile = open("output.txt", "w", encoding="utf8")
+readfile = open("../small_message_encoded.txt", encoding="utf8")
+data = readfile.read()
+
+i = 0
+while i < len(data):
+ if data[i] == '\\':
+ # handle backslashes
+ if data[i + 1] == '\\':
+ writefile.write('\\')
+ else:
+ code = data[i+1] + data[i+2]
+ writefile.write(decode_map.get(code))
+ i = i + 2
+ else:
+ writefile.write(data[i])
+ i = i + 1
+readfile.close()
+writefile.close()
+```
\ No newline at end of file
diff --git a/src/content/config.ts b/src/content/config.ts
index 503ea7b..10a61af 100644
--- a/src/content/config.ts
+++ b/src/content/config.ts
@@ -7,6 +7,14 @@ const daysCollection = defineCollection({
}),
});
+const communitySolutionsCollection = defineCollection({
+ type: "content",
+ schema: z.object({
+ descriptions: z.array(z.string()),
+ }),
+})
+
export const collections = {
days: daysCollection,
+ communitySolutions: communitySolutionsCollection,
};
diff --git a/src/content/days/1.md b/src/content/days/1.md
index 4e5b074..d59fd85 100644
--- a/src/content/days/1.md
+++ b/src/content/days/1.md
@@ -1,6 +1,5 @@
---
-title: "Counting Santa's Letters"
-
+title: "That's a Lot of Letters"
---
Do you have any idea how many letters Santa gets each year before Christmas? Millions of people around the world send letters to Santa every year letting him know what they would like for Christmas. However, the logistics of not only reading those letters, but estimating labor, ordering materials, storing products, and loading up presents at the appropriate time in an efficient order requires a lot of planning.
diff --git a/src/content/days/2.md b/src/content/days/2.md
index 4d2f7b8..729b1c4 100644
--- a/src/content/days/2.md
+++ b/src/content/days/2.md
@@ -1,25 +1,15 @@
---
title: "Counting Santa's Letters"
-resultComponent: "Day2"
---
-Do you have any idea how many letters Santa gets each year before Christmas? Millions of people around the world send letters to Santa every year letting him know what they would like for Christmas. However, the logistics of not only reading those letters, but estimating labor, ordering materials, storing products, and loading up presents at the appropriate time in an efficient order requires a lot of planning.
+To help keep things efficient at the North Pole, Santa uses a text intercom system to pass messages. But right now that system is bugging out! It isn't correctly decoding messages!
-**Problem**: In order to prepare for this Christmas season, some of the head elves would like a report on how many letters are coming from each country. The elves physically receiving the letters have been inputting the country code of the letter into a file named *"letters.txt"*. You need to read this file, and then report how many letters have been sent from each country.
+**Problem**: Create a decoder for the following encoding scheme:
-**Challeng**: A *"letters_challenge.txt"* has also been included if you'd like some extra credit. There is a lot more data in this file, so it may need to be handled a bit differently so as not to overload your memory. (Note: github has limitations on file size. Feel free to use the python script to make a larger file).
+- Alphabetical characters are encoded as a 2 digit number with a prepended "**\\**"
+- **a - z** are encoded as **00 - 25**
+- **A - Z** are encoded as **26 - 51**
+- A "**\\**" is escaped with "**\\\\**"
+- Any other characters are left as is (the system Santa uses was made by elves, they hate latin characters so they encoded them)
-**Example**:
-Input:
-```
-1 2 34 53 1 53 6
-```
-
-Output:
-```
-1: 2
-2: 1
-6: 1
-34: 1
-53: 2
-```
+There are two files: [*"small_message_encoded.txt"*](./small_message_encoded.txt), which you can test on, and [*"large_message_encoded.txt"*](./large_message_encoded.txt), which you should also decode and then share if you can hear "it" to prove you completed the challenge.
diff --git a/src/layouts/Day.astro b/src/layouts/Day.astro
index 2f83f08..4bb0a57 100644
--- a/src/layouts/Day.astro
+++ b/src/layouts/Day.astro
@@ -3,65 +3,43 @@ interface Props {
day: number;
title: string;
resultComponent: string;
+ solutionList: {
+ username: string;
+ descriptions: string[];
+ }[];
}
-import { MdCalendarMonth, MdEventBusy } from "react-icons/md";
-import Layout from "./Layout.astro";
import { DynamicSolution } from "../components/DynamicSolution";
-import { Calendar } from "../components/Calendar";
import { Link } from "../components/Link";
-
-const { BASE_URL } = import.meta.env;
-const { day, title, resultComponent } = Astro.props;
+import Question from "./Question.astro";
+const { day, title, resultComponent, solutionList } = Astro.props;
---
-
-
-