File tree Expand file tree Collapse file tree 3 files changed +22
-14
lines changed
src/lib/interpreter/interpreter/stdlib Expand file tree Collapse file tree 3 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -126,8 +126,9 @@ All the Orion changes will be written here
126
126
127
127
## Fixed
128
128
129
- - Fixed boolean and arithmetic Scopes and Function Calls bugs (index problems)
130
- - Fixed trigonometry with radians instead of degrees
129
+ - Boolean and arithmetic Scopes and Function Calls bugs (index problems)
130
+ - Trigonometry with radians instead of degrees
131
+ - Input with a trim
131
132
132
133
## Added
133
134
Original file line number Diff line number Diff line change 32
32
}))
33
33
```
34
34
35
- ### Ackermann function
35
+ ### More or less game
36
36
37
37
``` lisp
38
- (define ack (lambda (m n) {
39
- (if (= m 0) {
40
- (+ n 1)
41
- } {
42
- (if (= n 0) {
43
- (ack (- m 1) 1)
44
- } {
45
- (ack (- m 1) (ack m (- n 1)))
46
- })
38
+ (math:initRng)
39
+ (define toGuess (math:rand 1 100))
40
+ (var guessed 0)
41
+ (var tries 0)
42
+
43
+ (while (!= guessed toGuess) {
44
+ (set tries (+ tries 1))
45
+ (set guessed (static_cast "int" (input "Input number: ")))
46
+ (if (< guessed toGuess) {
47
+ (print "More !")
48
+ } {
49
+ (if (> guessed toGuess) {
50
+ (print "Less !")
47
51
})
48
- }))
52
+ })
53
+ })
54
+ (print (+ "Well done, you found the number in " (+ (static_cast "string" tries) " tries")))
55
+
49
56
```
50
57
51
58
## Documentation
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ impl Interpreter {
26
26
io:: stdout ( ) . flush ( ) . unwrap ( ) ;
27
27
io:: stdin ( ) . read_line ( & mut line) . unwrap ( ) ;
28
28
Value :: String (
29
- line
29
+ line. trim ( ) . to_owned ( )
30
30
)
31
31
} )
32
32
}
You can’t perform that action at this time.
0 commit comments