Skip to content

Commit 861cbba

Browse files
rodolfoprrReenaRajani
authored andcommitted
WarriorJS - 25/10/17 (#44)
1 parent 38a2718 commit 861cbba

File tree

4 files changed

+57
-1
lines changed

4 files changed

+57
-1
lines changed

25-10-17/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
* **Where:** [TabCorp](www.tabcorp.com.au)
44
* **When:** 25/10/2017
55

6-
<img src="https://nodegirls-au.slack.com/files/U46PE7W8L/F7NVBMLEL/image_uploaded_from_ios.jpg" width="600px" />
6+
<img src="https://user-images.githubusercontent.com/2061821/32161689-a628fec2-bdaa-11e7-8929-b5bfe33c2c3e.jpg" width="600px" />

25-10-17/warriorjs/.profile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
eyJfdG93ZXJQYXRoIjoiL1VzZXJzL3JvZG9sZm9wcnIvLm52bS92ZXJzaW9ucy9ub2RlL3Y4LjEuNC9saWIvbm9kZV9tb2R1bGVzL3dhcnJpb3Jqcy90b3dlcnMvYmVnaW5uZXIiLCJfd2Fycmlvck5hbWUiOiJ4ZW5hIiwiX3Njb3JlIjoyOTYsIl9lcGljIjpmYWxzZSwiX2VwaWNTY29yZSI6MCwiX2N1cnJlbnRFcGljU2NvcmUiOjAsIl9jdXJyZW50RXBpY0dyYWRlcyI6e30sIl9hdmVyYWdlR3JhZGUiOm51bGwsIl9hYmlsaXRpZXMiOlt7Im5hbWUiOiJ3YWxrIiwiYXJncyI6W119LHsibmFtZSI6ImF0dGFjayIsImFyZ3MiOltdfSx7Im5hbWUiOiJmZWVsIiwiYXJncyI6W119LHsibmFtZSI6ImhlYWx0aCIsImFyZ3MiOltdfSx7Im5hbWUiOiJyZXN0IiwiYXJncyI6W119LHsibmFtZSI6InJlc2N1ZSIsImFyZ3MiOltdfV0sIl9sZXZlbE51bWJlciI6NiwiX2xhc3RMZXZlbE51bWJlciI6bnVsbCwiX3BsYXllclBhdGgiOiIuIn0=

25-10-17/warriorjs/Player.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Player {
2+
playTurn(warrior) {
3+
let _health = this.health;
4+
// Cool code goes here
5+
//if (warrior.feel().isEmpty() && warrior.health() < _health) {
6+
if (warrior.feel().isCaptive()) {
7+
warrior.rescue();
8+
} else if (
9+
warrior.feel().isEmpty() &&
10+
warrior.health() >= _health &&
11+
warrior.health() < 15
12+
) {
13+
warrior.rest();
14+
} else if (!warrior.feel().isEmpty()) {
15+
warrior.attack();
16+
} else {
17+
warrior.walk();
18+
}
19+
20+
this.health = warrior.health();
21+
}
22+
}

25-10-17/warriorjs/README

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Level 6
2+
3+
The wall behind you feels a bit further away in this room. And you hear more cries for help.
4+
5+
Tip: You can walk backward by passing `'backward'` as an argument to `walk()`. Same goes for `feel()`, `rescue()` and `attack()`. Archers have a limited attack distance.
6+
7+
8+
╔════════╗
9+
║C @ S aa║
10+
╚════════╝
11+
12+
> = stairs
13+
@ = xena
14+
S = thickSludge
15+
a = archer
16+
17+
18+
Warrior abilities:
19+
20+
warrior.walk()
21+
22+
warrior.attack()
23+
24+
warrior.feel()
25+
26+
warrior.health()
27+
28+
warrior.rest()
29+
30+
warrior.rescue()
31+
32+
33+
When you're done editing Player.js, run the warriorjs command again.

0 commit comments

Comments
 (0)