From 39c2bbe11d65f2973656e7056fd671d9d0c00c8b Mon Sep 17 00:00:00 2001 From: davidrobert99 Date: Mon, 23 May 2022 11:35:11 +0100 Subject: [PATCH 1/5] update queens rust --- subjects/queens/README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/subjects/queens/README.md b/subjects/queens/README.md index 7a045f84..8cee9acf 100644 --- a/subjects/queens/README.md +++ b/subjects/queens/README.md @@ -2,18 +2,18 @@ ### Instructions -In a chess game, a queen can attack pieces which are on the same row, column, or diagonal. +In a chess game, a queen can attack pieces which are on the same rank, file, or diagonal. The purpose of this exercise is to find out if two queens can attack each other using the same rules. -The chess board will be represented as an 8 by 8 array. +The chess board will be represented by the struct `ChessPosition`. You must implement the function `new` +that allows you to verify if the position is valid or not. If the position is valid the function will return that +position, otherwise it will return `None`. So, given the position of the two queens on a chess board, you will have to implement the function `can_attack` in the given struct `Queen` with -the purpose of finding out whether the two queens can attack each other or not. - -For this to be possible, you will also have to implement the struct `ChessPosition` -with the function `new`. This will allow you to verify if the position is valid or not. If the position is valid it will return that position, otherwise it will return `None`. +the purpose of finding out whether the two queens can attack each other or not. You also need to implement the function `new` +that allows you to create a new `Queen` given a ChessPosition. For example, if the white queen is at (2, 3) and the black queen is at (5, 6), then the set-up would be like so: @@ -52,6 +52,10 @@ impl ChessPosition { } impl Queen { + pub fn new(position: ChessPosition) -> Self { + + } + pub fn can_attack(&self, other: &Queen) -> bool { } From 36d20fb55f3475391e95ecbb288462375707854e Mon Sep 17 00:00:00 2001 From: davidrobert99 Date: Mon, 23 May 2022 11:35:46 +0100 Subject: [PATCH 2/5] update notions rust --- subjects/tuples_refs/README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/subjects/tuples_refs/README.md b/subjects/tuples_refs/README.md index e89ed527..ebdb2a4b 100644 --- a/subjects/tuples_refs/README.md +++ b/subjects/tuples_refs/README.md @@ -17,11 +17,6 @@ pub fn last_name(student: &Student) -> String { } ``` -### Dependencies - -meval = "0.2" - - ### Usage Here is a program to test your functions From 167027b9777beb9fe2e240632e72e0d712e1347a Mon Sep 17 00:00:00 2001 From: davidrobert99 Date: Fri, 27 May 2022 01:37:16 +0100 Subject: [PATCH 3/5] update exam exercises --- subjects/blood_types_s/README.md | 5 +-- subjects/brackets_matching/README.md | 33 ++++++++++++------ subjects/brain_fuck/README.md | 10 +++--- subjects/display_table/README.md | 6 ++-- subjects/filter_table/README.md | 16 ++++----- subjects/flat_tree/README.md | 2 +- .../determinant-of-a-3x3-matrix-formula-3.png | Bin 0 -> 14485 bytes 7 files changed, 40 insertions(+), 32 deletions(-) create mode 100644 subjects/matrix_determinant/determinant-of-a-3x3-matrix-formula-3.png diff --git a/subjects/blood_types_s/README.md b/subjects/blood_types_s/README.md index e8bcdf2c..e8a977d9 100644 --- a/subjects/blood_types_s/README.md +++ b/subjects/blood_types_s/README.md @@ -33,12 +33,12 @@ pub enum Antigen { } #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] -enum RhFactor { +pub enum RhFactor { Positive, Negative, } -#[derive(PartialEq, Eq, PartialOrd, Ord, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] pub struct BloodType { pub antigen: Antigen, pub rh_factor: RhFactor, @@ -52,6 +52,7 @@ impl BloodType { } pub fn recipients(&self) -> Vec { + } } ``` diff --git a/subjects/brackets_matching/README.md b/subjects/brackets_matching/README.md index 21960986..d65c4461 100644 --- a/subjects/brackets_matching/README.md +++ b/subjects/brackets_matching/README.md @@ -2,24 +2,35 @@ ### Instructions -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. +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. Symbols considered as brackets are parentheses `(` and `)`, square brackets `[` and `]` and curly braces `{` and `}`. Every other symbols are simply ignored. -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 `string`. +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. If there is no argument, the program must print nothing. +For receiving arguments from the command line you should use something like: + +```rust +fn main() { + let args: Vec = std::env::args().collect(); + + //... +} + +``` + ### Usage ```console -$ go run . '(johndoe)' | cat -e -OK$ -$ go run . '([)]' | cat -e -Error$ -$ go run . '' '{[(0 + 0)(1 + 1)](3*(-1)){()}}' | cat -e -OK$ -OK$ -$ go run . -$ +$ cargo run '(johndoe)' | cat -e +OK +$ cargo run '([)]' | cat -e +Error +$ cargo run + +$ cargo run '' '{[(0 + 0)(1 + 1)](3*(-1)){()}}' | cat -e +OK +OK ``` diff --git a/subjects/brain_fuck/README.md b/subjects/brain_fuck/README.md index abcf729d..874dc677 100644 --- a/subjects/brain_fuck/README.md +++ b/subjects/brain_fuck/README.md @@ -5,7 +5,7 @@ Write a `Brainfuck` interpreter program. 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. +`Brainfuck` is a minimalist language. It consists of an array of bytes (in this exercise 2048 bytes) all initialized with zero, and with a pointer to its first byte. Every operator consists of a single character : @@ -22,11 +22,11 @@ Any other character is a comment. For receiving arguments from the command line you should use something like: ```rust - fn main() { - let args: Vec = std::env::args().collect(); +fn main() { + let args: Vec = std::env::args().collect(); - brain_fuck(&args[1]); - } + brain_fuck(&args[1]); +} ``` diff --git a/subjects/display_table/README.md b/subjects/display_table/README.md index 30894bec..11ee081e 100644 --- a/subjects/display_table/README.md +++ b/subjects/display_table/README.md @@ -2,9 +2,9 @@ ### Instructions -- 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 doees not allow to center exactly, it must descend slightly to the right. +- 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. - - Note: If the table is empty `println!` must not print anything. + - Note: If the table is empty (does not have a header), `println!` must not print anything. - Define the associated function `new` which creates a new empty table. @@ -22,7 +22,7 @@ pub struct Table { impl fmt::Display for Table { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - } + } } impl Table { diff --git a/subjects/filter_table/README.md b/subjects/filter_table/README.md index a1663ec1..5b0128b0 100644 --- a/subjects/filter_table/README.md +++ b/subjects/filter_table/README.md @@ -4,17 +4,13 @@ - Define the **functions**: - - new: which creates a new empty table. + - `new`: which creates a new empty table. - - add_rows: which adds a new row to the table from a slice of strings. + - `add_rows`: which adds a new row to the table from a slice of strings. - - filter_cols: which receives a closure which receives a `&str` and returns a `bool` value: + - `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_cols returns a table with all the columns that yielded true when applied to the header. - - - filter_rows: which receives a closure that receives a `&str` and returns a `bool` value - - - filter_rows returns a table with all the columns that yielded true when applied to the elements of the selected column. + - `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. ### Expected functions and Structures @@ -34,11 +30,11 @@ impl Table { } - pub fn filter_col(&self, filter: ) -> Option { + pub fn filter_col(&self, filter: T) -> Option { } - pub fn filter_row(&self, col_name: &str, filter: ) -> Option { + pub fn filter_row(&self, col_name: &str, filter: T) -> Option { } } diff --git a/subjects/flat_tree/README.md b/subjects/flat_tree/README.md index f7f93c2f..786456a4 100644 --- a/subjects/flat_tree/README.md +++ b/subjects/flat_tree/README.md @@ -1,4 +1,4 @@ -## flat_rust +## flat_tree ### Instructions diff --git a/subjects/matrix_determinant/determinant-of-a-3x3-matrix-formula-3.png b/subjects/matrix_determinant/determinant-of-a-3x3-matrix-formula-3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si{G8?3BWXs?fChyDG5-UeW!{lVCyV8Q^v^iJFtC>gQmwCmV|28%x8|F4&zH7t}=s6`EXiyuCe=|?3 zJ)}VAF`De#Po7NfH*Ea#NpA65BbavmpE=k~VNiQfiTJB>z2A47`$2sErLx=!Y}tlh zb=T8RKJ33y@|{e|MHVh6rG|D6k@a=d)5BR=_u>5GJJ{r}^6>sE37nCJ)lrWc1ZH=y zY2*Z(tOb~d2E#f(bG+reis^u~Up!)ETO(2(|;|1z&3O8fWO25=ti zgK?Y_2l1<32Pn+a literal 0 HcmV?d00001 From 11fd9f55134b81d15bb0d3b8f6e4fcbe606fe8e1 Mon Sep 17 00:00:00 2001 From: davhojt Date: Wed, 1 Jun 2022 10:47:04 +0300 Subject: [PATCH 4/5] docs(queens) correct grammar --- subjects/queens/README.md | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/subjects/queens/README.md b/subjects/queens/README.md index 8cee9acf..6cbae6c1 100644 --- a/subjects/queens/README.md +++ b/subjects/queens/README.md @@ -2,21 +2,18 @@ ### Instructions -In a chess game, a queen can attack pieces which are on the same rank, file, or diagonal. +In a chess game, a queen can attack pieces which are on the same rank (row), file (column), or diagonal. -The purpose of this exercise is to find out if two queens can attack each other using the same rules. +The purpose of this exercise is to find out if two queens can attack each other. -The chess board will be represented by the struct `ChessPosition`. You must implement the function `new` -that allows you to verify if the position is valid or not. If the position is valid the function will return that -position, otherwise it will return `None`. +The position of a chess piece on a chessboard will be represented by the struct `ChessPosition`. You must implement the associated function `new` which will return the position if it is valid, otherwise it will return `None`. +> Remember, chessboards have 8 files and 8 ranks (each from 0 to 7). -So, given the position of the two queens on a chess board, you will have to -implement the function `can_attack` in the given struct `Queen` with -the purpose of finding out whether the two queens can attack each other or not. You also need to implement the function `new` -that allows you to create a new `Queen` given a ChessPosition. +You will create the `Queen` struct with the associate function `can_attack`, which will return `true` if the queens can attack each other or not. You also need to implement the function `new` which creates a new `Queen` with a `ChessPosition`. -For example, if the white queen is at (2, 3) and the black queen is at (5, 6), -then the set-up would be like so: +### Example + +If the white queen is at (2, 3) and the black queen is at (5, 6), then the set-up would be like the below. In this case, the two queens can attack each other because both pieces share a diagonal: ``` _ _ _ _ _ _ _ _ @@ -29,8 +26,6 @@ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ``` -In this case, the two queens can attack each other because both pieces share a diagonal. - ### Expected Function and Structures ```rust From 8a582645f082deee58f82ac7d30ad7f43bbf3182 Mon Sep 17 00:00:00 2001 From: davhojt Date: Wed, 1 Jun 2022 20:34:32 +0300 Subject: [PATCH 5/5] docs(matrix_determinant) fix conflict --- subjects/lunch_queue/README.md | 47 ++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/subjects/lunch_queue/README.md b/subjects/lunch_queue/README.md index 0c87a382..e7ee0dc2 100644 --- a/subjects/lunch_queue/README.md +++ b/subjects/lunch_queue/README.md @@ -2,27 +2,21 @@ ### Instructions -An API will have to be created to 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. -Using the given code declare the following functions: +The program requires the following functionsAdd the following associated functions to the `Queue` structure: -- `new` which will initialize the `Queue` -- `add` which receives the person's information, so it can be added to the `Queue` -- `invert_queue` which inverts the queue of persons -- `rm`, which will remove the person who finished ordering their food. +- `new`: which will initialize the `Queue`. +- `add`: which receives a person's information, to add them to the `Queue`. +- `invert_queue`: which reverses the queue. +- `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` +- `search`: which returns a tuple with the information of a given person `id` 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. -### Notions - -- [enum](https://doc.rust-lang.org/rust-by-example/custom_types/enum.html) -- [Box](https://doc.rust-lang.org/book/ch15-01-box.html) -- [std::option](https://doc.rust-lang.org/std/option/) - -### Expected Function adn Structures +### Expected Function and Structures ```rust pub struct Queue { @@ -37,12 +31,21 @@ pub struct Person { } impl Queue { - pub fn new() -> Queue {} - pub fn add(&mut self, t: String, name: String) {} - pub fn invert_queue(&mut self) {} - pub fn rm(&mut self) -> Option {} - pub fn search(&self) -> Option<(String, String)> {} + pub fn new() -> Queue { + + } + pub fn add(&mut self, t: String, name: String) { + + } + pub fn invert_queue(&mut self) { + } + pub fn rm(&mut self) -> Option { + + } + pub fn search(&mut self, ) -> Option<(String, String)> { + + } } ``` @@ -83,3 +86,9 @@ list Queue { node: Some(Person { name: "Alice", discount: 35, next_person: Some( invert Queue { node: Some(Person { name: "Monica", discount: 15, next_person: Some(Person { name: "Ana", discount: 5, next_person: Some(Person { name: "Alice", discount: 35, next_person: None }) }) }) } $ ``` + +### Notions + +- [enum](https://doc.rust-lang.org/rust-by-example/custom_types/enum.html) +- [Box](https://doc.rust-lang.org/book/ch15-01-box.html) +- [std::option](https://doc.rust-lang.org/std/option/)