Skip to content

Commit fc27eba

Browse files
committed
added hints and fixed solutions link
1 parent 6b81301 commit fc27eba

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/Discussions.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</h3>
4040
<h3 style="color: red;">
4141
I hear and I forget. I see and I remember. I do and I understand. -
42-
Confucius - Confucius
42+
Confucius
4343
</h3>
4444
<!-- <div class="giscus">
4545
<div class="giscus-frame" />

src/data.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -236,22 +236,19 @@ function pick_random_el(arr: any[]) {
236236
function exercise_from_filenames() {
237237
// TODO: make this an object with youtube links
238238
// NOTE: DO NOT INCLUDE _STARTER.RKT OR _SOLUTION.RKT
239-
let filenames = [
240-
"4.0-less-than-5",
241-
"5.0-string-first",
242-
"5.1-string-last",
243-
"5.2-string-rest",
244-
"5.3-string-remove-last",
245-
"5.4-formalize",
246-
];
247-
return filenames.map((item) => {
248-
let dash_index = item.indexOf("-");
249-
let problem_number = parseFloat(item.slice(0, dash_index));
250-
let problem_name = item.slice(dash_index + 1).replace("_starter.rkt", "");
239+
let files = [{"hints":["<","string-length"],"name":"4.0-less-than-5"},{"hints":["substring"],"name":"5.0-string-first"},{"hints":["string-append","substring"],"name":"5.1-pig-latin"},{"hints":["substring","sub1","string-length"],"name":"5.1-string-last"},{"hints":["substring","string-length"],"name":"5.2-string-rest"},{"hints":["if","zero?","string-length","substring","sub1"],"name":"5.3-string-remove-last"},{"hints":["substring","string-length","string-append","string-upcase"],"name":"5.4-formalize"},{"hints":["and",">=","<="],"name":"5.5-teenager"},{"hints":["or",">="],"name":"5.6-can-ride"},{"hints":["substring","and","=","string-length","not","string=?","or"],"name":"5.7-sf-local"},{"hints":["if",">","string-length","string-append","substring"],"name":"5.8-TLDR"}];
240+
241+
return files.map((item) => {
242+
let name = item.name;
243+
let dash_index = name.indexOf("-");
244+
let problem_number = parseFloat(name.slice(0, dash_index));
245+
let problem_name = name.slice(dash_index + 1).replace("_starter.rkt", "");
246+
let solution_url = `https://howtocode.pages.dev/solutions/${name}_solution.rkt`;
251247
return new ProblemSet(problem_name, problem_number, undefined, [new Problem("submission",
252-
`<h1>⬇️<a href="https://howtocode.pages.dev/starter/${item}_starter.rkt" download>Download the starter file</a></h1>
253-
<h1>✅<a href="https://howtocode.pages.dev/starter/${item}_solution.rkt" download>Download the solution file</a></h1>`, "")],
254-
[{url_title: "Solution", url: `https://howtocode.pages.dev/solutions/${item.replace("_starter.rkt", "_solution.rkt")}`, additional: ""}])
248+
`<h1>⬇️<a href="https://howtocode.pages.dev/starter/${name}_starter.rkt" download>Download the starter file</a></h1>
249+
<details><summary>HINTS</summary><code>${item.hints.reduce((prev, curr) => prev + " " + curr)}</code></details>
250+
<h1>✅<a href=${solution_url} download>Download the solution file</a></h1>`, "")],
251+
[{url_title: "Solution", url: `${solution_url}`, additional: ""}])
255252
});
256253
}
257254

0 commit comments

Comments
 (0)