Skip to content

Commit bd83ba4

Browse files
authored
Merge pull request #12 from olekscode/main
Fixed the order of tutorials
2 parents f970166 + 38bcdb3 commit bd83ba4

File tree

11 files changed

+60
-17
lines changed

11 files changed

+60
-17
lines changed

docs/tutorials/hands-on-tutorials/custom-grid/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: Creating a Custom Grid
2+
title: Custom Grid
3+
sidebar_position: 2
34
slug: /custom-grid
45
---
56

docs/tutorials/hands-on-tutorials/publish-model-on-github/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Publish your model on Github
3+
sidebar_position: 3
34
slug: /publish-model-on-github
45
---
56

docs/tutorials/hands-on-tutorials/robot-forager/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
title: Robot-Forager Tutorial
3+
sidebar_position: 1
4+
slug: /robot-forager-tutorial
5+
---
6+
17
# Robot-Forager Tutorial
28

39
In this tutorial, you will learn how to build a very simple model in Cormas.

docs/tutorials/pharo-basics/collections.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
title: Collections
3+
sidebar_position: 5
4+
slug: /collections
5+
---
6+
17
# Collections
28

39
This guide introduces you to **collections** in Pharo - groups of objects used to organize and manipulate data. You will learn how to create and use arrays, ordered collections, sets, and dictionaries, understand what makes each type special, and explore how to iterate over them with messages like `do:`, `collect:`, `select:`, and others. These operations are essential for building models and handling data effectively in Cormas. 

docs/tutorials/pharo-basics/initialize.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
2-
title: Initialize method
3-
sidebar_position: 4
2+
title: Initialize Method
3+
sidebar_position: 7
4+
slug: /initialize-method
45
---
56

67
# Understanding the initialize method

docs/tutorials/pharo-basics/learn-pharo.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
title: Where to Learn Pharo?
3+
sidebar_position: 1
4+
slug: /where-to-learn-pharo
5+
---
6+
17
# Where to Learn Pharo?
28

39
The following pages of this guide will teach you the basics of Pharo programming language and environment that are necessary to use Cormas.

docs/tutorials/pharo-basics/messages.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
2-
title: Understanding Messages in Pharo
3-
sidebar_position: 4
2+
title: Messages
3+
sidebar_position: 6
4+
slug: /pharo-messages
45
---
56

67
In Pharo (and therefore in **Cormas**), *everything is an object* - agents, cells, plots, and even numbers and strings. Objects **interact** by *sending messages* to each other. Messages are how we tell an object what to do.
@@ -14,7 +15,7 @@ plot burn.
1415
Here we send the message `burn` to the object `plot`.\
1516
If the object knows how to respond to `burn`, it performs an action - for example, it may change its color to red and mark itself as burned.
1617

17-
## 1. What is a Message?
18+
## What is a Message?
1819

1920
A **message** in Pharo is similar to a "function call" in other languages, but it's more natural to read:
2021

@@ -46,7 +47,7 @@ Here:
4647
- `moveTo:` is the **message** 
4748
- `newPlot` is an **argument** 
4849

49-
## 2. Everything Happens by Sending Messages
50+
## Everything Happens by Sending Messages
5051

5152
Objects never access another object's data directly.\
5253
They always **communicate by sending messages**.
@@ -62,7 +63,7 @@ This means that when you design a Cormas model, you define:
6263
- **the messages your agents understand** (their behavior),
6364
- and **the messages you send** to make them act or query information.
6465

65-
## 3. Messages vs. Methods
66+
## Messages vs. Methods
6667

6768
It's important to understand that **messages** and **methods** are not the same thing.
6869

@@ -84,7 +85,7 @@ In short:
8485
- **Message**: what you send.
8586
- **Method**: what the object does when it receives that message.
8687

87-
## 4. Messages Can Have Arguments
88+
## Messages Can Have Arguments
8889

8990
Some messages require extra information, called *arguments*.
9091

@@ -98,7 +99,7 @@ Here `biomass:`, `moveTo:` and `addTree:` are *keyword messages* that take argum
9899

99100
Notice the colon (`:`) - it indicates that the message expects a value.
100101

