Skip to content

Commit 1a16d48

Browse files
authored
Merge pull request #96 from permaweb/chore/update-bot-tutorial-v2
chore: update bots tut
2 parents 9d0b2f7 + ae5dff2 commit 1a16d48

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

src/tutorials/bots-and-games/announcements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Handlers.add(
4646
)
4747
```
4848

49-
In this case, the name of the handler is `"PrintAnnouncements"`. It uses a special utility (`hasMatchingTags`) to check if the incoming message has been tagged as an announcement. If true, the handler prints the Event and Data, which represent the title and description of the announcement.
49+
In this case, the name of the handler is `"PrintAnnouncements"`. It uses a special in-built utility (`hasMatchingTags`) to check if the incoming message has been tagged as an announcement. If true, the handler prints the Event and Data, which represent the title and description of the announcement.
5050

5151
> Note: Once a message is "handled", it will be discarded from your `Inbox`.
5252

src/tutorials/bots-and-games/arena-mechanics.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,14 @@ For those who prefer to watch the action unfold, the "Listen" mode offers an opp
5151

5252
To maintain the flow and fairness of arena games, an automated system oversees game state transitions. These transitions encompass waiting, playing, and ending phases. Time durations for each state, such as `WaitTime` and `GameTime`, ensure that rounds adhere to defined timeframes, preventing games from lasting indefinitely.
5353

54-
## Arena Game Blueprint
55-
56-
For those interested in using this arena framework, here is the blueprint for the arena game in Lua:
54+
You can refer to the code for the arena in the dropdown below:
5755

5856
<details>
5957
<summary><strong>Arena Game Blueprint</strong></summary>
6058

6159
```lua
6260
-- ARENA GAME BLUEPRINT.
6361

64-
-- REQUIREMENTS: cron must be added and activated for game operation.
65-
6662
-- This blueprint provides the framework to operate an 'arena' style game
6763
-- inside an ao process. Games are played in rounds, where players aim to
6864
-- eliminate one another until only one remains, or until the game time
@@ -409,6 +405,14 @@ Handlers.add(
409405

410406
</details>
411407

408+
## Arena Game Blueprint
409+
410+
For those interested in using this arena framework, we've made this code easily accesible through a blueprint. Simply run the following code in your terminal:
411+
412+
```lua
413+
.load-blueprint arena
414+
```
415+
412416
## Summary
413417

414418
Understanding the mechanics of the arena can not only help you improve your autonomous agent created in the previous section but also empowers you to harness core functionalities for crafting your unique games.

src/tutorials/bots-and-games/build-game.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ AverageMaxStrengthHitsToKill = 3 -- Average number of hits to eliminate a player
206206
-- @return Table representing player's initial state
207207
function playerInitState()
208208
return {
209-
x = math.random(0, Width/8),
210-
y = math.random(0, Height/8),
209+
x = math.random(0, Width),
210+
y = math.random(0, Height),
211211
health = 100,
212212
energy = 0
213213
}

src/tutorials/bots-and-games/game-state.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Let's define a new variable that stores the latest state as follows:
5555
LatestGameState = LatestGameState or nil
5656
```
5757

58-
The syntax preserves exisitng values of the variable when you load successive iterations of the `bot.lua` file instead of overwriting it. If there is no pre-existing value then a `nil` value is assigned to the variable.
58+
The syntax preserves exisitng values of the variable when you load successive iterations of the `bot.lua` file in your terminal, instead of overwriting it. If there is no pre-existing value then a `nil` value is assigned to the variable.
5959

6060
Then implement another handler as follows:
6161

@@ -73,7 +73,7 @@ Handlers.add(
7373
)
7474
```
7575

76-
The response from the game process from the previous handler has an action tag with the value `GameState` that helps us trigger this second handler. Once triggered, the handle function loads the `json` package that parses the data into json and stores it in the `LatestGameState` variable.
76+
The response from the game process from the previous handler has an action tag with the value `GameState` that helps us trigger this second handler. Once triggered, the handle function loads the in-built `json` package that parses the data into json and stores it in the `LatestGameState` variable.
7777

7878
This handler additionally sends a message to your process indicating when the state has been updated. The significance of this feature will be explained in the following section.
7979

0 commit comments

Comments
 (0)