The following DNS records should be configured in your domain's [zone file](https://en.wikipedia.org/wiki/Zone_file) or through the web interface of your dns provider/domain registrar.
- A _domain/subdomain_ pointing to the public IP address (using `A Record`) of your [dedicated server](server-requirements.md).
- A _subdomain_ called `git` pointing to the above mentioned *domain/subdomain* (using `CNAME Record`) or it's IP address (using `A Record`).
One domain and one subdomain must point to the IP address of a [dedicated server](server-requirements.md).
Your newly configured DNS records should look like this:
| FQDN | Record type | Address |
| -------------- | ----------- | ------- |
| ((DOMAIN)) | A | X.X.X.X |
| git.((DOMAIN)) | A | X.X.X.X |
| FQDN | Record type | Target |
| -------------- | ----------- | ------------- |
| ((DOMAIN)) | A | X.X.X.X |
| git.((DOMAIN)) | CNAME | ((DOMAIN)) |
## Network configuration
Here is an _example_ of the DNS records for the domain `example.org` with the public IP address of `93.184.216.34`:
5. Then select "**Continue**" and follow the on-screen instructions.
## 🏁 Finishing up
Once the server is ready to be accessed remotely, please let us know via approriate communication channels and we will proceed with configuring the server.
--> Please let us know when the server's remote access is ready and we will configure it.
Write a function that receives a string and returns a slice with the ASCII values of its characters. If the string is empty it should return an empty slice.
In this exercise you will create a data model of blood types and an API to deal with them.
First, we'll implement the data representation of the blood types.
Start by copying the data representation of the blood types:
Take a look at the `BloodType` struct below. It contains two enums which enable us to describe a blood type (e.g. "A-").
- Create the enum `Antigen` that has 4 possibilities: A, B, O and AB And the enum `RhFactor` that has two possible values: Positive and Negative
- `Antigen`: which can be one of:
- `A`
- `B`
- `AB`
- `O`
- `RhFactor`: which can be one of:
- `Positive`
- `Negative`
- After, copy the struct `BloodType` that contains two fields with the names antigen and rh_factor
To provide a simple way to create blood types, implement the trait `FromStr` for `BloodType`. This will allow us to use the `parse` method and `from_str`, so we can do:
- To provide a simple way to create blood types implement the trait FromStr for BloodType (which will allow us to use the `parse` method and the associated function from_str, so we can do:
```rust
let a_neg: BloodType = "A-".parse();
```
Implement the following Traits:
- `std::cmp::Ord`: to make possible to sort a vector or array of `BloodType`.
- `std::Debug`: for `BloodType`, allowing us print a vector such as `[BloodType { antigen: A, rh_factor: Positive}, BloodType{ antigen: B, rh_factor: Negative}]` as `"[ A+, A-]"` when using format strings `{:?}`.
- Implement the std::cmp::Ord trait to make possible to sort a vector or array of BloodType's
Create three methods for BloodType:
- `can_receive_from`: which returns `true` if `self` can receive blood from `other` blood type.
- `donors`: which returns all the blood types that can give blood to `self`.
- `recipients`: which returns all the blood types that can receive blood from `self`.
- Implement the trait std::Debug for BloodType allowing to print a vector such as [BloodType { antigen: A, rh_factor: Positive}, BloodType{ antigen: B, rh_factor: Negative}] as [ A+, A-] using the formatting {:?}
- Lastly, write three methods for BloodType:
- `can_receive_from`: which returns true if `self` can receive blood from `other` blood type
- `donors`: which returns all the blood types that can give blood to `self`
- `recipients`: which returns all the blood types that can receive blood from `self`
At a border crossing, you want to keep a list of all the vehicles that are waiting to enter the country. You intend to keep a waiting list of the vehicles, but the vehicles can be one of two types: `Car` or `Truck`.
- Create the trait Vehicle with the model and year
Create a function that receives a vector of structures that implements the `Vehicle` trait, and returns all the models.
- In a border cross you want to keep a list of all the vehicles that are waiting to enter the country. You want to keep a waiting list of the vehicle but the vehicles can be of two types: Car or Truck
- Create a function that receives a vector of structures that implements the Vehicle trait and returns all the models.
Create a **program** that takes an undefined number of command-line arguments. For each argument, if the expression is correctly bracketed, the program prints `OK` to the standard output followed by a newline (`'\n'`), otherwise it prints `Error` followed by a newline.
Write a `program` that takes an undefined number of `string` in arguments. For each argument, if the expression is correctly bracketed, the program prints on the standard output `OK` followed by a newline (`'\n'`), otherwise it prints `Error` followed by a newline.
All characters are ignored except for the following brackets:
- parentheses `(` and `)`.
- square brackets `[` and `]`.
- curly braces `{` and `}`.
Symbols considered as brackets are parentheses `(` and `)`, square brackets `[` and `]` and curly braces `{` and `}`. Every other symbols are simply ignored.
Opening brackets must only be closed by the corresponding closing bracket. For example, a curly brace cannot close a square bracket.
An opening bracket must always be closed by the good closing bracket in the correct order. A `string` which does not contain any bracket is considered as a correctly bracketed.
A `String` which does not contain any brackets is considered to be correctly bracketed.
If there is no argument, the program must print nothing.
If there are no arguments, the program must print nothing.
You'll need to get the command line arguments somehow, and this will get you started:
For receiving arguments from the command line you should use something like:
> Esoteric programming languages (esolang) are designed to test the boundaries of computer programming design, as proofs of concept, as software art, as a hacking interface or simply as a joke. One such esoteric language is `Brainfuck`. It was created by Urban Müller in 1993. It is a minimalist language consisting of 8 simple commands. It is Turing complete, but is not intended for practical use. It exists to amuse and challenge programmers.
### Instructions
Write a `Brainfuck` interpreter program.
The source code will be given as the first parameter, and will always be valid with fewer than 4096 operations.
Your `Brainfuck` interpreter will consist of an array of 2048 bytes, all initialized to 0, with a pointer to the first byte.
Every operator consists of a single character:
- `>`: increment the pointer.
- `<`: decrement the pointer.
- `+`: increment the pointed byte.
- `-`: decrement the pointed byte.
- `.`: print the pointed byte to the standard output.
- `[`: if the pointed byte is 0, then instead of moving onto the next command, skip to the command after the matching `]`.
- `]`: if the pointed byte is **not** 0, then instead of moving onto the next command, move back to the command after the matching `[`.
The source code will be given as first parameter.
The code will always be valid, with less than 4096 operations.
`Brainfuck` is a minimalist language. It consists of an array of bytes (in this exercice 2048 bytes) all initialized with zero, and with a pointer to its first byte.
Every operator consists of a single character :
- '>' increment the pointer
- '<' decrement the pointer
- '+' increment the pointed byte
- '-' decrement the pointed byte
- '.' print the pointed byte on standard output
- '[' go to the matching ']' if the pointed byte is 0 (loop start)
- ']' go to the matching '[' if the pointed byte is not 0 (loop end)
Today, your mission is to build a 3-column brick tower, maintain it and finally break it.
Today, your mission is to build a 3-column brick tower, maintain it and finally break it!
- Create a function `build` which will create and display the amount of bricks passed as argument:
- Create a function `build` which will create and display the given amount of bricks passed as argument:
- each brick has to be created as a `div` and added to the page at a regular interval of 100ms.
- each brick will receive a unique `id` property, like the following:
- each brick has to be created as a `div` and added to the page at a regular interval of 100ms,
- each brick will receive a unique `id` property, like following:
```html
<divid="brick-1"></div>
```
- each brick in the middle column has to be set with the custom data attribute `foundation`, receiving the value `true`.
- each brick in the middle column has to be set with the custom data attribute `foundation` receiving the value `true`
- Each one of the two emojis in the top-right corner fires a function on click:
- 🔨: triggers the function `repair`. Write the body of that function. It receives any number of `ids`. For each `id`, it retrieves the HTML element, and sets the `repaired` custom attribute to `in progress` if it is a brick situated in the middle column, and `true` if not.
- 🧨: triggers the `destroy` function. Erite the body of that function. It removes the current last brick in the tower.
- 🔨 triggers the function `repair`: write the body of that function, which receives any number of `ids`, and for each `id`, retrieves the HTML element and set a custom attribute `repaired` set to `in progress` if it is a brick situated in the middle column, and `true` if not
- 🧨 triggers the function `destroy`: write the body of that function, which removes the current last brick in the tower
You only need to create & submit the JS file `build-brick-and-break.js`, We're providing you the following file to download and test locally:
You only need to create & submit the JS file `build-brick-and-break.js` ; we're providing you the following file to download (click right and save link) & test locally:
- the HTML file [build-brick-and-break.html](./build-brick-and-break.html) can be opened in the browser, which includes:
- the JS script running some code, and which will enable you to run your code.
- some CSS pre-styled classes: feel free to use those as they are, or modify them.
- the HTML file [build-brick-and-break.html](./build-brick-and-break.html) to open in the browser, which includes:
- the JS script running some code, and which will also allow to run yours
- some CSS pre-styled classes: feel free to use those as they are, or modify them
### Expected result
You can see an example of the expected result [here](https://youtu.be/OjSP_7u9CZ4)
Implement [Chaikin's](http://graphics.cs.ucdavis.edu/education/CAGDNotes/Chaikins-Algorithm/Chaikins-Algorithm.html) algorithm as a step by step animation.
Implement the [Chaikin's](http://graphics.cs.ucdavis.edu/education/CAGDNotes/Chaikins-Algorithm/Chaikins-Algorithm.html) algorithm step by step in an animation.
You will create a canvas to enable the user to draw 1 or more points. The screen will then animate each step that is taken to obtain the final result of a drawn curve. The animation must play for 7 steps and then it must restart.
The objective is to create a canvas where the user will be able to draw 1 or more points on it, and then the screen will play an animation of each step that is taken to obtain the final result of a drawn curve. The animation must play for 7 steps and then it must restart.
You can see how the application should work [here](https://youtu.be/PbB2eKnA2QI).
It is mandatory to use the `Chaikin's` algorithm.
> Usage of Chaikin's algorithm is mandatory.
You can see how the application should work [here](https://youtu.be/PbB2eKnA2QI).
#### Functionality
- Functionality:
- The canvas must receive input from the mouse. The user must be able to use the left button to place control points for Chaikin's algorithm.
- The selected points must be visible on the canvas. You will need to draw a **small** circle surrounding each point.
- The canvas should receive input from the mouse:
- The user of the program should be able to use the left button to select the control point for the `Chaikin's` algorithm.
- The selected points must be visible in the canvas, so you will have to draw a small circle surrounding the selected points.
- If the canvas has control points drawn on it, then pressing `Enter` should start the animation. It should cycle through the steps until reaching the 7th step of `Chaikin's` algorithm. The animation should then restart.
- After pressing `Enter` the program should start the animation of the steps until reaching the 7th step of the `Chaikin's` algorithm. After the 7th step the program must restart.
- If the user presses `Enter` before any points have been drawn, then nothing should happen. It should still be possible to draw points. You may optionally choose to display a message to inform the user that they forgot to draw points.
- If the canvas only has only one control point, the program must only present that point and do no change at all.
- If the canvas only has only one control point, the program must only present that point and not cycle through the steps.
- If the canvas has only two control points, the program must draw a straight line.
- If the canvas has only two control points, the program must draw a straight line.
- Pressing `Escape` should quit the window.
- Pressing `Escape` should quit the window.
### Note
> You are free to use any library to create and handle windows, rendering, keyboard and mouse events.
You are free to use any library to create and handle windows, rendering, keyboard and mouse events.
### Bonus
- Make it possible to clear the screen, so that the user can select new control points.
- Add the ability to clear the screen and add new control points.
- Make it possible to drag the control points in real time.
Technology is a rapidly evolving sector. As a programmer, it is not always easy to keep up to date with every new advancement.
Tech news (like Hacker News) is a really great way to keep up to date with the exponential evolution of technology, as well as tech jobs and much more. Some websites do not offer very appealing propositions to consume their media.
Technology nowadays continue to evolve. As a programmer or developer you must be updated with this exponential evolution of technology.
So your objective for this raid is to create an UI for the [HackerNews API](https://github.com/HackerNews/API).
This is where tech news shines, just like Hacker News where you can see all about new technology, jobs and much more, but some websites do not perform very well or their are not so appealing.
So your objective for this raid is to create an UI for [`HackerNewsAPI`](https://github.com/HackerNews/API).
- [comments](https://github.com/HackerNews/API#items): each comment must have the proper post parent.
- [comments](https://github.com/HackerNews/API#items), each comment must have the proper post parent.
Post and comments must be ordered by newest post to oldest.
You must not load all posts at once, so that you only load posts once the users need to see more posts. This can be done with the help of [events](https://developer.mozilla.org/en-US/docs/Web/Events).
You must not load all posts at once. You must be able to load posts when ever the users need to see more posts. This can be done with the help of [event](https://developer.mozilla.org/en-US/docs/Web/Events).
[Live Data](https://github.com/HackerNews/API#live-data) : is one of the features from this Hacker News API, you can handle requests so that the news you provide are updated.
- You must have a section that present the newest information. You will have to notify the user at least every 5 seconds, whenever the live data is updated. In other words, after every 5 seconds if a change was made in the live data, you have to notify the user.
The point of the project is to keep users updated, so we'll need to inform our users of changes to the data using [Live Data](https://github.com/HackerNews/API#live-data). Create a section that presents the newest information. You'll need to notify the user at least every 5 seconds, whenever the live data is updated.
Currently this API does not present [rate limit](https://en.wikipedia.org/wiki/Rate_limiting). But that does not mean you should abuse/overload the API!!!
Currently this API does not present a [rate limit](https://en.wikipedia.org/wiki/Rate_limiting), but that does not mean that you should abuse or overload the API.
Best ways you can avoid rate limiting :
Best ways you can avoid rate limiting:
- optimize your code to eliminate any unnecessary requests
- usage of a throttling/debouncing function to regulate the number of requests,
- usage of throttling/debouncing function to regulates the amount of requests
### Optional
You can handle sub-comments for stories, jobs and polls, by implementing nested comments.
You can handle sub-comments for each stories, jobs and polls this meaning nested comments
In this exercise, you will be provided with a json file `commits.json` with data corresponding to git commits in GitHub (extracted using the GitHub rest API). Your objective is to extract the relevant data and place it in a struct called `CommitData`.
In this exercise you will be provided with a json file `commits.json` with data corresponding to git commits in GitHub (extracted using the GitHub rest API). Your objective is to extract the relevant data and place it in a struct called `CommitData` to get the following information:
1. Number of commits per author (identified by the GitHub login).
2. The number of commits per author.
Create two functions:
- `commits_per_author`: which returns a hash map with the number of commits per author. The auditors will be identified by their GitHub login.
- `commits_per_week`: which returns a hash map with the number of commits per week.
> A week is represented by the a year followed by the number of the week. For example, January 1, 2020 is in week 1 of 2020 and will be represented by a `String` with the form `"2020-W1"`.
- `commits_per_author`: which returns a hash map with the number of commits per author.
- `commits_per_date`: which returns a hash map with the number of commits per week.
- Note: A week is represented by the a year followed by the number of the
week. For example, January 1, 2020 is in week 1 of 2020 and will be
You're going to create some curry functions, to apply to the object's entries.
This exercise consists in creating curry functions to apply in the object's entries.
You will have to create the following curry functions:
Create `defaultCurry`, which curries two objects. It mergers the objects together. If the key exists in both objects, the value from the second object override the value from the first object.
- `defaultCurry` curries two objects in which the second object overrides the values of the first. If the key is not present then add it with the corresponding value.
Create `reduceCurry`, which replicates the `.reduce` method (but fro an object). The first entry is the function, and the second is the object and initial value).
- `reduceCurry` replicates function `.reduce`, where first entry is function, second is (object, initial value).
Define the function `delete_prefix` which returns the string slice `s` with the `prefix` removed. It should be wrapped in `Some`. If `prefix` is not a prefix of `s`, then `delete_prefix` returns `None`.
Define the function `delete_prefix(prefix, s)` which returns the string slice `s` with the `prefix` removed wrapped in `Some`. If `prefix` is not a prefix of `s`it returns `None`.
Define the `Table` struct below, and implement the associated functions `new` and `add_row`. You can see how they should work from the usage.
- Implement the `std::fmt::Display` trait for the structure table so that the table is printed like in the **[Usage](#usage)**. The length of each column must adjust to the longest element of the column and the element must be centered in the "cell" when possible. If the length of the element does not allow to center exactly, it must be offset slightly to the left.
Implement the `std::fmt::Display` trait for the `Table` structure so that the table is printed like in the usage. The length of each column must adjust to the longest element of the column, and the element must be centered in the "cell" when possible. If the element cannot be centred exactly, it must be positioned slightly to the left.
- Note: If the table is empty (does not have a header), `println!` must not print anything.
If the table is empty `println!` must not print anything.
- Define the associated function `new` which creates a new empty table.
- Define the method function `add_row` which adds a new row to the table created from a slice of strings.
> Interior mutability is a design pattern in Rust that allows you to mutate data even when there are immutable references to that data.
"Interior mutability is a design pattern in Rust that allows you to mutate data even when there are immutable references to that data"
In this exercise, you will create a Drop Checker API.
in this exercise a Drop checker API has to be created. For this you must define:
Define the following structures:
- Two structures:
- `Workers` that will have two fields:
- `drops` that will save the number of dropped threads.
- `states` that will save a state of multiple threads.
If the thread is not dropped, the state will be false otherwise true.
- `Thread` that will have the following fields:
- `pid`, the id of the thread.
- `cmd`, the name of the thread.
- `parent`, that will be the link to the structure `Workers` (Tip: this must be a reference to the structure Workers)
- `Workers`: containing:
- `drops`: that will save the number of dropped threads.
- `states`: that will save the state of multiple threads. If the thread is not dropped, the state will be `false`, and will be `true` otherwise.
- `Thread`: containing:
- `pid`: the id of the thread.
- `cmd`: the name of the thread.
- `parent`: a link to the structure `Workers`. (Tip: this should be a reference).
- Implementation of each structure:state
You'll need to also add the following associated functions to the structures:
- `Workers` :
- `Workers` :
- `new`: that creates a default worker.
- `new_worker`: that returns a tuple with the `pid` and a new `Thread`. This function must receive a `String` representing the `cmd`.
- `is_dropped`: that receives a `pid` and returns a `bool` that indicates the state of the thread.
- `track_worker`: which returns a `usize` representing the length of the `states` vector. (The index of the next new thread).
- `add_drop`: which is **called by the `Drop` trait**. It will receive a `pid` that will be used to change the state of the thread. If the state of that thread is `true` then it will panic with the message `"X is already dropped"`, where `X` represents the `pid`). Otherwise it should change the state to `true` and increment the `drops` field by 1.
- `new`, that creates a default worker
- `new_worker`, that returns a tuple with the `pid` and a new `Thread`,
this function must receive a `String` being the `cmd`
- `is_dropped`, that receives a `pid` and returns a `bool` that indicates the state of the thread by using the `pid`
- `track_worker`, it should return a `usize`, that will be the last available index of the `states` vector, being the new next thread
- `add_drop`, this function must be **called by the `Drop` trait**. It will receive a `pid` that will be used to change the
state of the thread. If the state of that thread is `true` then it will panic with the message ("Cannot drop {}, because its already dropped", pid).
Otherwise it should change the state to true and increment the `drops` field by one.
- `Thread`:
- `new_thread`: that initializes a new thread.
- `skill`: that drops the thread.
- `Thread`:
- `new_thread`, that initializes a new thread
- `skill`, that drops the thread
- You must implement the `Drop` trait for the `Thread` structure. In this trait you must call the function `add_drop` so that the state of the thread changes.
- You must implement for the structure `Thread` the `Drop` trait. In this trait you must call the function `add_drop` so that the state of the thread changes
You have to design a notification system for a platform.
Depending on the type of event, your event handler will control the size, color and position of the notification.
Create a method named `notify` which returns a `Notification` with the following characteristics for each of:
- `Remainder(text)`:
- `size`: `50`
- `color`: `(50, 50, 50)`
- `position`: `Bottom`
- `content`: the `text` associated to the enum variant
- `Registration(chrono::Duration)`:
- `size`: `30`
- `color`: `(255, 2, 22)`
- `position`: `Top`
- `content`: `"You have {duration} left before the registration ends"`
- `Appointment(text)`:
- `size`: `100`
- `color`: `(200, 200, 3)`
- `position`: `Center`
- `content`: `text associated to the value`
- `Holiday`:
- `size`: `25`
- `color`: `(0, 255, 0)`
- `position`: `Top`
- `content`: `"Enjoy your holiday"`
`duration` must be displayed in the form of `{hours}H:{minutes}M:{seconds}S`. The time will represent the remaining time before the event starts. For example, if there are 13 hours, 38 minutes and 14 seconds left, then the content will be `"You have 13H:38M:14S left before the registration ends"`
Implement the `std::fmt::Display` trait so the text of the notifications are printed in the right color in the command line.
These events can be: Remainders, Registrations, Appointments or Holidays.
- Create an event handler that, depending on the type of event, creates different notifications with different colors, different sizes and different positions
- The possible positions are Top, Bottom and Center: Create and Enum `Position` with those values
- Create a method called `notify` which returns a notification with the following caracteristics for each
- Remainder:
size= 50,
color= (50, 50, 50),
position= Bottom,
content= the slice associated to the enum value
- Registration(chrono::Duration),
size = 30,
color = (255, 2, 22),
position = Top,
content = "You have `duration` left before the registration ends",
`durations` must be displayed in the form of {hours}:{minutes}:{seconds} left for the beginning of the event for example if there is two hours 32 minutes and 3 seconds left before the registration then the content will be `You have 2:32:2 left before the registration ends`
- Appointment(text)
size: 100
color: (200, 200, 3)
position: Center
content: text associated to the value
- Holiday
size: 25
color: (0, 255, 0)
position: Top
content: "Enjoy your holiday"
- Implement the std::fmt::Display trait so the text of the notification is printed in the right color in the command line
You've been asked to freshen up a webpage, by displaying shades of cold colors.
You've been asked to freshen a webpage atmosphere by displaying shades of cold colors.
Check the `colors` array provided in the data file below.
Write the `generateClasses` function. It creates a `<style>` tag inside the `<head>`. It should generate one class for each color in the `colors` array, which sets the `background` attribute like so:
- Write the `generateClasses` function which creates a `<style>` tag in the `<head>` tag and generates, for each color of `colors`, a class setting the `background` attribute and taking the color as value, like following:
```css
.blue {
@ -14,32 +14,33 @@ Write the `generateClasses` function. It creates a `<style>` tag inside the `<he
}
```
Write the `generateColdShades` function which creates a `<div>` for each color of the `colors` array, whose name contains `aqua`, `blue`, `turquoise`, `green`, `cyan`, `navy` or `purple`. Each `<div>` must have the corresponding generated class and display the name of the color, like following:
- Write the `generateColdShades` function which creates a `<div>` for each color of the `colors` array whose name contains `aqua`, `blue`, `turquoise`, `green`, `cyan`, `navy` or `purple`.\
Each `<div>` must have the corresponding generated class and display the name of the color, like following:
```html
<divclass="blue">blue</div>
```
The function `choseShade` is triggered when clicking on a `div`. Write the body of this function. It accepts the shade of the clicked element as an argument, and replaces all the classes of all the other elements by the chosen shade.
- The function `choseShade` is triggered when clicking on a `div`.\
Write the body of this function, which receives the shade of the clicked element as argument, and replaces all the other elements class by the chosen shade.
You only need to create & submit the JS file `fifty-shades-of-cold.js`, we're providing you the following files to download and test locally:
You only need to create & submit the JS file `fifty-shades-of-cold.js` ; we're providing you the following files to download (click right and save link) & test locally:
- the HTML file [fifty-shades-of-cold.html](./fifty-shades-of-cold.html) to open in the browser, which includes:
- the JS script running some code, and which will enable you to run yours
- some CSS pre-styled classes: feel free to use those as they are, or modify them.
- the JS script running some code, and which will also allow to run yours
- some CSS pre-styled classes: feel free to use those as they are, or modify them
- the data file [fifty-shades-of-cold.data.js](./fifty-shades-of-cold.data.js) from which you can import `colors`.
- the data file [fifty-shades-of-cold.data.js](./fifty-shades-of-cold.data.js) from which you can import `colors`
### Expected result
You can see an example of the expected result [here](https://youtu.be/a-3JDEvW-Qg)
- Define the associated functions for the `Table` struct:
- Define the **functions**:
- `new`: which creates a new empty table.
- `add_rows`: which adds a new row to the table from a slice of strings.
- `filter_cols`: which receives a closure and returns a table with all the columns that yielded true when applying that closure. The closure will receive a `&str` and return a `bool` value.
- `filter_rows`: which receives a closure and returns a table with all the rows that yielded true when applied to the elements of the selected column. The closure will receive a `&str` and return a `bool` value.
Create the `flatten_tree`**function** which receives a `std::collections::BTreeSet` and returns a new `Vec` with the elements of the binary tree in order.
- Define the functions `flatten_tree` which receives a `std::collections::BTreeSet` and returns a new `Vec` with the elements of the binary tree in order.
You've been given the task of finding the main architect of the Tower of Pisa before he achieves his plans; avoiding all those lame pictures of people pretending to stop it from falling.
You've been attributed the task to find the main architect of the Tower of Pisa before he achieves his plans, avoiding us nowadays all those lame pictures of people pretending to stop it from falling.
You arrive at the architects' chamber, but all you have in front of you is a bunch of unknown people.
You arrive at the architects' chamber to find him, but all you have in front of you is a bunch of unknown people.
Step by step, with the little information you have, gather information and figure out by elimination who he is.
Step by step, gather information and figure out by elimination who he is.
Launch the provided HTML file in the browser to begin your investigation.<br/>
On top of the webpage, each of the four buttons fires a function:
Launch the provided HTML file in the browser to begin your investigation.
- Write the body of the `getArchitects` function, which returns an array containing 2 arrays of HTML elements:
At the top of the webpage, each of the four buttons fires a function:
- the first array contains the architects, all corresponding to a `<a>` tag
- the second array contains all the non-architects people
Complete the body of the following functions. The first three functions return an array containing two arrays of HTML elements:
- Write the body of the `getClassical` function, which returns an array containing 2 arrays of HTML elements:
- `getArchitects`:
- 1st array: the architects, all corresponding to a `<a>` tag.
- 2nd array: all the non-architects.
- the first array contains the architects belonging to the `classical` class
- the second array contains the non-classical architects
- `getClassical`:
- 1st array: the architects belonging to the `classical` class.
- 2nd array: the non-classical architects.
- Write the body of the `getActive` function, which returns an array containing 2 arrays of HTML elements:
- `getActive`:
- 1st array: the classical architects who are `active` in their class.
- 2nd array: the non-active classical architects.
- the first array contains the classical architects who are `active` in their class
- the second array contains the non-active classical architects
The last function is `getBonannoPisano`. It returns an array containing:
- the HTML element of the architect you're looking for, whose `id` is `BonannoPisano`.
- an array containing all the remaining HTML elements of active classical architects.
- Write the body of the `getBonannoPisano` function, which returns an array containing:
- the HTML element of the architect you're looking for, whose `id` is `BonannoPisano`
- an array which contains all the remaining HTML elements of active classical architects
> From now on, don't forget to [**export**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) all the expected functions, so that they can be imported to be tested.
```js
export const getArchitects = () => {...}
```
### Files
> From now on, don't forget to [**export**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) all the expected functions, so that they can be imported to be tested<br/> > `export const getArchitects = () => {...}`
You only need to create & submit the JS file `get-them-all.js`. We're providing you the following files to download. You may test them locally:
### Notions
- the HTML file [get-them-all.html](./get-them-all.html) to open in the browser, which includes:
- ...and bit of CSS that could help with the [`:not` pseudo class](https://developer.mozilla.org/en-US/docs/Web/CSS/:not)
- the JS script running some code, and which will allow you to run your code.
- some CSS pre-styled classes: feel free to use those as they are, or modify them.
- an import of the data.
### Files
- the data file [get-them-all.data.js](./get-them-all.data.js) used to generate content in the HTML.
You only need to create & submit the JS file `get-them-all.js` ; we're providing you the following files to download (click right and save link) & test locally:
### Notions
- the HTML file [get-them-all.html](./get-them-all.html) to open in the browser, which includes:
Good information is the pillar of society, that's why you've decided to dedicate your time to reveal the powerful truth to the world and deliver essential and strong news: you're launching a gossip grid.
Create the function `grid` which displays all the `gossips`, provided in the data file below, as cards on a grid (in the same order).
They must be `div` with the `gossip` class.
The first `gossip` card must be a `form` with a `textarea` and a submit button with the text `Share gossip!` that allows to add a new gossip to the list.
They will each be represented as a `div` with the `gossip` class.
Create 3 `type="range"` inputs with the class `range`, all wrapped in a `div` with the class `ranges`:
The first `gossip` card must be a `form`. It will need a `textarea`, and a submit button with the text `"Share gossip!"`. It will add new gossip to the list.
- one with `id="width"` that control the width of cards _(from 200 to 800 pixels)_
- one with `id="fontSize"` that control the font size _(from 20 to 40 pixels)_
- one with `id="background"` that control the background lightness _(from 20% to 75%)_
Create 3 `type="range"` inputs with the class `range`, all wrapped in a `div` with the class `ranges`.
- `id="width"`: that controls the width of cards from 200 to 800 pixels.
- `id="fontSize"`: that controls the font size from 20 to 40 pixels.
- `id="background"`: that control the background lightness from 20% to 75%.
You only need to create & submit the JS file `gossip-grid.js`; we're providing you the following files to download and test locally:
You only need to create & submit the JS file `gossip-grid.js`; we're providing you the following files to download (click right and save link) & test locally:
- the HTML file [gossip-grid.html](./gossip-grid.html) to open in the browser, which includes:
- the JS script which will enable you to run your code.
- some CSS pre-styled classes: feel free to use those as they are, or modify them.
- the JS script which will allow to run your code
- some CSS pre-styled classes: feel free to use those as they are, or modify them
- the data file [gossip-grid.data.js](./gossip-grid.data.js) from which you can import `gossips`.
- the data file [gossip-grid.data.js](./gossip-grid.data.js) from which you can import `gossips`
### Expected result
You can see an example of the expected result [here](https://youtu.be/nbR2eHBqTxU)
Create a function named: `gougleSearch` that takes a single query argument (`q`). It must invoke `queryServers` concurrently on 3 servers:
- `"web"`
- `"image"`
- `"video"`
Create a `gougleSearch` function that takes a single query argument.
It must call `queryServers` in concurrently on 3 servers:
`'web'`, `'image'` and `'video'`.
A timeout of 80milliseconds must be set for the whole operation.
You must return the value from each server in an object using the server name as key.
You must return the value from each server in an object
using the server name as key.
A timeout of 80milliseconds must be set for the whole operation, if it is not complete within 80 milliseconds, then you must return `Error('timeout')`.
Being stuck at home, bored, desperate and coming up with a lot of weird ideas, a friend asks you to develop a tool to measure his ocular skills. One of those [Monoyer charts](https://en.wikipedia.org/wiki/Monoyer_chart) that ophthalmologists use.
Being stuck at home, bored, desperate and coming up with a lot of weird ideas, a friend asks you to develop a tool to measure his ocular skills: one of those [Monoyer charts](https://en.wikipedia.org/wiki/Monoyer_chart) that ophthalmologists use.
Generate a board where each new letter is harder, bigger, bolder and stronger.
Generate a board where each new letter is harder, bigger, bolder and stronger!
Write the function `generateLetters` which creates 120 `div` elements, each containing a letter randomly picked through the **uppercase** alphabet, and whose style properties have to be increased:
- each letter's `font-size` has to grow from `11` to `130` pixels.
- `font-weight` has to be `300` for the first third of the letters, `400` for the second third, and `600` for the last third.
Write the function `generateLetters` which creates 120 `div`, each containing a letter randomly picked through the **uppercase** alphabet, and whose style properties have to be increased:
- each letter `font-size` has to grow from `11` to `130` pixels
- `font-weight` has to be `300` for the first third of the letters, `400` for the second third, and `600` for the last third
### Files
You only need to create & submit the JS file `harder-bigger-bolder-stronger.js`. We're providing you the following file to download and test locally:
You only need to create & submit the JS file `harder-bigger-bolder-stronger.js` ; we're providing you the following file to download (click right and save link) & test locally:
- the HTML file [harder-bigger-bolder-stronger.html](./harder-bigger-bolder-stronger.html) to open in the browser, which includes:
- the JS script running some code, and which will enable you to run yours.
- some CSS pre-styled classes: feel free to use those as they are, or modify them.
- the JS script running some code, and which will also allow to run yours
- some CSS pre-styled classes: feel free to use those as they are, or modify them
Create a function named `interpolation` that takes an object with 5 properties: `step`, `start`, `end`, `callback` and `duration`.
Create a function called `interpolation` that takes an object with 5 properties
`step`, `start`, `end`, `callback` and `duration`.
This function must calculate the interpolation points, (x, y),
from the `start` position to `end` position depending on the number of steps.
All the points must be calculated in the duration time.
This function must interpolate points from the `start` position to the `end` position (not including the `end` position). The number of points depends on the number of steps.
For each interpolation point, you must call the `callback` function with an array of the two points `[x, y]`:
- `x`: distance
- `y`: point
There should be a delay between each `callback` invocation; of `duration / step`, so that the final call happens after `duration`.
For each interpolation point you must call `callback` function with parameter - interpolation point ([x, y]).
Each interpolation point should be calculated with interval of `duration / step`.
Create a function named `isWinner` which accepts a string representing the name of a country. It should use the `winners`_"API"_ to return a resolved `Promise` with an appropriate string.
Create a function `isWinner` that, by making use of `winners` "API", should
return a resolved Promise with the string:
The strings which can be returned are listed below. You'll need to replace `"Country"` with the country named which is passed to `isWinner`:
- `<country> + ' never was a winner'`, if the country passed in `isWinner` has never won the FIFA World Cup
- `"Country never was a winner"`: The country has never won a FIFA world cup.
- `<country> + ' is not what we are looking for because of the continent'`,
if the country passed in `isWinner` is not from the european
continent
- `"Country is not what we are looking for because of the continent"`: The country is not from the european continent.
- `<country> + ' is not what we are looking for because of the number of times it was champion'`, if the country passed in `isWinner` was champion
less than 3 times
- `"Country is not what we are looking for because of the number of times it was champion"`: The country won the FIFA world cup fewer than 3 times.
- `<country> + ' won the FIFA World Cup in ' + <year(s)> + 'winning by ' + <results>`, otherwise.
- `"Country won the FIFA World Cup in <years> winning by <results>"`: with the following format:
- `<years>`: `"1000, 1004, 1008"`
- `<results>`: `"4-3, 5-2, 1-0"`
The years and results should be displayed like bellow:
```<country> + ' won the FIFA World Cup in 1000, 1004, 1008 winning by 4-3, 5-2, 1-0```
### Code provided
> The provided code will be added to your solution, and does not need to be submitted.
> all code provided will be added to your solution and doesn't need to be submitted.
Create a `retry` function, that takes 2 arguments:
Create a `retry` function, that takes 2 arguments
- `count`: indicates maximum number of retries.
- `callback`: an `async` function that will be invoked for every attempt.
- a `count` indicates maximum amount of retries
- an async `callback`, that will be called on every try
`retry` returns a function that invokes the `callback` function. That function passes its arguments to `callback`, and returns the value from `callback`.
`retry` returns a function that calls and returns value from `callback`
function passing its arguments and catches errors. If error is caught it
should return the `callback` function with catch. If number of errors
exceeds `count` then throw an `Error`.
The function returned by `retry` must `catch` errors from `callback`. After that function has caught `count` errors, it must `throw` an `Error`.
> for count of 3, the function will be called at most 4 times:
> the initial call + 3 retries.
> if `count` is 3, `callback` will be invoked at most 4 times, the initial call plus 3 retries.
Create a `timeout` function, that takes 2 arguments
Create function named `timeout`, that takes 2 arguments:
- a `delay` indicates maximum wait time
- an async `callback`, that will be called
- `delay`: indicates maximum wait time.
- `callback`: an asynchronous function that will be invoked.
`timeout` returns a function that invokes and returns the value from `callback`. The function must pass its arguments to `callback`. If `callback` does not resolve before `delay`, your function returns `Error('timeout')`.
`timeout` returns a function either that calls and returns value from `callback`
function passing its arguments or returns `Error('timeout')` if `callback` didn't
Like an inspired Beethoven who's about to write his Moonlight Sonata, you're about to compose a colorful symphony of letters with your keyboard.
Like an inspired Beethoven who's going to write his Moonlight Sonata, you're about to compose a colourful symphony of letters with your keyboard.
Write the function `compose`:
- Make it fire every time a key is pressed.
- Create a new `div` with the class `note` when a letter of the lowercase alphabet is pressed. It should have a unique background color generated using the `key` of the `event`. It should also displays the corresponding pressed character.
- When `Backspace` is pressed, delete the last note.
- When `Escape` is pressed, clear all the notes.
- Make it fire every time a key is pressed
- Create a new `div` with the class `note` when a letter of the lowercase alphabet is pressed, which has a unique background color generated using the `key` of the `event`, and displays the corresponding letter pressed
- If the pressed key is the `Backspace` one, delete the last note
- If the pressed key is the `Escape` one, clear all the notes
You only need to create & submit the JS file `keycodes-symphony.js`; we're providing you the following file to download to test locally:
You only need to create & submit the JS file `keycodes-symphony.js`; we're providing you the following file to download (click right and save link) & test locally:
- the HTML file [keycodes-symphony.html](./keycodes-symphony.html) to open in the browser, which includes:
- the JS script which will allow to run your code.
- some CSS pre-styled classes: feel free to use those as they are, or modify them.
- the JS script which will allow to run your code
- some CSS pre-styled classes: feel free to use those as they are, or modify them
### Expected result
You can see an example of the expected result [here](https://youtu.be/5DdijwBnpAk)
Define a `Scalar` trait which implements the operations `Add`, `Sub`, `Mul`, `Div` and any other restrictions you may need. Use a trait inheritance (supertraits)
Define a `Scalar` trait which must implement the operations Addition, Subtraction, Multiplication and Division (you might also have to use more restrictions). For this use a trait inheritance (supertraits)
Another condition for a number to be a scalar is to have a `zero` (as the neutral element in the addition), and a `one` (as the neutral element in the multiplication). Therefore the `Scalar` trait will require these two functions (described below).
Another condition for a number to be a scalar is to have a zero (neutral element in the addition) and a one (neutral element in the multiplication). Therefore the `Scalar` trait will require 2 functions zero() and one() (as shown)
After finishing completing the declaration of the trait, implement the `Scalar` trait for `u32`, `u64`, `i32`, `i64`, `f32` and `f64`.
After finishing completing the declaration of the trait, implement the `Scalar` trait for u32, u64, i32, i64, f32 and f64.
You will need to create an *API*, so that a program can organize a queue of people.
You will need to create an *API* which will organize a queue of people, so that a program can organize a queue of people.
The program requires the following functions. Add them as associated functions to the `Queue` structure:
The program requires the following functionsAdd the following associated functions to the `Queue` structure:
- `new`: which will initialize the `Queue`.
- `add`: which adds a person to the queue.
- `add`: which receives a person's information, to add them to the `Queue`.
- `invert_queue`: which reverses the queue.
- `rm`: which removes the person who finished ordering their food. The removal should respect the FIFO method (first in first out). It should return the person's details.
- `search`: which returns the details for a given person's `name`.
- `rm`: which will remove the person who finished ordering their food. The removal should respect the FIFO method (first in first out. The function should return the removed person.
The removal should respect a FIFO system (first in first out). This function should return a tuple wrapped in an `Option` with the information of the removed person (check the usage)
- `search`: which returns a tuple with the information of a given person `id`
You must also create a type named `Link`. This will be the connection of the structures `Queue` and `Person`. This will be a recursion type, and must point to `None` if there is no `Person` to point to.
You must also create a type called `Link`. This will be the connection of the structures `Queue` and `Person`.
Do not forget that this will be a recursion type and it must point to `None` if there is no persons.
Create 3 functions which work like the `.filter`, `.map` and `.reduce` array methods, but for the **entries** in the grocery cart.
Finish your groceries!!!
- `filterEntries`: filters using both key and value.
- `mapEntries`: changes the key, the value or both.
- `reduceEntries`: reduces the entries.
Create 3 functions that works like the `.filter`, `.map` and `.reduce` array method but for the entries of the grocery cart.
Create 3 additional functions that use your previously created functions:
- `filterEntries` filters using both key and value.
- `mapEntries` changes either the key or the value or both.
- `reduceEntries` reduce over entries.
- `totalCalories`: that will return the total calories of a cart.
- `lowCarbs`: that leaves only those items which are lower than 50grams.
- `cartTotal`: that will give you the right amount of calories, proteins... and **all the other** items in your grocery cart.
Create 3 other functions that use your previously create functions:
> Think about the shape of `Object.entries()`
- `totalCalories` that will return the total calories of a cart
- `lowCarbs` that will leave only items that total carbs are lower than 50grams
- `cartTotal` that will give you the right amount of calories, proteins, ..., of all items in your grocery cart.
### Clarification
What the functions will take as argument is an object cart which contains the food rations. All the nutrition in the nutritionDB object are measured per 100 grams.
Create 3 functions that works like the `.filter`, `.map` and `.reduce` array methods, but for the **keys** of your grocery cart. You can see their names and how they work in the examples.
Create 3 functions that works like the `.filter`, `.map` and `.reduce` array method but for the keys of your grocery cart.
- `filterKeys` filters the name of the items you have.
- `mapKeys` changes the name of the items you have.
You have a grocery cart with some items you need. The item's name is the `key`, and the `value` will represent nutrition facts per 100 grams.
You have a grocery cart with some items you need.
The items will have a `key` being the name and a `value` that is the amount in grams.
Create 3 functions that work like the `.filter`, `.map` and `.reduce` array methods, for the values in your grocery cart object. You can see their function names and how they work in the examples.
Create 3 functions that works like the `.filter`, `.map` and `.reduce` array method but for the values of your grocery cart.
- `filterValues` filters the values of your grocery cart.
- `mapValues` changes the values of your grocery cart.
For the above function the callback function should accepts only the element in the arguments, this being the current element being processed.
- `reduceValues` that will reduce your grocery cart. The callback function should accepts only the **accumulated value** and the **current value**.
Define a data structure to represent a matrix of any size and implement some basic operations.
Define a data structure to represent a matrix of any size and implement the basic operations for this. The next steps need to be followed:
We will consider a matrix as a rectangular arrangements of scalars. You can represent this as a 2 dimensional vector`. You will use the definition of scalars from the [lalgebra_scalar](../lalgebra_scalar/README.md) exercise.
- You can use a 2 dimensional Vec<T>'s. We will consider a matrix as a rectangular arrangements of scalars.
Implement the following associated functions:
- `new`: which returns a matrix of size `1 x 1`.
- `identity`: which returns the identity matrix of size n.
- `zero`: which returns a matrix of size `row` x `col` with all the positions filled by zeros.
- You have to use the definition of scalars done in the exercise: `lalgebra_scalar`
- Define `new` that returns a matrix of size `1 x 1`
- Then define the associated function `identity` that returns the identity matrix of size n
- Finally, define the associated function `zero` that returns a matrix of size `row x col` with all the positions filled by zeros
Use the Matrix struct given in the [expected struct](#expected-functions-and-struct) and implement the `std::fmt::Display` trait so it prints the matrix like in the [usage](#usage).
You will need to create the `new` associated function which initializes the struct.
You will also need to implement the `std::fmt::Display` trait, so that it prints like the example in the usage.
The associated function `new` that creates a matrix from a slice of slices also has to be implemented.
In this exercise, you will define some basic matrix operations, Implement traits for `Add` and `Sub`
In this exercise you will define the basic operations with a matrix starting by implementing the `std::ops::Add` trait
Remember that two matrices can only be added or subtracted if they have they have the same dimensions. Therefore, you must handle the possibility of failure by returning an `Option<T>`.
Define the operation + (by defining the trait std::ops::Add) for two matrices. Remember that two matrices can only be added if they have the same size. Therefore the add method must handle the possibility of failure by returning an Option<T>.
You will be reusing your `Matrix` and `Scalar`structures defined in the [matrix](../matrix/README.md) and [lalgebra_scalar](../lalgebra_scalar/README.md) exercises.
You will be using your own`Matrix` and `Scalar`defined in the `matrix` and the `lalgebra_scalar` exercises.
### Expected Function
@ -28,7 +28,7 @@ impl Sub for Matrix {
Here is a program to test your function
```rust
use matrix::*;
use matrix_ops::*;
fn main() {
let matrix = Matrix(vec![vec![8, 1], vec![9, 1]]);
Develop a trap to capture the elements when the mouse is getting too close to the center of the page.
Develop a trap to capture the elements when the mouse is getting too close to the center of the page!
Create the following functions:
- `createCircle`: make it fire on every click on the page, and create a `div` at the position of the mouse on the screen, setting its `background` to `white` and its class to `circle`.
- Create a function `createCircle`: make it fire on every click on the page, and create a `div` at the position of the mouse on the screen, setting its `background` to `white` and its class to `circle`
- `moveCircle`: make it fire when the mouse moves, and get the last circle created and makes it move along with the mouse.
- Create a function `moveCircle`: make it fire when the mouse moves, and get the last circle created and makes it move along with the mouse
- `setBox`: which creates a box with the class `box` in the center of the page. When a circle is inside that box, it has to be purple (use the CSS global variable `var(--purple)` as its `background`). Once a circle enters the box, it is trapped inside and cannot escape.
- Create a function `setBox` which sets a box with the class `box` in the center of the page ; when a circle is inside that box, it has to be purple (use the CSS global variable `var(--purple)` as `background`) ; once a circle enters the box, it is trapped inside and cannot go out of it anymore.
> Hint: Be careful, a circle cannot overlap the box which has walls of `1px`. It has to be trapped **strictly** inside.
> Hint: Be careful, a circle cannot overlap the box which has walls of `1px`, it has to be trapped **strictly** inside.
You only need to create & submit the JS file `mouse-trap.js`; we're providing you the following file to download and test locally:
You only need to create & submit the JS file `mouse-trap.js`; we're providing you the following file to download (click right and save link) & test locally:
- the HTML file [mouse-trap.html](./mouse-trap.html) to open in the browser, which includes:
- the JS script which will enable you to run your code.
- some CSS pre-styled classes: feel free to use those as they are, or modify them.
- the JS script which will allow to run your code
- some CSS pre-styled classes: feel free to use those as they are, or modify them
### Expected result
You can see an example of the expected result [here](https://youtu.be/qF843P-V2Yw)
Create a function named `neuron`, that enables your AI/bot to learn to mutate data into a more usable shape. You can see how it works from the example.
Create a function called `neuron` that allows your AI/bot to learn how to data shape a given
dataset into an object so that it can better navigate the data.
Today, you're going to create your own color picker.
Today, you're gonna create your own color picker.
Write the function `pick` which turns the screen into a `hsl` color picker. It will vary the `hue` and `luminosity` according to the position of the mouse.
Write the function `pick` which turns the screen into a `hsl` color picker, varying the `hue` and `luminosity` of according to the position of the mouse, which:
The `background` color of the `body` will change based on the position of the mouse on the screen.
- The X axis will vary the hue value between 0 and 360.
- The Y axis will vary the luminosity value between 0 and 100.
- changes the `background` color of the `body`, so the `hsl` value is different on each mouse position on the screen:
- on the axis X, the hue value has to vary between 0 and 360
- on the axis Y, the luminosity value has to vary between 0 and 100
- displays those 3 values using the `text` class:
- the full `hsl` value in a `div` with the class `hsl` in the middle of the screen
- the `hue` value in a `div` with the class `hue` in the top right corner of the screen
- the `luminosity` value in a `div` with the class `luminosity` in the bottom left corner of the screen
- copies that value in the clipboard on click
- displays two SVG lines, with respective ids `axisX` and `axisY`, following the cursor like so:
- the axisX has to set the attributes `x1` and `x2` to the mouse X position
- the axisY has to set the attributes `y1` and `y2` to the mouse Y position
You'll need to display these three values:
- The full `hsl` value in a `div`, which has the class `hsl` in the middle of the screen.
- The `hue` value in a `div` with the class `hue` in the top right corner of the screen.
- The `luminosity` value will be displayed in the bottom left corner of the screen, in a `div` with the class `luminosity`.
> Here is how a hsl value is formatted: `hsl(45, 50%, 35%)`
When the mouse is clicked, the value of the `hsl` will need to copied to the clipboard.
> Use `Math.round()` to round the values
Two SVG lines with ids `axisX` and `axisY` will need to follow the cursor, like really long cross hairs.
- the `axisX` attributes `x1` and `x2` need to be set to the X position of the cursor.
- the `axisY` attributes `y1` and `y2` need to be set to the Y position of the cursor.
> The formatting of a `hsl` value: `hsl(45, 50%, 35%)`.
- Take a look at the [HSL section](https://developer.mozilla.org/en-US/docs/Web/HTML/Applying_color)
### Files
You only need to create & submit the JS file `pick-and-click.js`; we're providing you the following file to download and test locally:
You only need to create & submit the JS file `pick-and-click.js`; we're providing you the following file to download (click right and save link) & test locally:
- the HTML file [pick-and-click.html](./pick-and-click.html) to open in the browser, which includes:
- the JS script which will enable you to run your code.
- some CSS pre-styled classes: feel free to use those as they are, or modify them.
- the JS script which will allow to run your code
- some CSS pre-styled classes: feel free to use those as they are, or modify them
### Expected result
You can see an example of the expected result [here](https://www.youtube.com/watch?v=eE4eE9_eKZI)
Create two functions which taken an object and a string or array of strings. They should return a new object which:
- `pick`: contains only those keys which appear in the string or array of strings.
- `omit`: contains only those keys which do not match the string, or do not appear in the array of strings.
Create a `pick` function that takes an object and a string or array of strings.
This function returns a new object that contains only the key/value pairs, whose key matches with the string or a string in the array, from the object passed as an argument.
Create a `omit` function that takes an object and a string or array of strings.
This function returns a new object that contains only the key/value pairs, whose key doesn't match with the string or a single string in the array, from the object passed as an argument.
> Those functions are pure and must not modify the given object
You only need to create & submit the JS file `pimp-my-style.js`. Ee're providing you the following files to download and test locally.:
You only need to create & submit the JS file `pimp-my-style.js` ; we're providing you the following files to download (click right and save link) &test locally:
- the HTML file [pimp-my-style.html](./pimp-my-style.html) to open in the browser, which includes:
- the JS script running some code, and which will enable you to run yours.
- some CSS pre-styled classes: feel free to use those as they are, or modify them.
- the data file [pimp-my-style.data.js](./pimp-my-style.data.js) from which you can import `styles`.
- the JS script running some code, and which will also allow to run yours
- some CSS pre-styled classes: feel free to use those as they are, or modify them
- the data file [pimp-my-style.data.js](./pimp-my-style.data.js) from which you can import `styles`
### Expected result
You can see an example of the expected result [here](https://youtu.be/VIRf3TBDTN4)
Create a function named `pronoun` that accepts a string parameter.
This function returns an object that will have all the personal pronouns, present in the string, as keys. Each key will have a sub object with the first word after each of the personal pronouns found in the string.
You must also a `count` property to the sub object, with the amount of occurrences of the pronoun.
Pronouns:
- i
- you
- he
- she
- it
- they
- we
Create a function called `pronoun` that has a string as parameter. This function returns an object
that will have all the personal pronouns, present in the string, as keys. Each key will have a sub object with the
first word after each of the personal pronouns found in the string.
Also, a property `count` must be added, to the sub object, with the amount of occurrences of the pronoun.
- `some`: that takes an `array` of promises or values, and `count` number. It should return the first `count` resolved values. Empty arrays or a `count` of 0 return a promise resolving to `undefined`.
Create a function `race` that works like `Promise.race`
Create a function `some` that takes an `array` of promises or values
and `N` number. It should return the first `N` resolved values.
> Empty array or a count of 0 return a promise resolving to `undefined`
Create a module named `messenger`. This module will be able to inform a user of how many references of a given value they are using.
Create a module called `messenger`. This module will be able to inform a user of how many references of a given value he is using.
The main objective of this module is to limit how many times a value is referenced.
For this module the following must be created:
Implement `Logger`: a trait which implements the following three functions:
- A trait `Logger` which implements three functions: `warning`, `info`, `error`. All **functions** should receive a reference to themselves and a string literal.
```rust
fn warning(&self, msg: &str);
fn info(&self, msg: &str);
fn error(&self, msg: &str);
fn warning(&self, msg: &str);
fn info(&self, msg: &str);
fn error(&self, msg: &str);
```
Implement the `Tracker` structure with the following fields:
- A structure called `Tracker`, which must have the fields: `logger` being a reference to the `Logger`, `value` being the count of how many times the value was referenced,
`max` being the max count of references the actual value can achieve.
- `logger`: a reference to `Logger`.
- `value`: the count of how many times the value was referenced. It should not exceed `max`.
- `max`: the max count of references.
Add the following associated functions to `Tracker`:
- `new`: that initializes the structure.
- `set_value`: that sets the `value`. It should compare the number of references to `value` and `max` to work out the percentage used. It should write to the following traits if it exceeds the specified usage percentage:
- percentage >= 100%: `"Error: you are over your quota!"` should be written to `error`.
- percentage >= 70% and percentage <100%:`"Warning: you have used up over X% of your quota! Proceeds with precaution"`shouldbewrittento`warning`,where`X`shouldbereplacedwiththecalculatedpercentage.
- `peek`: that will take a peek at how much usage the variable already has. It should write `"Info: you are using up to X% of your quota"` to the `info` trait function. `X` should be replaced with the calculated percentage.
- An implementation of three functions that are associated to the `Tracker` structure:
- `new` that will initialize the structure
- `set_value` that sets the value to the `Tracker` structure and writes to the trait functions. This should be done comparing the **max** and the number of referenced of the actual value.
If the percentage is equal or greater to 100% of the limit usage, it should write **"Error: you are over your quota!"** to the `error` function
If the percentage is equal or greater to 70% of the limit usage, it should write **("Warning: you have used up over {}% of your quota! Proceeds with precaution", <calculated_percentage>)** to the `warning` function
- `peek` that will take a peek of how much usage the variable already has. It should write **("Info: you are using up too {}% of your quote", <calculated_percentage>)** to the `info` function
### Second part (lib.rs)
Now that you've created `messenger`, you can now create the following:
Create the `Worker` structure with the following fields:
Afterwards you must use the module `messenger` and create the following:
- `track_value`: which is the value that will be tracked by the tracker.
- `mapped_messages`: that will store the latest messages from the `Logger` trait functions. This will be a HashMap. The key will represent the type of message (`info`, `error` or `warning`), and the value will be the actual message.
- `all_messages`: that will be a vector of **all** messages sent.
- A structure `Worker` that has the fields:
- `track_value` this will be the value that will be tracked by the tracker.
- `mapped_messages` that will have the latest messages. This must be a HashMap with the key being the type of message
sent by the logger (info, error or warning) and the value being the message
- `all_messages` that will be a vector of all messages sent.
- A `new` function that initializes the structure `Worker`
- To use the trait `Logger` you must implement it for the Worker structure. Each function (warning, error and info) must insert the message to the
respective fields of the structure Worker.
Create the following associated functions for `Worker`:
You must use **interior mutability**, this means it must be able to mutate data even when there are immutable references to that data. Consequently, the user will not need to use the keyword `mut` (tip: RefCell)
- `new`: that initializes a `Worker` structure.
- `Logger`: to use the trait `Logger`, you must implement it for the `Worker` structure. Each function (`warning`, `error` and `info`) must insert the message to the respective field of the `Worker` structure.
### Notions
You must use **interior mutability**, this means it must be possible to mutate data, even when there are immutable references to that data. Consequently, the user will not need to use the keyword `mut`. _tip:_ RefCell.
You will need to solve the traffic problem in your capital city. Your objective will be to create a traffic control strategy, and visualize it with a simulation.
It is up to you to decide which library and file system you want to use in order to create this simulation, but we recommend that you use the [sdl2](https://docs.rs/sdl2/0.34.3/sdl2/) library.
The objective for this raid is to create a traffic control strategy and represent it with an interface/UI.
It's up to you to decide which library and file system you want to use in order to create this simulation, but we recommend you to use the library [sdl2](https://docs.rs/sdl2/0.34.3/sdl2/)
### Instructions
#### **Environment and Rules**
You must create an environment which contains all the objects described in this section. You can display the objects in any way you wish.
**1 Roads**
You must create an environment which contains all the objects described in this section. You can display the objects as you wish.
You will create two roads which cross each other to create an intersection. Each road will have **one lane** in each direction.
1. Roads
Traffic entering the intersection will be able to select a route by:
- turning left
- turning right
- continuing on straight
There are various forms of intersections, let's focus on the widely seen four-lane crossroad. For simplicity, each road will have two lanes with two different directions for the total of two roads and four lanes.
```console
North
| ↓ | ↑ |
| ↓ | ↑ |
| | |
| | |
| | |
| | |
_______________| | |_______________
← ← ← ←
East --------------- --------------- West
→ → → →
_______________ _______________
| | |
| | |
| | |
| | |
| | |
| ↓ | ↑ |
| ↓ | ↑ |
South
lane1 lane2
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
| r s l | ↑ |
_______________| ← ↓ → | ↑ |_____________
| ↑ r
← ← ← ← ← ← ← | ← s ← ← ← ← ← lane3
| ↓ l
_________________________|_______________________
l ↑ |
→ → → → → s → | → → → → → → lane4
r ↓ |
_______________ | _____________
| | ← ↑ → |
| ↓ | l s r |
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
```
**2 Traffic lights**
For clarification reasons we will assume that a lane can have three different routes (consider that you are in the vehicle position):
Traffic lights are signaling devices positioned at road intersections that follow a universal color code. We all know the normal colors for traffic lights, but for this exercise, your traffic lights will only have **red** and **green**.
- `r`, turning right
- `s`, straight ahead
- `l`, turning left
You will position those traffic lights at the point where each lane enters the intersection.
2. Traffic lights
You can implement any algorithm you choose to control the traffic lights system, but bare in mind that traffic congestion should not be too high (8 or more vehicles).
Traffic lights are signalize devices positioned at road intersections that follows an universal color code,
it's usually green, red and amber, but for this project you will just use the colors **red** and **green**.
The primary function of **your** traffic light system, is to avoid collisions between vehicles passing through the intersection.
You will then have to create some kind of representation for the traffic lights and distribute them for each lane in the intersection.
**3. Vehicles**
You are free to decide what algorithm you want to implement to represent traffic light system, but keep in mind that traffic congestion should not be too high (8 or more vehicles).
3. Vehicles
```
______
@ -64,46 +65,56 @@ The primary function of **your** traffic light system, is to avoid collisions be
=`-(_)--(_)-'
```
The vehicles traveling through your capital city's new junction must follow these rules:
Vehicles must obey this rules:
- Vehicles must be painted in a color which illustrates the route they will follow. The colors are up to you to decide, and your choices will need to be made available during the audit of the raid. For example, all cars which make a right turn could be painted yellow. It's really up to you though.
- Vehicles must have a color so that it's possible to identify which route it will follow (ex:`r`- purple, `s`- Blue and `l`- Yellow). This information about the colors must be given to the auditor of the raid. The colors are up to you to decide.
- It is not possible for the vehicle to change its selected route.
- Autonomous vehicles driving on a lane with a **given route** must follow the direction of that route, it is not possible for the autonomous vehicle to change lanes or routes.
- Each vehicle must have a fixed velocity.
- A safety distance from other vehicles must be maintained. If one vehicle stops, the following vehicle must also stop before it gets to close to the stationary vehicle in front.
- A safety distance from other vehicles must be kept, if one vehicle stop the other vehicle that's
behind him must stop and keep it's distance.
- Vehicles must stop if the traffic light is red and proceed otherwise.
- There are no other vehicle types with special privileges. You can consider that there are no emergency vehicles in your capital city.
- Vehicles must have different routes, either `r`, `s` or `l`.
- Other vehicles such as emergency vehicles are not considered.
---
#### **Commands**
You will use your keyboard to spawn vehicles for your simulation. You will use the arrow keys to spawn a vehicle on the appropriate side of the road, and with a random route.
The generating of vehicles must be done using the keyboard event. You must be able to generate
vehicles in different lanes and with different routes.
For this it must be possible to do the following:
- The `Arrow` keys must generate one vehicle in a specific direction and with a random route ( `r`, `s` and `l`):
- `Up` south to north.
- `Down` north to south.
- `Right` west to east.
- `Left` east to west.
- The `R` key must generate random vehicles with random lanes and routes.
- **`↑` Up:** moves towards the intersection **from the south.**
- **`↓` Down:** moves towards the intersection **from the north.**
- **`→` Right:** moves towards the intersection **from the west.**
- **`←` Left:** moves towards the intersection **from the east.**
- **`r`:** moves towards the intersection **from a random direction.**
- **`Esc` Escape:** ends the simulation.
- The `Esc` key must finish the simulation.
> It must not be possible to use the keyboard to spam the creation of vehicles; they must be created with a safe distance between them.
> Arrow keys must not let the user spam the creation of vehicles, they must be created with a safe distance between them.
> A safe distance is any distance which enables the vehicles to avoid crashing into each other.
> A safe distance is any distance that allows the vehicles not to crash into each other.
### Example
You can see an example for road_intersection [here](https://www.youtube.com/watch?v=6B0-ZBET6mo).
You can see an example for the road_intersection [here](https://www.youtube.com/watch?v=6B0-ZBET6mo).
### Bonus
You can implement the following optional features:
- Vehicle and traffic light animations, and image rendering. You can find some cool assets here:
- Vehicle and traffic lights animation and image rendering. You can find some cool assets:
##### Try to generate a vehicle by pressing the `"Arrow Up"` key.
###### Was a vehicle generated from the south, with a random route?
###### Was a vehicle generated from the cardinal south?
##### Try to generate a vehicle by pressing the `"Arrow Down"` key.
###### Was a vehicle generated from the north, with a random route?
###### Was a vehicle generated from the cardinal North?
##### Try to generate a vehicle by pressing the `"Arrow Right"` key.
###### Was a vehicle generated from the west, with a random route?
###### Was a vehicle generated from the cardinal west?
##### Try to generate a vehicle by pressing the `"Arrow left"` key.
###### Was a vehicle generated from the east, with a random route?
###### Was a vehicle generated from the cardinal east?
##### Try pressing the `"r"` key.
##### Try pressing the `"R"` key.
###### Was the vehicle generated from a random direction, with a random route?
###### Was the vehicle generated randomly (random lane and route)?
##### Try pressing the `"r"` key more than 5 times to generate multiple vehicles, from multiple directions.
##### Try pressing the `"R"` key more than 5 times to generate multiple vehicles in different lines.
###### Can you confirm that the vehicles were created and maintain a safe distance from one another?
##### Try to generate three vehicles from the same direction. Do this for each of the four directions.
##### Try to generate three vehicles in the same lane (do this on all lanes one at a time).
###### Can you confirm that the vehicles were created and maintain a safe distance from one another?
###### Can you confirm that the vehicles were created with a safe distance one from another?
##### Try to generate two vehicles at the same time, one using the `"Up"` key and the other using the `"Down"` key (do this at least 3 times).
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try to generate two vehicles at the same time, one using the `"Right"` key and the other using the `"Left"` key (do this at least 3 times).
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try to generate two vehicles at the same time, one using the `"Up"` key and the other using the `"Left"` key (do this at least 3 times).
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try to generate two vehicles at the same time, one using the `"Up"` key and the other using the `"Right"` key (do this at least 3 times).
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try to generate two vehicles at the same time, one using the `"Down"` key and the other using the `"Left"` key (do this at least 3 times).
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try to generate two vehicles at the same time, one using the `"Down"` key and the other using the `"Right"` key (do this at least 3 times).
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try to generate five vehicles using the `"Up"` key, at the same time generate two vehicles using the `"Right"` key.
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try to generate one vehicle for all the lanes (do this at least 3 times).
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try to generate many vehicles randomly using the `"r"` key. Then wait for at least 1 min.
##### Try to generate vehicles randomly using the `"R"` key. Then wait for at least 1 min.
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try to generate many vehicles in lanes of your choice.
##### Try to generate multiple vehicles in lanes of your choice.
###### Did all the vehicles pass through the intersection without any collisions?
###### Did all the vehicles passed the intersection without any collision?
##### Try pressing the `"Esc"` key.
###### Was the simulation ended?
###### Was the simulation finished?
###### High traffic congestion is when there are 8 or more vehicles in the same lane without proceeding. Was there low traffic congestion while running the simulation?
###### Was there a low traffic congestion while running the application? (ex: high traffic congestion can be 8 or more vehicles in the same lane without proceeding)?
#### General
###### Can you confirm that it is impossible to spam the creation of vehicles by pressing the arrow keys too many times or leave one pressed?
##### Ask the captain of the raid to show you information about how the color of cars relates to its random route.
###### Was the information about colors and routes available?
###### Can you confirm that it is impossible to spam the creation of vehicles (by pressing the arrow keys to many times or leave it pressed)?
###### Are vehicles assigned to their own route with an appropriate color? If so, do they obey that route?
###### Are vehicles assigned to their own route, and if so, do they obey that route? (you can use the colors for each route to see this, ask the owner of the raid for instructions)
###### Do the vehicles keep a safe distance by avoiding a collision when the car in front stops?
###### Do the vehicles kept a safe distance (do not collide whenever one stops)?
###### Do vehicles stop whenever there is a red light?
Implement the `From<u32>` trait to create a roman number from a number. The roman number should be in subtractive notation (the common way to write roman number I, II, III, IV, V, VI, VII, VIII, IX, X ...).
Implement the `From<u32> Trait` to create a roman number from a `u32`. The roman number should be in subtractive notation (the common way to write roman number I, II, III, IV, V, VI, VII, VIII, IX, X ...)
Start by defining the digits as `RomanDigit` (`Nulla` is 0).
For this start by defining the digits as `RomanDigit` with the values I, V, X, L, C, D, M and Nulla for 0
Next define `RomanNumber` as a wrapper to a vector of `RomanDigit`, and implement the Trait `From<u32>`.
Next define `RomanNumber` as a wrapper to a vector of RomanDigit's And implement the Trait `From<u32>`.
There are two ways to render a 3d scene into a 2d image: `rasterization`, which converts the shapes and geometric figures to pixels and applies calculations to obtain the color, the shadows, the refraction, etc... of those pixels. The other method is called `ray tracing` and consists in drawing each pixel with its color, shadows, refraction, reflection, etc.... already present from the start.
There are two ways to render a 3d scene into a 2d image: `rasterization` which basically converts the shapes and geometric figures to pixels and applies calculations to obtain the color, the shadows, the refraction, etc... of those pixels. The other method is called `ray tracing` and consist in drawing each pixel with its color, shadows, refraction, reflection, etc.... already present from the start.
Imagine a camera pointing at a scene, and from that camera, a bunch of rays are coming, which bounce from object to object until they reach the light source (lamp, sun, etc...). This is basically how a ray tracer works.
@ -16,10 +16,10 @@ Below is an example of an image which your ray tracer should be able to produce:
In this project, you have to implement the ray tracer method in order to be able to render a computer generated image containing a few objects.
When building your ray tracer, you have to take some points into consideration:
When building your ray tracer you have to take some points into consideration:
- you need to be able to create at least 4 simple objects: a sphere, a cube, a flat plane and a cylinder.
- your program must be able to change an object's location before creating the image. (Example: render a sphere with its center on the point (1,1,1)).
- your program must be able to change an object location before creating the image. (Example: render a sphere with its center on the point (1,1,1)).
- you have to be able to look at the same scene from different angles by moving the camera/point of view.
- you also have to implement simple light management, which includes: different brightness and shadows.
@ -30,13 +30,13 @@ As your ray tracer will probably be a bit slow to render high resolution scenes,
- a scene with one of each of all the objects (one cube, one sphere, one cylinder and one flat plane);
- a scene like the previous one, but with the camera in another position (thus generating the same image from a different perspective).
All of the images should be in the format of 800x600. However, while testing, you should use smaller resolution images in order to reduce your rendering time (a 1200x1000 can take up to 40 mins to create). It would be best to consider the possibility of changing the output image's resolution easily.
All of the images should be in the format of 800x600. However, while testing you should use smaller resolution images in order to reduce your rendering time (a 1200x1000 can take up to 40 mins to create).
Another aspect you should consider is that the auditor will have to use your ray tracer, so make it as usable and optimized as possible. You should provide the auditor clear documentation.
#### Documentation
By documentation we mean the explaining of how the ray tracer work and how to work with it, for example: how to create an object, how to change brightness in a scene, etc... After reading the documentation, a new user of your ray tracer has to be able to use it without much guessing work.
By documentation we mean, the explaining of how does the ray tracer work and how to work with it, for example: how to create an object, how to change brightness in a scene, etc... A new user of your ray tracer, after reading the documentation has to be able to use it without much guessing work.
You will have to create a [markdown](https://www.markdownguide.org/getting-started/) file, which will have to contain:
@ -74,15 +74,15 @@ P3 \
The image header consists of three lines:
- the first one is the image format: what type of PPM (full color, ASCII encoding) image it is. P3 stands for the Portable PixMap type, so you will be using this one.
- the following stands for how many columns and rows of pixels the image will contain.
- the first one is the image format: what type of PPM (full color, ASCII enconding) image it is. P3 stands for the Portable PixMap type so you will be using this one.
- the next stands for how many columns and rows of pixels the image will contain.
- and the third line is the maximum color value, 255 is the most common value since the rgb color code is very well known.
All the other lines below, are the rgb values for each pixel, for example the first line of the image body represents a black pixel (rgb(0,0,0) -> black). Each line represents one pixel, starting on the top left corner transitioning to the right and, in this case, the fifth line is the pixel in the first row on the second column.
So with this in mind, you will have to make an algorithm that fills a file by printing each line. You can use the cargo command this way: `cargo run > output.ppm`. This will print the standard output to the file `output.ppm`.
In order to create the previously mentioned objects, you will need to search online for documentation about the geometrics of each.
In order to create the previous mentioned objects you will need to search online for documentation about the geometrics of each.
### Bonus
@ -93,8 +93,6 @@ As bonus for this project you can implement:
- Add particles
- Add fluids
Consider putting your bonuses behind command-line flags to achieve a reasonable performance standard defined above. For example, to render textures on your image, you can use a flag -t. Otherwise, textures will be ignored.
Your going to make a shopping system. It will have a store where the products will be saved, and a cart which will contain items from which a receipt will be generated.
In this exercise a shopping system will have to be created. There will be :
**"Buy three, get one free".**
- A store that will save all the products in it
- A cart that will have `items` that the client will buy, and a `receipt`
The store is having a promotion. The cheapest of three items will be free. But there is a problem with the printer interface, it cannot receive any zero values. We can create a workaround. We will reduce all of the values in the cart by a small amount to show the correct total price. You can see the example to see how it works.
This store is having a promotion, "Buy three and get one for free" (the free item must be the cheapest). The receipt must not present
any value as 0, so the promotion must be a reduction to be applied to all items instead.(see the example)
You will have to implement for the `Cart` structure the following **functions**:
You will have to implement for the Cart structure the following **functions**:
- `new`: that will initialize the cart.
- `insert_item`: will receive a reference to `Store` and a `String`. Just like the name says, it will insert the item to the cart.
- `generate_receipt`: returns a vector of sorted floats. This function must generate the receipt just like the example below, using the promotion. AIt should save the result in the `receipt` field.
- `new`, that will initialize the cart
- `insert_item`, that will receive a reference to `Store` and a `String`. Just like the name says you will
have to insert the item to the cart
- `generate_receipt`, that returns a vector of sorted floats. This function must generate the receipt just
like the example above, using the promotion. Also saving the result in the filed `receipt`.
This is a percentage calculation, and it can be applied to a set of three items. If the client purchases 9 items, they will receive three for free, with the discount applied to all items.
This is a percentage calculation, and it can be applied to a set of three items.
If the client purchase 9 items, the promotion will be applied, three for free, to all items
Using the `mall` module provided, create the following **functions** to help run a shopping mall:
- `biggest_store`: receives a `Mall` and returns the `Store` with the biggest `square_meters`.
- `highest_paid_employees`: receives a `Mall` and returns a vector containing the `Employee`(s) with the highest salary.
- `nbr_of_employees`: receives a `Mall` and returns the number of employees and guards as a `usize`.
- `fire_old_guards`: receives a `Mall` and removes from the `Mall.guards` all guards who are 50 years old or over.
- `check_for_guards`: receives a `Mall` and a vector of `Guard`. If there is not at least 1 guard for every 200 square meters of floor size, a guard should be added to the `Mall.guards`.
- `cut_or_raise`: receives a `Mall`. For each employee, the salary will be raised by 10% if they work more than 10 hours, else their salary will be decreased by 10%. You can consider that guards are not employees of the mall.
- `biggest_store`: receives a `mall::Mall` and returns the `Store` with the biggest `square_meters`.
- `highest_paid_employees`: receives a `mall::Mall` and returns a vector containing the `Employee`(s) with the highest salary.
- `nbr_of_employees`: receives a `mall::Mall` and returns the number of employees and guards as a `usize`.
- `fire_old_guards`: receives a `mall::Mall` and removes from the `mall::Mall.guards` all guards who are 50 years old or over.
- `check_for_guards`: receives a `mall::Mall` and a vector of `Guard`. If there is not at least 1 guard for every 200 square meters of floor size, a guard should be added to the `mall::Mall.guards`.
- `cut_or_raise`: receives a `mall::Mall`. For each employee, the salary will be raised by 10% if they work more than 10 hours, else their salary will be decreased by 10%. You can consider that guards are not employees of the mall.
### Expected Function
> You'll need to work out the function signatures for yourself.