101-
## 5. Messages Return Values
102+
## Messages Return Values
102103

103104
Each message returns a result, which can be stored or used in another message:
104105

@@ -121,7 +122,7 @@ growBiomass
121122
Then the message `cell growBiomass` will increase the biomass by 1 and return cell. You can imagine that there is an invisible `^ self` at the end of each method.
122123
:::
123124

124-
## 6. Nested Messages
125+
## Nested Messages
125126

126127
You can also *nest* messages to combine multiple requests in one expression:
127128

@@ -134,7 +135,7 @@ This means:
134135
1. Ask the forest for its largest tree.
135136
2. Then ask that tree for its height.
136137

137-
## 7. Messages Can Be Chained
138+
## Messages Can Be Chained
138139

139140
You can send several messages to the same object in sequence by using a semicolon (`;`):
140141

@@ -146,7 +147,7 @@ This reads naturally: *"Increment, increment, then decrement the counter."*
146147

147148
This is a key idea in Pharo - code is readable and close to natural language.
148149

149-
## 8. Message Types
150+
## Message Types
150151

151152
In Pharo, there are three kinds of messages. These are just different ways of writing instructions for objects, depending on how many arguments (extra pieces of information) they need.
152153

docs/tutorials/pharo-basics/pharo-environment.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
title: Pharo Environment
3+
sidebar_position: 4
4+
slug: /pharo-environment
5+
---
6+
17
# Basics of Pharo Environment
28

39
In this short guide we will teach you how to use navigate the Pharo environment and use 4 main tools: Playground, Inspector, System Browser, and Debugger. We will also teach you how to search for methods and classes with Spotter and how to browse implementors and senders of different methods and classes.
@@ -51,7 +57,8 @@ The first tool that you will learn is called _"Playground"_. It allows us to exe
5157
Copy the following two lines to your Playground and click on _"Do it all"_ button in the top-left corner.
5258

5359
```smalltalk
54-
StWelcomeBrowser open.Transcript open.
60+
StWelcomeBrowser open.
61+
Transcript open.
5562
```
5663

5764
![](img/pharo-environment/playground-do-it-all.png)
@@ -67,7 +74,9 @@ You can also execute one specific line by placing your cursor on it, right click
6774
Let's add some more lines, evaluate (execute) them and print the result. Don't worry if the variables are highlighted in red. This happens because they are not explicitly declared. But as soon as you execute your code in the Playground, it will automatically declare all varibles for you. Select the lines that you added, right-click and select _Print it_ from the menu. You can also use the shortcut _Ctrl+P_ or _Cmd+P_ on Mac.
6875

6976
```smalltalk
70-
a := 25.b := 75.a + b
77+
a := 25.
78+
b := 75.
79+
a + b
7180
```
7281
![](img/pharo-environment/playground-print-it.png)
7382

docs/tutorials/pharo-basics/pharo-playground.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
title: Running Code in Playground
3+
sidebar_position: 2
4+
slug: /run-code-in-playground
5+
---
6+
17
# Running Code in Pharo Playground
28

39
Before starting, make sure you already have Pharo installed. If not, follow the Installing Pharo section from our [How to Install Cormas](/download) tutorial.

docs/tutorials/pharo-basics/pharo-syntax.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
---
2+
title: Pharo Syntax
3+
sidebar_position: 3
4+
slug: /pharo-syntax
5+
---
6+
17
# Pharo Syntax in a Nutshell
28

39
Pharo is a live, object-oriented language. Everything is an object, and you send messages to objects to make them do things. This short guide covers only the essentials you need to read and write the code for Cormas models.
410

5-
**We encourage you to follow this tutorial hands‑on:** type each example in a Playground and try evaluating, printing, and inspecting it yourself. If you are new to Playground, check out our tutorial on [Running code in Pharo Playground](pharo-playground).
11+
**We encourage you to follow this tutorial hands‑on:** type each example in a Playground and try evaluating, printing, and inspecting it yourself. If you are new to Playground, check out our tutorial on [Running code in Pharo Playground](run-code-in-playground).
612

713
## Classes, Objects and Messages
814

0 commit comments

Comments
 (0)