diff --git a/astro.config.mjs b/astro.config.mjs index 3c30fa88..0de61a45 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -181,7 +181,12 @@ export default defineConfig({ }, { label: "Activities", - link: "book/part-0-getting-started/3-building-programs/3-explore", + collapsed: true, + autogenerate: { + directory: + "book/part-0-getting-started/3-building-programs/3-explore", + collapsed: true, + }, }, ], }, diff --git a/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore.md b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-1-hello-with-worlds.md similarity index 99% rename from src/content/docs/book/part-0-getting-started/3-building-programs/3-explore.md rename to src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-1-hello-with-worlds.md index 994e7c41..a94490a0 100644 --- a/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore.md +++ b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-1-hello-with-worlds.md @@ -1,5 +1,5 @@ --- -title: Go Exploring +title: Hello with Worlds --- :::tip diff --git a/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-2-test-knowledge.md b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-2-test-knowledge.md new file mode 100644 index 00000000..a2a95249 --- /dev/null +++ b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-2-test-knowledge.md @@ -0,0 +1,8 @@ +--- +title: Test your knowledge +--- + +Having explored this leg of the journey you are now approaching a rest stop and a chance to practice and reflect. Test what you have learnt by creating one or more of the following programs: + +- [Simple Writing](/book/part-0-getting-started/3-building-programs/3-explore/3-3-classic-quote/) using the terminal. +- [Simple Drawing](/book/part-0-getting-started/3-building-programs/3-explore/3-4-paint-me/) using the Splashkit library. diff --git a/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-3-classic-quote.md b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-3-classic-quote.md new file mode 100644 index 00000000..b43204b2 --- /dev/null +++ b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-3-classic-quote.md @@ -0,0 +1,28 @@ +--- +title: Simple Writing +sidebar: + label: " - The Power of Words" +--- + + +Write a tiny terminal application that simply greets the user and prints the opening line of your favourite book + +```txt +Welcome to the classic-quote generator! + +“It was a bright cold day in April, and the clocks were striking thirteen.” + +``` + +Or, Level‑up by presenting the greeting inside a very simple terminal‑based user interface — think of those chunky boxes you see in retro command‑line tools. Use a classic sci‑fi computer quote for the salutation. Example shown with HAL 9000 from 2001: A Space Odyssey. + +```txt ++--------------------------------------------------+ +| | +| Good evening, Dave. I’m HAL 9000. | +| "I’m sorry, Dave. I’m afraid I can’t do that." | +| | ++--------------------------------------------------+ +``` + +Stick to the commands and concepts we’ve already covered (e.g., WriteLine / print equivalents). Avoid extra prompts or calculations—keep it truly minimal. diff --git a/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-4-paint-me.md b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-4-paint-me.md new file mode 100644 index 00000000..eb70a592 --- /dev/null +++ b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/3-4-paint-me.md @@ -0,0 +1,18 @@ +--- +title: Simple Drawing +sidebar: + label: " - A Picture Worth 1000 Words" +--- + + +Write/modify a Splashkit application that draws a simple picture + +![An example picture or a smiling face](./images/smile.png) + +Follow the [Graphical Hello world](/book/part-0-getting-started/3-building-programs/1-tour/2-hello-world-gui) guide +and play around with adding or removing the shapes, to see if you can make something truly original. + +:::tip +Don't worry if it seems like magic for now, with time we will decipher what all of those "magic numbers" are... +Just have a play, and enjoy being able to create shapes +::: \ No newline at end of file diff --git a/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/images/smile.png b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/images/smile.png new file mode 100644 index 00000000..e4c1fab9 Binary files /dev/null and b/src/content/docs/book/part-0-getting-started/3-building-programs/3-explore/images/smile.png differ diff --git a/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-0-explore.mdx b/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-0-explore.mdx index d5b5da09..51541928 100644 --- a/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-0-explore.mdx +++ b/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-0-explore.mdx @@ -8,3 +8,5 @@ Having explored this leg of the journey you are now approaching a rest stop and - A [saving targets calculator](/book/part-1-instructions/1-sequence-and-data/3-explore/03-1-calculator). - A [music player](/book/part-1-instructions/1-sequence-and-data/3-explore/03-2-media-player) to load and play audio. - [Draw a scene](/book/part-1-instructions/1-sequence-and-data/3-explore/03-3-drawing) using SplashKit graphics. +- [Track your energy](/book/part-1-instructions/1-sequence-and-data/3-explore/03-4-energy-score) to get a daily energy rating +- [Draw a dashboard](/book/part-1-instructions/1-sequence-and-data/3-explore/03-5-solar-visualiser) to track home power usage diff --git a/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-4-energy-score.md b/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-4-energy-score.md new file mode 100644 index 00000000..2223b855 --- /dev/null +++ b/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-4-energy-score.md @@ -0,0 +1,38 @@ +--- +title: Daily Energy Score +sidebar: + label: " - Daily Energy Score" +--- + +:::tip +Use this task to explore how simple numbers and sequences can form the basis of more meaningful feedback tools. You can use the suggested energy formula below, or create your own variation based on a different domain (e.g. athletic recovery, study focus, game performance). +::: + +We can use sequence and data to simulate a basic wellbeing tool that calculates a daily “energy score” based on several lifestyle factors. This program will ask the user to enter scores from 1–10 for a few different areas, then calculate an overall energy level and display a summary message. + + +```txt +Welcome to your Daily Energy Score + +Rate your sleep quality (1–10): 7 +Rate your mental focus (1–10): 5 +Rate your physical activity (1–10): 6 +Rate your stress level (1–10): 3 + +Your energy score is: 25 out of 40 +That’s 62.5% +``` + +You can use this approach to calculate the final result: + +```txt +score = sleep + focus + activity + (10 - stress) +``` + +and + +```txt +percentage = (score / 40.0) * 100 +``` + +Or use an appropriate formula from your field! \ No newline at end of file diff --git a/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-5-solar-visualiser.md b/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-5-solar-visualiser.md new file mode 100644 index 00000000..c2bcded3 --- /dev/null +++ b/src/content/docs/book/part-1-instructions/1-sequence-and-data/3-explore/03-5-solar-visualiser.md @@ -0,0 +1,74 @@ +--- +title: Solar Visualiser +sidebar: + label: " - Solar Visualiser" +--- + +For this task you can build on the ideas from the [house drawing](/book/part-1-instructions/1-sequence-and-data/1-tour/02-00-house-drawing) tour. You may also find it useful to read about [drawing in SplashKit](/book/part-1-instructions/1-sequence-and-data/2-trailside/11-2-graphics/#drawing-to-a-window) and [playing sound effects in SplashKit](/book/part-1-instructions/1-sequence-and-data/2-trailside/11-3-audio) for this task. + +For this task, you will create a simple **solar panel visualiser** that helps the user understand how much of their power use is covered by solar over the course of a year. You will display a basic bar chart showing: + +- Monthly electricity **usage** +- Monthly **solar production** +- Any **shortfall** that needs to be purchased from the grid + +This is a great example of how data and visual feedback can be combined into a clear, useful display using just basic shapes and colour. + +--- + +### 🧮 How it works + +The user will input: +- Their **monthly electricity usage** in kilowatt hours (kWh) +- The **size of their solar system** in kW + +Your program will then: + +- Simulate monthly solar output using a seasonal efficiency curve (approximate Melbourne values): + +```txt +Jan = 1.0 (100%) +Feb = 0.95 +Mar = 0.85 +Apr = 0.75 +May = 0.60 +Jun = 0.50 +Jul = 0.50 +Aug = 0.60 +Sep = 0.75 +Oct = 0.85 +Nov = 0.95 +Dec = 1.0 +``` + +- Multiply the solar size by the monthly efficiency and an average output factor (e.g. 4.0 kWh per kW per day × days in month) to get total production +- Compare solar vs usage +- Draw three bars for each month: +- **Blue bar** for usage +- **Green bar** for solar output +- **Red bar** only if solar < usage (i.e. unmet demand) + +### ✏️ Example + +```txt +Welcome to the Solar Visualiser + +Enter your average monthly power usage (kWh): 600 +Enter your solar system size (kW): 5 + +Drawing results... +``` + +A window should then open showing 12 months as columns. Each column will have: + +- A blue rectangle showing usage +- A green rectangle showing solar output +- A red rectangle on top if the user needs to buy extra energy + +Make sure you draw at least 3 types of shapes and use calculated values from the user input and seasonal efficiency. + +:::caution + +Don't focus too much on making it pretty! The key learning here is sequence and data. + +:::