Skip to content

Commit

Permalink
Extend tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaman committed Jun 27, 2023
1 parent 70d7c70 commit 4d8bf2c
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 33 deletions.
7 changes: 4 additions & 3 deletions tutorials/cyber-kingdom/firewall/firewall_2.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### @explicitHints 1
### @flyoutOnly true

# First filters
# Worm

```ghost
cyber.setupFirewall(function () {
Expand All @@ -13,7 +13,7 @@ cyber.setupFirewall(function () {
```

## Virus @showdialog
## Worm @showdialog
It's a Worm!
We need to create a rule to stop it coming in the castle!
![Worm](https://raw.githubusercontent.com/CausewayDigital/Minecraft-EE-MakeCode/main/tutorials/cyber-kingdom/firewall/images/level_2.jpg)
Expand All @@ -24,7 +24,8 @@ We need to come up with a rule to block access to the worm, but still allow vill
Add a ``||cyber:Add deny firewall rule||`` block to your rules. It allows you to tell the guards to deny access to anyone that satisfies the rule.

### Distinguishing Features
Can you see anything that might help us distinguish between a villager and a virus?
Can you see anything that might help us distinguish between a villager and a virus?
Press the < (back) button to check the lookout view for what is coming if you aren't sure.
```template
cyber.setupFirewall(function () {
cyber.allowAll()
Expand Down
8 changes: 1 addition & 7 deletions tutorials/cyber-kingdom/firewall/firewall_3.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,8 @@ cyber.addDenyFirewallRule(cyber.requireLegs(Legs.OverFourLegs))
```

### ~ tutorialhint
```blocks
cyber.setupFirewall(function () {
cyber.allowAll()
cyber.addDenyFirewallRule(cyber.requireLegs(Legs.OverFourLegs))
cyber.addDenyFirewallRule(cyber.requireHat(WearingHat.NoHat))
})
Are those villagers wearing hats?

```

```package
causeway-digital-makecode-extension=github:causewaydigital/pxt-causeway-digital-extension#cyber-kingdom
Expand Down
10 changes: 2 additions & 8 deletions tutorials/cyber-kingdom/firewall/firewall_4.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Are they all going to be allowed through the firewall?

## More villagers
You may need to make rules using an **and** statement. This means you can combine 2 rules together.
Watch out, some of these villages don't have hats, but they are carrying items like a pickaxe or map.


```template
Expand All @@ -32,14 +33,7 @@ cyber.addDenyFirewallRule(cyber.requireHat(WearingHat.NoHat))
```

### ~ tutorialhint
```blocks
cyber.setupFirewall(function () {
cyber.allowAll()
cyber.addDenyFirewallRule(cyber.requireLegs(Legs.OverFourLegs))
cyber.addDenyFirewallRule(cyber.requireHat(WearingHat.NoHat))
})
```
The virus has 2 legs and doesn't seem to be holding anything.

```package
causeway-digital-makecode-extension=github:causewaydigital/pxt-causeway-digital-extension#cyber-kingdom
Expand Down
23 changes: 8 additions & 15 deletions tutorials/cyber-kingdom/firewall/firewall_5.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### @explicitHints 1
### @flyoutOnly true

# TUTORIAL 5
# Spies

```ghost
cyber.setupFirewall(function () {
Expand All @@ -14,32 +14,25 @@ cyber.setupFirewall(function () {
```

## More villagers @showdialog
It looks like there's a large group of villagers on their way.
Are they all going to be allowed through the firewall?
## Spies @showdialog
Be careful, the rival kingdom has been known to try and send spies through our gates.


## More villagers
You may need to make rules using an **and** statement. This means you can combine 2 rules together.
## Spies!
Make sure not to let the spies in, they try to use a disguise so they won't be recognised.
I wonder how we could differentiate them from normal villagers?


```template
cyber.setupFirewall(function () {
cyber.allowAll()
cyber.addDenyFirewallRule(cyber.requireLegs(Legs.OverFourLegs))
cyber.addDenyFirewallRule(cyber.requireHat(WearingHat.NoHat))
cyber.addDenyFirewallRule(cyber.ruleAnd(cyber.requireHat(WearingHat.NoHat), cyber.requireHoldingItem(HoldingItem.NoItem)))
})
```

### ~ tutorialhint
```blocks
cyber.setupFirewall(function () {
cyber.allowAll()
cyber.addDenyFirewallRule(cyber.requireLegs(Legs.OverFourLegs))
cyber.addDenyFirewallRule(cyber.requireHat(WearingHat.NoHat))
})
```
What do spies always wear when they want to conceal their identity?

```package
causeway-digital-makecode-extension=github:causewaydigital/pxt-causeway-digital-extension#cyber-kingdom
Expand Down
38 changes: 38 additions & 0 deletions tutorials/cyber-kingdom/firewall/firewall_6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### @explicitHints 1
### @flyoutOnly true

# Soldiers

```ghost
cyber.setupFirewall(function () {
cyber.allowAll()
cyber.addDenyFirewallRule(cyber.requireHat(WearingHat.NoHat))
cyber.addDenyFirewallRule(cyber.requireHoldingItem(HoldingItem.NoItem))
cyber.addDenyFirewallRule(cyber.requireLegs(Legs.TwoLegs))
cyber.addDenyFirewallRule(cyber.ruleAnd(cyber.requireLegs(Legs.OverFourLegs), cyber.requireHoldingItem(HoldingItem.NoItem)))
})
```

## Soldiers @showdialog
The rival kingdom it seems didn't take kindly to us blocking access to their spies and have sent soldiers!


## Spies!
Quickly, create some rules to block these solders, we can't have them getting through the castle walls!
I wonder how we could differentiate them from normal villagers?


```template
cyber.setupFirewall(function () {
cyber.allowAll()
cyber.addDenyFirewallRule(cyber.requireLegs(Legs.OverFourLegs))
cyber.addDenyFirewallRule(cyber.ruleAnd(cyber.requireHat(WearingHat.NoHat), cyber.requireHoldingItem(HoldingItem.NoItem)))
cyber.addDenyFirewallRule(cyber.requireEyewear(WearingEyeware.WearingEyeware))
})
```


```package
causeway-digital-makecode-extension=github:causewaydigital/pxt-causeway-digital-extension#cyber-kingdom
```

0 comments on commit 4d8bf2c

Please sign in to comment.