| 1 |
# Soros Tutorial β Part One π’ Three, Two, One... |
| 2 |
# |
| 3 |
# INTRODUCTION |
| 4 |
# |
| 5 |
# Soros programming language is for number to |
| 6 |
# number name conversion. Itβs based on regular |
| 7 |
# expressions, the popular text processing |
| 8 |
# tool of modern programming languages. So if you |
| 9 |
# donβt want to convert numbers to number names, |
| 10 |
# itβs still worth to check this tutorial, because |
| 11 |
# most parts are about regular expressions, |
| 12 |
# giving useful information for modern C++, Java, |
| 13 |
# JavaScript, Python etc. programming, too. |
| 14 |
# If you know regular expressions well, you can |
| 15 |
# jump to the last part of the tutorial! |
| 16 |
# |
| 17 |
# In this part, we will learn the base syntax of |
| 18 |
# Soros, writing small programs to convert |
| 19 |
# input numbers to numbers and colorful (at least |
| 20 |
# in Mozilla Firefox) emojis! |
| 21 |
# |
| 22 |
# |
| 23 |
# |
| 24 |
# TASK 1 β HELLO, WORLD! |
| 25 |
# |
| 26 |
# A Soros program consists of program lines. |
| 27 |
# |
| 28 |
# A program line is an input text and an output text |
| 29 |
# separated by (the first) space: |
| 30 |
# |
| 31 |
# input_text output text |
| 32 |
# |
| 33 |
# Following program line replaces the input text β0β |
| 34 |
# with the output text βHello, π!β, as you can see |
| 35 |
# in the right output list window, which shows the |
| 36 |
# output of the first 120 integer numbers, including |
| 37 |
# this one: |
| 38 |
|
| 39 |
0 Hello, π! |
| 40 |
|
| 41 |
# Replace βHello, π!β with βzeroβ in the previous line, |
| 42 |
# and check the same change in the right output window |
| 43 |
# list! |
| 44 |
# |
| 45 |
# Write here a new program line to convert the input |
| 46 |
# text β1β to βoneβ! |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
# TASK 2 β The early bird catches the worm. |
| 51 |
# |
| 52 |
# First matching program line gives result. |
| 53 |
# |
| 54 |
# Remove the line with the bird COMPLETELY, and |
| 55 |
# then the line with the worm! During these, check |
| 56 |
# the results in the right output list window! |
| 57 |
|
| 58 |
2 π¦ |
| 59 |
2 π |
| 60 |
2 two |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
# TASK 3 β Three blind mice |
| 65 |
# |
| 66 |
# Input text without matching program line, or a |
| 67 |
# matching program line without output text |
| 68 |
# results empty output text. |
| 69 |
# |
| 70 |
# Remove the character # (sign of comment line) |
| 71 |
# before 3 in the following line to hide the mice! |
| 72 |
|
| 73 |
#3 |
| 74 |
3 πππ |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
# TASK 4 β Five little speckled frogs |
| 79 |
# |
| 80 |
# Modify the following program lines to get correct |
| 81 |
# number of frogs for the input number 5 and 4! |
| 82 |
|
| 83 |
5 πΈπΈπΈπΈπΈπΈ |
| 84 |
4 πΈπΈπΈπΈπΈπΈ |
| 85 |
|
| 86 |
SCROLL DOWN FOR SOLUTION |
| 87 |
β©β©β©β©β©β©β©β©β©β©β©β©β©β©β©β©β©β©β©β©β©β©β©β© |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
# Solution β TASK 4 |
| 109 |
# |
| 110 |
# 5 πΈπΈπΈπΈπΈ |
| 111 |
# 4 πΈπΈπΈπΈ |
| 112 |
|
| 113 |
|
| 114 |
###################################################### |
| 115 |
# CONGRATULATIONS β You have finished Tutorial One! π |
| 116 |
###################################################### |