Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d249b28

Browse files
committed
Completed Wizards and Warriors Exercism exercise
1 parent d3d258e commit d249b28

5 files changed

Lines changed: 65 additions & 19 deletions

File tree

.vs/JavaJavaScript/v17/.wsuo

-1.5 KB
Binary file not shown.

.vs/JavaJavaScript/v17/DocumentLayout.backup.json

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
{
22
"Version": 1,
33
"WorkspaceRootPath": "C:\\Users\\Roma Invicta\\source\\repos\\BassBoulder\\JavaJavaScript\\",
4-
"Documents": [
5-
{
6-
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\Roma Invicta\\source\\repos\\BassBoulder\\JavaJavaScript\\JavaScript\\Exercism\\HighScoreBoard.js||{14D17961-FE51-464D-9111-C4AF11D7D99A}",
7-
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:JavaScript\\Exercism\\HighScoreBoard.js||{14D17961-FE51-464D-9111-C4AF11D7D99A}"
8-
}
9-
],
4+
"Documents": [],
105
"DocumentGroupContainers": [
116
{
127
"Orientation": 0,
138
"VerticalTabListWidth": 256,
149
"DocumentGroups": [
1510
{
1611
"DockedWidth": 200,
17-
"SelectedChildIndex": 7,
12+
"SelectedChildIndex": -1,
1813
"Children": [
1914
{
2015
"$type": "Bookmark",
@@ -42,20 +37,11 @@
4237
},
4338
{
4439
"$type": "Bookmark",
45-
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
40+
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
4641
},
4742
{
48-
"$type": "Document",
49-
"DocumentIndex": 0,
50-
"Title": "HighScoreBoard.js",
51-
"DocumentMoniker": "C:\\Users\\Roma Invicta\\source\\repos\\BassBoulder\\JavaJavaScript\\JavaScript\\Exercism\\HighScoreBoard.js",
52-
"RelativeDocumentMoniker": "JavaScript\\Exercism\\HighScoreBoard.js",
53-
"ToolTip": "C:\\Users\\Roma Invicta\\source\\repos\\BassBoulder\\JavaJavaScript\\JavaScript\\Exercism\\HighScoreBoard.js",
54-
"RelativeToolTip": "JavaScript\\Exercism\\HighScoreBoard.js",
55-
"ViewState": "AgIAAAAAAAAAAAAAAAAAAE8AAAAAAAAAAAAAAA==",
56-
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001646|",
57-
"WhenOpened": "2024-11-18T08:32:10.516Z",
58-
"EditorCaption": ""
43+
"$type": "Bookmark",
44+
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
5945
}
6046
]
6147
},

.vs/JavaJavaScript/v17/DocumentLayout.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
"$type": "Bookmark",
3636
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
3737
},
38+
{
39+
"$type": "Bookmark",
40+
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
41+
},
3842
{
3943
"$type": "Bookmark",
4044
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"

.vs/slnx.sqlite

0 Bytes
Binary file not shown.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
class Fighter {
2+
3+
boolean isVulnerable() {
4+
return true;
5+
}
6+
7+
int getDamagePoints(Fighter fighter) {
8+
return 1;
9+
}
10+
}
11+
12+
// TODO: define the Warrior class
13+
14+
class Warrior extends Fighter {
15+
16+
public String toString() {
17+
return "Fighter is a Warrior";
18+
}
19+
20+
boolean isVulnerable(){
21+
return false;
22+
}
23+
24+
int getDamagePoints(Fighter otherPerson){
25+
if (otherPerson.isVulnerable()){
26+
return 10;
27+
}
28+
return 6;
29+
}
30+
31+
}
32+
33+
// TODO: define the Wizard class
34+
35+
class Wizard extends Fighter {
36+
boolean spellprepped = false;
37+
38+
public String toString() {
39+
return "Fighter is a Wizard";
40+
}
41+
42+
void prepareSpell(){
43+
spellprepped = true;
44+
}
45+
46+
boolean isVulnerable() {
47+
return !spellprepped;
48+
}
49+
50+
int getDamagePoints(Fighter wizard){
51+
if (spellprepped) {
52+
return 12;
53+
}
54+
return 3;
55+
}
56+
}

0 commit comments

Comments
 (0)