You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-3Lines changed: 21 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,15 @@
6
6
7
7
We have learned Object-oriented programming and how `class` and inheritance work in JavaScript. Now lets work with our Viking friends, applying all of the concepts we have just learned.
8
8
9
+
<br>
10
+
9
11
## Requirements
10
12
11
13
- Fork this repo.
12
14
- Clone this repo.
13
-
- Visit the "actions" tab in your fork, and enable workflows.
15
+
- Visit the "Actions" tab in your fork, and enable workflows.
16
+
17
+
<br>
14
18
15
19
## Submission
16
20
@@ -24,11 +28,15 @@ $ git push origin master
24
28
25
29
Create Pull Request so your TAs can check up your work.
26
30
31
+
<br>
32
+
27
33
### Test, test, test!
28
34
29
-
Please, open your terminal, change directories into the root of the lab, and run `npm install` to install the test runner. Now, you can run the `npm run test:watch` command to run automated tests in _watch mode_. Open the resulting `lab-solution.html` file with the "Live Server" VSCode extension to always see the most up to date test results.
35
+
Please, open your terminal, change directories into the root of the lab, and run `npm install` to install the test runner. Next, run the `npm run test:watch` command to run the automated tests. Open the resulting `lab-solution.html` file with the "Live Server" VSCode extension to see the test results.
30
36
31
-
You should see that most tests are failing. Let's work to make all of them pass!
37
+
You will see that most of the tests are failing. Let's get to work to make all of them pass!
38
+
39
+
<br>
32
40
33
41
## Instructions
34
42
@@ -66,6 +74,8 @@ class Saxon {}
66
74
classWar {}
67
75
```
68
76
77
+
<br>
78
+
69
79
### Iteration 1: Soldier
70
80
71
81
Modify the `Soldier` class and add 2 methods to it: `attack()`, and `receiveDamage()`.
@@ -89,6 +99,8 @@ Modify the `Soldier` class and add 2 methods to it: `attack()`, and `receiveDama
89
99
- should remove the received damage from the `health` property
90
100
-**shouldn't return** anything
91
101
102
+
<br>
103
+
92
104
### Iteration 2: Viking
93
105
94
106
A `Viking` is a `Soldier` with an additional property, their `name`. They also have a different `receiveDamage()` method and new method, `battleCry()`.
@@ -132,6 +144,8 @@ Modify the `Viking` class, have it inherit from `Soldier`, re-implement the `rec
132
144
- should receive **0 arguments**
133
145
- should return **"Odin Owns You All!"**
134
146
147
+
<br>
148
+
135
149
### Iteration 3: Saxon
136
150
137
151
A `Saxon` is a weaker kind of `Soldier`. Unlike a `Viking`, a `Saxon` has no name. Their `receiveDamage()` method will also be different than the original `Soldier` version.
@@ -164,6 +178,8 @@ Modify the `Saxon`, constructor function, have it inherit from `Soldier` and re-
164
178
-**if the Saxon is still alive**, it should return **_"A Saxon has received DAMAGE points of damage"_**
165
179
-**if the Saxon dies**, it should return **_"A Saxon has died in combat"_**
166
180
181
+
<br>
182
+
167
183
### BONUS - Iteration 4: War
168
184
169
185
Now we get to the good stuff: WAR! Our `War` class will allow us to have a `Viking` army and a `Saxon` army that battle each other.
@@ -222,6 +238,8 @@ The `Saxon` version of `vikingAttack()`. A `Viking` receives the damage equal to
222
238
- should remove dead vikings from the army
223
239
- should return **result of calling `receiveDamage()` of a `Viking`** with the `strength` of a `Saxon`
224
240
241
+
<br>
242
+
225
243
### SUPER BONUS - Iteration 5
226
244
227
245
Since there is a lot of repetitive code in the previous two iterations, _vikingAttack()_ and _saxonAttack()_ try to create one _generic_ method and call it in the case of _vikingAttack_ and in the case of _saxonAttack_ instead of using almost the same code for both methods. (This iteration doesn't have test, so ask your TAs and your instructor to give you feedback on the quality of your code after the refactor.)
0 commit comments