🎆

Happy New Year

Week 1

Welcome to 2026! For this first challenge, the objective is to create some fireworks - you could extend this by creating a growing ASCII art animation, but for this challenge, some static output is all that's required

Consider the following procedure calls and their output:

fireworks(1)

-

fireworks(3)

\|/
---
/|\

fireworks(5)

\ | /
 \|/
-----
 /|\
/ | \

fireworks(7)

\  |  /
 \ | /
  \|/
-------
  /|\
 / | \
/  |  \

Your job is to create a procedure to continue this pattern and paste the result for the call fireworks(99) below:

Since this is the first week, it will be used to calibrate the appropriate level of difficulty - hints will be given on the following days:

Hints

Hints will be released at the start of each of the following days - e.g. the start of day 3 is 48 hours after the challenge starts

Release Day Hint
2 If you want to solve this efficiently, you can loop through and generate one line at a time - using a 2D array approach will be easier, but significantly slower especially for even larger fireworks (e.g. for a 999x999 firework)
3 You can break the firework into the left, middle and right sections horizontally. Likewise, you can break it into the top, middle and bottom sections vertically. Think of how to calculate the middle position - for example, if we consider the columns as being indexed 0-6 in a 7x7 firework, the middle column is index 3, while if you want to index from 1-7, the middle column would be index 4
4 Decompose the challenge and look at the output - notice how the offset of the left '\' increases by 1 each row, while the offset of the '/' decreases by 1 each row (we can add an offset from the left to get the '\' position...and subtract the offset from the right to get the '/' position
5 For the vertical sections (top - '\' is on the left; middle row of hyphens '-'; bottom - '/' is on the left), you might wish to create some if...else (if) conditions to handle each section appropriately
6 If going for the easier (but significantly slower for large output sizes) 2D array approach, you can either fill the 4 lines in separate or a single loop - e.g. '|' and '-' can be achieved by populating the middle column and row respectively, while '\' is when the row index = column index and the '/' can be achieved by incrementing the column and decrementing the row, or if you have reached a cell where row + col === gridSize - 1
1 2026