From dd513813c8871eccf563a1f5ee7edff0ec80ecc3 Mon Sep 17 00:00:00 2001 From: oumaimafisaoui Date: Sun, 21 Jul 2024 20:09:18 +0100 Subject: [PATCH] Docs(DPxAI): Add subject for Quest00 Ex05 --- subjects/DPxAI/glance-on-power/README.md | 83 ++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 subjects/DPxAI/glance-on-power/README.md diff --git a/subjects/DPxAI/glance-on-power/README.md b/subjects/DPxAI/glance-on-power/README.md new file mode 100644 index 000000000..df93a02b3 --- /dev/null +++ b/subjects/DPxAI/glance-on-power/README.md @@ -0,0 +1,83 @@ +## Glance on Power + +> Brainpower mode + +### Context + +Bravo! You've successfully brought the shape of your robot friend into existence. Now, it's time to take the next exciting step and start building the power to bring your robot to life. Yes, it's time to start thinking like a coder, builder! Using JavaScript, you'll be able to add dynamic abilities and interactions to your creation. Get ready to breathe life into your robot friend! + +> The platform includes a code editor, giving you an interface to write, test, and submit your exercises. + +Ready to start collecting your power through learning to code? Let's start, time is against us! + +### Concepts + +#### Values + +In the coding world, values are like the energy sources that power your robot. There are three types of values that can model the **WORLD**! _(In the end, it's all `1`s and `0`s for the computer)_, but for us, **humans**, we need an easier way of representing things. + +> We can all agree that `11010001100101110110011011001101111` is not a very friendly way to say `'hello'`! + +#### Numbers 🔢 + +Numbers are like the vital stats of your robot: + +- Whole numbers: `1`, `23`, `232139283` +- Negative numbers are prefixed with `-`: `-1`, `-1231` +- Decimal numbers: `3.14`, `-2.53343`, etc. + +Use them for _quantities_ like in daily life. + +#### Booleans ✖️ / ✔️ + +Booleans are the simple true/false logic gates for your robot: + +- Something is `true` +- or `false` + +They represent a truth, an answer to a closed-ended question _(anything that can be answered with yes or no)_: + +- Is the robot's battery full? `true` +- Is the robot currently charging? `false` +- Can the robot see an obstacle? `true` _(most likely)_ + +#### Strings 🆒 + +Strings are the commands and messages your robot can use: + +- `'Activate'` +- `'Hello, human!'` + +A string is a sequence of characters used to represent text. It needs **delimiters** to define its _beginning_ and _end_. Delimiters are matching quotes, either `` ` ``, `"`, or `'`. + +### Using `console.log` + +To display output from a script into a console, use the function `console.log`: + +```js +console.log(); // <- will show an empty line +``` + +Add any value between the parentheses to see it appear when the script is executed. + +It is very important to use this often to validate that our code is working correctly. The more it is tested, the easier it is to understand what's going on in the code! + +In doubt, `console.log` everything, don't be shy, they are free. + +### Instructions + +To do this exercise, use the code editor on the right side of your window. In the `hello-there.js` file, code a program that displays: + +- The exact text `Hello There!` +- Any `Number` (like the robot's serial number) +- And a `Boolean` (indicating if the robot's sensors are active) + +Don't forget to test your code before submitting it, using the `Run` button. + +### Recommendation + +Videos designed to give **hints** are assigned to each quest. It is strongly suggested to watch them as you go. + +### Ressources + +- [Introduction to JavaScript](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps)