Browse Source

Merge pull request #883 from 01-edu/dr-strange-fix

improving dr-strange subject
pull/893/head
LEEDASILVA 3 years ago committed by GitHub
parent
commit
bb2b7b8f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      subjects/ascii-art-web/export-file/README.md
  2. 2
      subjects/ascii-art-web/export-file/audit.md
  3. 14
      subjects/ascii-art/audit/README.md
  4. 14
      subjects/ascii-art/output/audit.md
  5. 2
      subjects/ascii-art/reverse/audit.md
  6. 26
      subjects/ascii-art/reverse/example.md
  7. 2
      subjects/ascii-art/standard.txt
  8. 55
      subjects/dr-strange/README.md
  9. 2
      subjects/groupie-tracker/search-bar/README.md
  10. 6
      subjects/groupie-tracker/search-bar/audit.md
  11. 69
      subjects/iterators/README.md

1
subjects/ascii-art-web/export-file/README.md

@ -13,6 +13,7 @@ Ascii-art-web-export consists on making sure that it is possible to export the o
- The web server must export at least in one export format.
- The web server must be created in **Go**.
- The web site must include a button or a link to download/export the file.
- You must handle website errors.
- The code must respect the [good practices](../../good-practices/README.md).

2
subjects/ascii-art-web/export-file/audit.md

@ -10,6 +10,8 @@
###### Are the exported files read and write for the user?
###### Does the site include a link or a button to download the file?
###### Does the project use the HTTP header [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) to indicate the media type of the resource?
###### Does the project use the HTTP header [Content-Length](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) to indicate the size of the entity-body, in bytes, sent to the recipient?

14
subjects/ascii-art/audit/README.md

@ -239,13 +239,13 @@ __ _ _ _ _ _ _ _ __ _ __ __ _
```
_ _ __ _ _ _ _ _ $
| | | | / _| __ _ | | (_) (_) _ | | | | $
__ _ | |__ ___ __| | ___ | |_ / _` | | |__ _ _ | | _ | | _ __ ___ _ __ ___ _ __ __ _ _ __ ___ | |_ _ _ __ __ __ __ __ __ _ _ ____ $
/ _` | | '_ \ / __| / _` | / _ \ | _| | (_| | | _ \ | | | | | |/ / | | | '_ ` _ \ | '_ \ / _ \ | '_ \ / _` | | '__| / __| | __| | | | | \ \ / / \ \ /\ / / \ \/ / | | | | |_ / $
| (_| | | |_) | | (__ | (_| | | __/ | | \__, | | | | | | | | | | < | | | | | | | | | | | | | (_) | | |_) | | (_| | | | \__ \ \ |_ | |_| | \ V / \ V V / > < | |_| | / / $
\__,_| |_.__/ \___| \__,_| \___| |_| __/ | |_| |_| |_| | | |_|\_\ |_| |_| |_| |_| |_| |_| \___/ | .__/ \__, | |_| |___/ \__| \__,_| \_/ \_/\_/ /_/\_\ \__, | /___| $
|___/ _/ | | | | | __/ / $
|__/ |_| |_| |___/ $
| | | | / _| | | (_) (_) _ | | | | $
__ _ | |__ ___ __| | ___ | |_ __ _ | |__ _ _ | | _ | | _ __ ___ _ __ ___ _ __ __ _ _ __ ___ | |_ _ _ __ __ __ __ __ __ _ _ ____ $
/ _` | | '_ \ / __| / _` | / _ \ | _| / _` | | _ \ | | | | | |/ / | | | '_ ` _ \ | '_ \ / _ \ | '_ \ / _` | | '__| / __| | __| | | | | \ \ / / \ \ /\ / / \ \/ / | | | | |_ / $
| (_| | | |_) | | (__ | (_| | | __/ | | | (_| | | | | | | | | | | < | | | | | | | | | | | | | (_) | | |_) | | (_| | | | \__ \ \ |_ | |_| | \ V / \ V V / > < | |_| | / / $
\__,_| |_.__/ \___| \__,_| \___| |_| \__, | |_| |_| |_| | | |_|\_\ |_| |_| |_| |_| |_| |_| \___/ | .__/ \__, | |_| |___/ \__| \__,_| \_/ \_/\_/ /_/\_\ \__, | /___| $
__/ | _/ | | | | | __/ / $
|___/ |__/ |_| |_| |___/ $
```
###### Does it display the right graphical representation in ASCII as above?

14
subjects/ascii-art/output/audit.md

@ -144,13 +144,13 @@ $
```
student$ cat test07.txt
_______ _ _ _ _ _ _ $
|__ __| | | (_) __ _ | | __ _ | | | | | | $
| | ___ ___ | |_ _ _ __ / _` | | | ___ _ __ / _` | ___ _ _ | |_ _ __ _ _ | |_ | | $
| | / _ \ / __| | __| | | | '_ \ | (_| | | | / _ \ | '_ \ | (_| | / _ \ | | | | | __| | '_ \ | | | | | __| | | $
| | | __/ \__ \ \ |_ | | | | | | \__, | | | | (_) | | | | | \__, | | (_) | | |_| | \ |_ | |_) | | |_| | \ |_ |_| $
|_| \___| |___/ \__| |_| |_| |_| __/ | |_| \___/ |_| |_| __/ | \___/ \__,_| \__| | .__/ \__,_| \__| (_) $
|___/ |___/ | | $
|_| $
|__ __| | | (_) | | | | | | | | $
| | ___ ___ | |_ _ _ __ __ _ | | ___ _ __ __ _ ___ _ _ | |_ _ __ _ _ | |_ | | $
| | / _ \ / __| | __| | | | '_ \ / _` | | | / _ \ | '_ \ / _` | / _ \ | | | | | __| | '_ \ | | | | | __| | | $
| | | __/ \__ \ \ |_ | | | | | | | (_| | | | | (_) | | | | | | (_| | | (_) | | |_| | \ |_ | |_) | | |_| | \ |_ |_| $
|_| \___| |___/ \__| |_| |_| |_| \__, | |_| \___/ |_| |_| \__, | \___/ \__,_| \__| | .__/ \__,_| \__| (_) $
__/ | __/ | | | $
|___/ |___/ |_| $
$
```

2
subjects/ascii-art/reverse/audit.md

@ -50,7 +50,7 @@ EX: go run . --reverse=<fileName>
##### Try passing to the reverse flag `"--reverse=example06.txt"` the [example 06](example.md).
`:;<=>?@`
`:;{=}?@`
###### Does it display the value above?

26
subjects/ascii-art/reverse/example.md

@ -49,13 +49,13 @@ $
```console
_ _ _ $
| | | | (_) __ _ ___ ____ _____ _ _ $
___ ___ _ __ ___ ___ | |_ | |__ _ _ __ / _` | ( _ ) |___ \ |___ / | || | $
/ __| / _ \ | '_ ` _ \ / _ \ | __| | _ \ | | | '_ \ | (_| | / _ \/\ __) | |_ \ | || |_ $
\__ \ | (_) | | | | | | | | __/ \ |_ | | | | | | | | | | \__, | | (_> < / __/ ___) | |__ _| $
|___/ \___/ |_| |_| |_| \___| \__| |_| |_| |_| |_| |_| __/ | \___/\/ |_____| |____/ |_| $
| | | | (_) ___ ____ _____ _ _ $
___ ___ _ __ ___ ___ | |_ | |__ _ _ __ __ _ ( _ ) |___ \ |___ / | || | $
/ __| / _ \ | '_ ` _ \ / _ \ | __| | _ \ | | | '_ \ / _` | / _ \/\ __) | |_ \ | || |_ $
\__ \ | (_) | | | | | | | | __/ \ |_ | | | | | | | | | | | (_| | | (_> < / __/ ___) | |__ _| $
|___/ \___/ |_| |_| |_| \___| \__| |_| |_| |_| |_| |_| \__, | \___/\/ |_____| |____/ |_| $
__/ | $
|___/ $
$
$
```
@ -63,13 +63,13 @@ $
```console
_ _ __ _ _ _ _ _ $
| | | | / _| __ _ | | (_) (_) _ | | | | $
__ _ | |__ ___ __| | ___ | |_ / _` | | |__ _ _ | | _ | | _ __ ___ _ __ ___ _ __ __ _ _ __ ___ | |_ _ _ __ __ __ __ __ __ _ _ ____ $
/ _` | | '_ \ / __| / _` | / _ \ | _| | (_| | | _ \ | | | | | |/ / | | | '_ ` _ \ | '_ \ / _ \ | '_ \ / _` | | '__| / __| | __| | | | | \ \ / / \ \ /\ / / \ \/ / | | | | |_ / $
| (_| | | |_) | | (__ | (_| | | __/ | | \__, | | | | | | | | | | < | | | | | | | | | | | | | (_) | | |_) | | (_| | | | \__ \ \ |_ | |_| | \ V / \ V V / > < | |_| | / / $
\__,_| |_.__/ \___| \__,_| \___| |_| __/ | |_| |_| |_| | | |_|\_\ |_| |_| |_| |_| |_| |_| \___/ | .__/ \__, | |_| |___/ \__| \__,_| \_/ \_/\_/ /_/\_\ \__, | /___| $
|___/ _/ | | | | | __/ / $
|__/ |_| |_| |___/ $
| | | | / _| | | (_) (_) _ | | | | $
__ _ | |__ ___ __| | ___ | |_ __ _ | |__ _ _ | | _ | | _ __ ___ _ __ ___ _ __ __ _ _ __ ___ | |_ _ _ __ __ __ __ __ __ _ _ ____ $
/ _` | | '_ \ / __| / _` | / _ \ | _| / _` | | _ \ | | | | | |/ / | | | '_ ` _ \ | '_ \ / _ \ | '_ \ / _` | | '__| / __| | __| | | | | \ \ / / \ \ /\ / / \ \/ / | | | | |_ / $
| (_| | | |_) | | (__ | (_| | | __/ | | | (_| | | | | | | | | | | < | | | | | | | | | | | | | (_) | | |_) | | (_| | | | \__ \ \ |_ | |_| | \ V / \ V V / > < | |_| | / / $
\__,_| |_.__/ \___| \__,_| \___| |_| \__, | |_| |_| |_| | | |_|\_\ |_| |_| |_| |_| |_| |_| \___/ | .__/ \__, | |_| |___/ \__| \__,_| \_/ \_/\_/ /_/\_\ \__, | /___| $
__/ | _/ | | | | | __/ / $
|___/ |__/ |_| |_| |___/ $
$
```

2
subjects/ascii-art/standard.txt

@ -639,13 +639,13 @@ __
__ _
/ _` |
| (_| |
\__, |
__/ |
|___/
_
| |

55
subjects/dr-strange/README.md

@ -2,30 +2,55 @@
### Instructions
You have been given the mission to create a new sense of time.
Instead of a normal week having only 7 days, you will have 14 days.
Your mission is to create an `addWeek` function with one parameter of `Date` type.
So now, a week is 14 days from `Monday` to `Sunday` then `secondMonday` to `secondSunday`.
Week number should be count from `0001-01-01`
Now imagine you have a doctor appointment and you have to wait some hours.
But you do not want to wait, so what you need to do is create a
function `timeTravel` that allows you to change the time according to your needs, this function
it can go backwards or forwards in time.
You will have a function that takes a date and you will pass 3 more parameters to change
the hour, minute and seconds.
You have been given the mission to create a new sense of time! Normally a week has 7 days right? Well, that is about to change!
Instead of a normal week having only 7 days, it will have 14 days.
Let me explain, this new week will have 14 days, from `Monday` to `Sunday` then `secondMonday` to `secondSunday`.
Your purpose is to create a new function `addWeek`, that takes as parameter a `Date` and that will return what week day the given date is, according to your new week format.
Week number should be count from `0001-01-01`.
```
new week format:
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
secondMonday
secondTuesday
secondWednesday
secondThursday
secondFriday
secondSaturday
secondSunday
```
Now imagine you have a doctor appointment and you have to wait some hours, but you do not want to wait, so you decided that you need to create a
function `timeTravel` that allows you to change the time according to your needs.
This function will give you the power to go backwards or forwards in time.
So, you will have a function that takes an object with the following `{date, hour, minute, second}`. This object will be responsible for changing the `hour`, `minute` and `second` of the given `date`.
### Example
```js
timeTravel({ date, hour, minute, second })
addWeek(new Date('0001-01-01')) // Output: Monday
addWeek(new Date('0001-01-02')) // Output: Tuesday
addWeek(new Date('0001-01-07')) // Output: Sunday
addWeek(new Date('0001-01-08')) // Output: secondMonday
addWeek(new Date('0001-01-09')) // Output: secondTuesday
// timeTravel({ date, hour, minute, second })
timeTravel({
date: new Date('2020-05-29 23:25:22'),
hour: 21,
minute: 22,
second: 22,
})
}).toString()
// Output: Date { 2020-05-29T21:22:22.000Z }
// Output: Fri May 29 2020 21:22:22 GMT+0100 (Western European Summer Time)
```

2
subjects/groupie-tracker/search-bar/README.md

@ -12,7 +12,7 @@ Groupie tracker search bar consists of creating a functional program that search
- locations
- first album date
- creation date
- The program must handle case sensitive.
- The program must handle search input as case-insensitive.
- The search bar must have typing suggestions as you write.
- The search bar must identify and display in each suggestion the individual type of the search cases. (ex: Freddie Mercury -> member)
- For example if you start writing `"phil"` it should appear as suggestions `Phil Collins - member` and `Phil Collins - artist/band`. This is just an example of a display.

6
subjects/groupie-tracker/search-bar/audit.md

@ -28,11 +28,7 @@
##### Try to search for the artist/band `"queen"`.
###### Does it handle the case sensitive and does not display any result?
##### Try to search for the artist/band `"Queen"`.
###### Does it handle the case sensitive and presents as result "Queen" and "Queensland"?
###### Does it handle the case-insensitive and presents as result "Queen" and "Queensland"?
##### Try to search for the first album date `"05-08-1967"`.

69
subjects/iterators/README.md

@ -2,32 +2,47 @@
### Instructions
Create a method `new` that takes one number `usize` and initializes the struct `Number`.
The Collatz Conjecture or 3x+1 problem can be summarized as follows:
This method will have to determinate if the given number is even or odd. If it is even you will have to increment it by one to the next odd number and if it is odd you have to increment by one to the next even number.
Take any positive integer `n`.
After that you will implement an iterator for the struct `Number` that returns a tuple (usize,usize,usize) containing each field of the struct Number.
- If `n` is even, you will divide `n` by 2 to get `n / 2`.
- If `n` is odd, you will multiply `n` by 3 and add 1 to get `3n + 1`.
The first position of the tuple will be the even number, the second will be the odd number, and the third will be the factorial number.
Repeat the process indefinitely. The conjecture states that no matter which number you start with, you will always reach 1 eventually.
So the purpose is to return the given number in the right position. If it is even it will be at the first position, and if it is odd it will be in the second position. Apart from that you have to return the factorial of the given number in the third position.
But sometimes the number grow significantly before it reaches 1. This can lead to an integer overflow and makes the algorithm unsolvable within the range of a number in u64. You will not have to worry about that in this exercise.
Given a number `n`, return the number of steps required to reach 1.
Examples:
Starting with n = 16, the steps would be as follows:
0- 16
1- 8
2- 4
3- 2
4- 1
Resulting in 4 steps. So for input n = 16, the return value would be 4.
### Notions
- [Trait Iterator](https://doc.rust-lang.org/std/iter/trait.Iterator.html)
- [Collatz Conjecture](https://pt.wikipedia.org/wiki/Conjectura_de_Collatz)
### Expected functions
```rust
impl Number {
pub fn new(nbr: usize) -> Number {
struct Collatz {
v: u64,
}
}
impl Iterator for Number {
pub fn next(&mut self) -> Option<Self::Item> {}
}
impl Iterator for Collatz {}
pub fn collatz(n: u64) -> Option<u64> {}
```
### Usage
@ -37,22 +52,12 @@ Here is a program to test your function.
```rust
use iterators::*;
struct Number {
even: usize,
odd: usize,
fact: usize,
}
fn main() {
let mut a = Number::new(5);
println!("{:?}", a.next());
println!("{:?}", a.next());
println!("{:?}", a.next());
println!();
let mut b = Number::new(18);
println!("{:?}", b.next());
println!("{:?}", b.next());
println!("{:?}", b.next());
println!("{:?}", collatz(4));
println!("{:?}", collatz(5));
println!("{:?}", collatz(6));
println!("{:?}", collatz(7));
println!("{:?}", collatz(12));
}
```
@ -60,12 +65,10 @@ And its output:
```console
$ cargo run
Some((6, 5, 120))
Some((8, 7, 720))
Some((10, 9, 5040))
Some((18, 19, 6402373705728000))
Some((20, 21, 121645100408832000))
Some((22, 23, 2432902008176640000))
Some(2)
Some(5)
Some(8)
Some(16)
Some(9)
$
```

Loading…
Cancel
Save