-
Notifications
You must be signed in to change notification settings - Fork 0
/
move-wumpus.yml
27 lines (23 loc) · 698 Bytes
/
move-wumpus.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
---
- name: Find where is the Wumpus.
set_fact:
wumpuspos: "{{ item.key }}"
with_dict: "{{ cave }}"
loop_control:
label: 'redacted'
when: item.value.wumpus
- name: Pick a room for the Wumpus to move to.
set_fact:
wumpusmove: "{{ (cave|json_query(query)|list|first).connect | random }}"
vars:
query: '* | [?wumpus]'
- name: Update the cave.
set_fact:
cave: "{{ cave | combine({ wumpuspos|string: {'wumpus': false}}, recursive=True) }}"
- name: Update the cave.
set_fact:
cave: "{{ cave | combine({ wumpusmove|string: {'wumpus': true}}, recursive=True) }}"
- name: Did the Wumpus moved onto you?
set_fact:
death: yes
when: cave[position]['wumpus']