-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwumpus-tasks.yml
63 lines (51 loc) · 1.45 KB
/
wumpus-tasks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
- name: Giant bats.
block:
- name: Check for bats in the room.
debug:
msg: |
*flap* *flap* *flap* (humongous bats pick you up and move you!)
- name: Pick random position.
set_fact:
position: "{{ range(1, 20) | random }}"
when: cave[position]['bats']
- name: Check for imminent threats.
set_fact:
death: yes
when: cave[position]['pit'] or cave[position]['wumpus'] or arrows == 0
- include_tasks: the-end.yml
when: death or hit
- name: Sensations.
include_tasks: sensations.yml
when: not hit
- debug:
msg: |
You are in room {{ position }} of the cave, and have {{ arrows }} arrows left.
{% if pit_msg != "" %}
{{ pit_msg }}
{% endif %}
{% if bats_msg != "" %}
{{ bats_msg }}
{% endif %}
{% if wumpus_msg != "" %}
{{ wumpus_msg }}
{% endif %}
There are tunnels to rooms {% for connection in cave[position]['connect'] %}{{ connection }}{% if not loop.last %}, {% endif %}{% endfor %}.
when: not hit
- name: Ask.
pause:
prompt: "Move or shoot?"
register: choice
- name: Parse choice.
set_fact:
command: "{{ choice.user_input }}"
- include_tasks: "{{ command }}.yml"
when: "command in commands"
- include_tasks: help.yml
when: "command not in commands"
- include_tasks: move-wumpus.yml
when: failedhit
- include_tasks: the-end.yml
when: death or hit or arrows == 0
- include_tasks: wumpus-tasks.yml
when: not hit