Skip to content

Commit 30fc7c2

Browse files
committed
Add the "christmas-trees" hole
Updates #3
1 parent 48b3862 commit 30fc7c2

File tree

4 files changed

+82
-10
lines changed

4 files changed

+82
-10
lines changed

routes/answers.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,61 @@ Take one down and pass it around, no more bottles of beer on the wall.
300300
301301
No more bottles of beer on the wall, no more bottles of beer.
302302
Go to the store and buy some more, 99 bottles of beer on the wall.`,
303+
"christmas-trees": ` *
304+
***
305+
*****
306+
*
307+
308+
*
309+
***
310+
*****
311+
*******
312+
*
313+
314+
*
315+
***
316+
*****
317+
*******
318+
*********
319+
*
320+
321+
*
322+
***
323+
*****
324+
*******
325+
*********
326+
***********
327+
*
328+
329+
*
330+
***
331+
*****
332+
*******
333+
*********
334+
***********
335+
*************
336+
*
337+
338+
*
339+
***
340+
*****
341+
*******
342+
*********
343+
***********
344+
*************
345+
***************
346+
*
347+
348+
*
349+
***
350+
*****
351+
*******
352+
*********
353+
***********
354+
*************
355+
***************
356+
*****************
357+
*`,
303358
"emirp-numbers": `13
304359
17
305360
31

routes/hole.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ import (
1010
var preambles = map[string]string{
1111
"99-bottles-of-beer": `<h1>99 Bottles of Beer</h1><p>Print the lyrics to the song 99 Bottles of Beer.</p>`,
1212
"arabic-to-roman": `<h1>Arabic to Roman</h1><p>For each arabic numeral argument print the same number in roman numerals.</p>`,
13+
"christmas-trees": `<h1>Christmas Trees</h1><p>Print a size ascending range of Christmas trees using asterisks, ranging from size <b>3</b> to size <b>9</b>, each tree separated by a blank line.<p>A size <b>3</b> tree should look like this, with a single centered asterisk for the trunk:<pre> *
14+
***
15+
*****
16+
*</pre><p>With the largest size <b>9</b> tree looking like this:<pre> *
17+
***
18+
*****
19+
*******
20+
*********
21+
***********
22+
*************
23+
***************
24+
*****************
25+
*</pre>`,
1326
"emirp-numbers": `<h1>Emirp Numbers</h1><p>An emirp (prime spelled backwards) is a prime number that results in a different prime when its decimal digits are reversed. For example both <b>13</b> and <b>31</b> are emirps.</p><p>Print all the emirp numbers from <b>1</b> to <b>1000</b> inclusive, each on their own line.</p>`,
1427
"evil-numbers": `<h1>Evil Numbers</h1><p>An evil number is a non-negative number that has an even number of 1s in its binary expansion.<p>Print all the evil numbers from <b>0</b> to <b>50</b> inclusive, each on their own line.<p>Numbers that are not evil are called <a href=odious-numbers>odious numbers</a>.</p>`,
1528
"fibonacci": `<h1>Fibonacci</h1><p>Print the first <b>31</b> Fibonacci numbers from <b>F<sub>0</sub> = 0</b> to <b>F<sub>30</sub> = 832040</b> (inclusive), each on a separate line.</p>`,

routes/home.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,17 @@ func home(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
6464
WHEN 'prime-numbers' THEN 8
6565
WHEN 'quine' THEN 9
6666
WHEN '99-bottles-of-beer' THEN 10
67-
WHEN 'pangram-grep' THEN 11
68-
WHEN 'seven-segment' THEN 12
69-
WHEN 'sierpiński-triangle' THEN 13
70-
WHEN 'π' THEN 14
71-
WHEN 'φ' THEN 15
72-
WHEN '𝑒' THEN 16
73-
WHEN 'τ' THEN 17
74-
WHEN 'arabic-to-roman' THEN 18
75-
WHEN 'roman-to-arabic' THEN 19
76-
WHEN 'spelling-numbers' THEN 20
67+
WHEN 'christmas-trees' THEN 11
68+
WHEN 'pangram-grep' THEN 12
69+
WHEN 'seven-segment' THEN 13
70+
WHEN 'sierpiński-triangle' THEN 14
71+
WHEN 'π' THEN 15
72+
WHEN 'φ' THEN 16
73+
WHEN '𝑒' THEN 17
74+
WHEN 'τ' THEN 18
75+
WHEN 'arabic-to-roman' THEN 19
76+
WHEN 'roman-to-arabic' THEN 20
77+
WHEN 'spelling-numbers' THEN 21
7778
END, row_number`,
7879
printHeader(w, r, 200),
7980
)
@@ -133,6 +134,8 @@ func home(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
133134
w.Write([]byte(`Medium><a href=99-bottles-of-beer>99 Bottles of Beer`))
134135
case "arabic-to-roman":
135136
w.Write([]byte(`Slow><a href=arabic-to-roman>Arabic to Roman`))
137+
case "christmas-trees":
138+
w.Write([]byte(`Medium><a href=christmas-trees>Christmas Trees`))
136139
case "emirp-numbers":
137140
w.Write([]byte(`Fast><a href=emirp-numbers>Emirp Numbers`))
138141
case "evil-numbers":

routes/scores.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var holes = [][]string{
1212
{"all", "All Holes"},
1313
{"99-bottles-of-beer", "99 Bottles of Beer"},
1414
{"arabic-to-roman", "Arabic to Roman"},
15+
{"christmas-trees", "Christmas Trees"},
1516
{"emirp-numbers", "Emirp Numbers"},
1617
{"evil-numbers", "Evil Numbers"},
1718
{"fibonacci", "Fibonacci"},

0 commit comments

Comments
 (0)