-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
71 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,26 @@ | ||
|
||
// will print "1 2 3 ", "2 3 4 ", "3 4 5 ", ... | ||
import time | ||
list = [a, b] | ||
|
||
list = [a, b, c] | ||
|
||
set a 1 | ||
set b 2 | ||
set c 3 | ||
for el in list | ||
set el 1 | ||
|
||
#ref loop | ||
for x in list | ||
op add x x 1 | ||
print x | ||
print " " | ||
|
||
|
||
time.wait(1) | ||
printflush message1 | ||
printflush message | ||
jump loop | ||
|
||
|
||
---------------------- | ||
|
||
|
||
set a 1 | ||
set b 2 | ||
set c 3 | ||
set b 1 | ||
op add a a 1 | ||
print a | ||
print " " | ||
op add b b 1 | ||
print b | ||
print " " | ||
op add c c 1 | ||
print c | ||
print " " | ||
set tmp2 1 | ||
op add returnAddress-time-wait @counter 1 | ||
jump 18 always true true | ||
printflush message1 | ||
jump 3 always true true | ||
end | ||
set tmp1 @time | ||
op mul tmp2 tmp2 1000 | ||
op add tmp3 tmp1 tmp2 | ||
jump 21 greaterThanEq tmp3 @time | ||
set @counter returnAddress-time-wait | ||
printflush message | ||
jump 2 always true true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,26 @@ | ||
|
||
set message message1 | ||
|
||
print "hi !, what is the value of x and y ?" | ||
printflush message | ||
wait(1.6) // wait 1.6 secondes | ||
|
||
set x @thisx | ||
set y @thisy | ||
print "x:" | ||
print x | ||
print " y:" | ||
print y | ||
printAndWait("\n and now we will wait two secondes", message) | ||
|
||
printAndWait("2s have passed !", message) | ||
|
||
set tmp2 "we could also use tmpX variables freely" | ||
printAndWait(tmp2, message) | ||
|
||
|
||
printAndWait(msg, messageX) | ||
show(msg, m) | ||
print msg | ||
printflush messageX | ||
wait(2) | ||
|
||
|
||
wait(secondes) | ||
set timestamps @time | ||
op mul secondes secondes 1000 | ||
op add timestampsToWait timestamps secondes | ||
printflush m | ||
|
||
// can jump on himself, not possible on game UI | ||
#ref waiting | ||
jump waiting timestampsToWait >= @time | ||
set m message1 | ||
show("hi!", m) | ||
show("how are you", m) | ||
|
||
|
||
---------------------- | ||
|
||
|
||
set message message1 | ||
print "hi !, what is the value of x and y ?" | ||
printflush message | ||
set tmp5 1.6 | ||
op add returnAddress-None-wait @counter 1 | ||
jump 26 always true true | ||
set x @thisx | ||
set y @thisy | ||
print "x:" | ||
print x | ||
print " y:" | ||
print y | ||
set tmp1 "\n and now we will wait two secondes" | ||
set tmp3 message | ||
op add returnAddress-None-printAndWait @counter 1 | ||
jump 31 always true true | ||
set tmp1 "2s have passed !" | ||
set tmp3 message | ||
op add returnAddress-None-printAndWait @counter 1 | ||
jump 31 always true true | ||
set tmp2 "we could also use tmpX variables freely" | ||
set tmp1 tmp2 | ||
set tmp3 message | ||
op add returnAddress-None-printAndWait @counter 1 | ||
jump 31 always true true | ||
set m message1 | ||
set tmp1 "hi!" | ||
set tmp2 m | ||
op add returnAddress-None-show @counter 1 | ||
jump 10 always true true | ||
set tmp1 "how are you" | ||
set tmp2 m | ||
op add returnAddress-None-show @counter 1 | ||
jump 10 always true true | ||
end | ||
set tmp4 @time | ||
op mul tmp5 tmp5 1000 | ||
op add tmp6 tmp4 tmp5 | ||
jump 29 greaterThanEq tmp6 @time | ||
set @counter returnAddress-None-wait | ||
print tmp1 | ||
printflush tmp3 | ||
set tmp5 2 | ||
op add returnAddress-None-wait @counter 1 | ||
jump 26 always true true | ||
set @counter returnAddress-None-printAndWait | ||
printflush tmp2 | ||
set @counter returnAddress-None-show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,23 @@ | ||
|
||
// a code to fix to a screen, a message box and a power node | ||
// | ||
// it will give a color depending of electicity net production | ||
|
||
sensor in node1 @powerNetIn | ||
sensor out node1 @powerNetOut | ||
|
||
// get net power produced with: | ||
op sub net in out | ||
op floor net net out // floor number to be always humain readable | ||
print "power: " | ||
print net | ||
printflush message1 | ||
// put all printed message ("power: " + net) in message1 | ||
// (need a message box liked to processor to see it) | ||
|
||
// color to corresponding power produced: | ||
|
||
if net >= 1200 | ||
// green color | ||
draw clear 0 1000 0 0 0 0 | ||
elif net >= 500 | ||
// yellow | ||
draw clear 1000 1000 0 0 0 0 | ||
set x 1 | ||
#ref loop | ||
if x < 4 | ||
op add x x 1 | ||
elif x == 4 | ||
print x | ||
else | ||
// red | ||
draw clear 1000 0 0 0 0 0 | ||
|
||
// draw the choosen color on display1 | ||
drawflush display1 | ||
|
||
// wait a short time to avoid disturbing blink colors change | ||
|
||
set wait 0 | ||
#ref waiting | ||
op add wait wait 1 | ||
jump waiting wait <= 200 | ||
end | ||
jump loop | ||
|
||
|
||
---------------------- | ||
|
||
|
||
sensor in node1 @powerNetIn | ||
sensor out node1 @powerNetOut | ||
op sub net in out | ||
op floor net net out | ||
print "power: " | ||
print net | ||
printflush message1 | ||
jump 13 greaterThanEq net 1200 | ||
jump 11 greaterThanEq net 500 | ||
draw clear 1000 0 0 0 0 0 | ||
jump 14 always true true | ||
draw clear 1000 1000 0 0 0 0 | ||
jump 14 always true true | ||
draw clear 0 1000 0 0 0 0 | ||
drawflush display1 | ||
set wait 0 | ||
op add wait wait 1 | ||
jump 16 lessThanEq wait 200 | ||
set x 1 | ||
jump 7 lessThan x 4 | ||
jump 5 equal x 4 | ||
end | ||
jump 8 always true true | ||
print x | ||
jump 8 always true true | ||
op add x x 1 | ||
jump 1 always true true |
Oops, something went wrong.