Add more small test programs.
This commit is contained in:
parent
230a50c532
commit
61fb44bbce
3
programs/basic_draw_number.chalk
Normal file
3
programs/basic_draw_number.chalk
Normal file
|
@ -0,0 +1,3 @@
|
|||
fun main(): u0 {
|
||||
draw_number(69, 1, 1);
|
||||
}
|
17
programs/basic_if.chalk
Normal file
17
programs/basic_if.chalk
Normal file
|
@ -0,0 +1,17 @@
|
|||
fun main(): u0 {
|
||||
var a = 3+3;
|
||||
if(a) {
|
||||
a = 0;
|
||||
}
|
||||
|
||||
var b = 0;
|
||||
if(b) {
|
||||
b = 4;
|
||||
}
|
||||
|
||||
if(b) {
|
||||
b = 4;
|
||||
} else {
|
||||
b = 5;
|
||||
}
|
||||
}
|
4
programs/basic_input.chalk
Normal file
4
programs/basic_input.chalk
Normal file
|
@ -0,0 +1,4 @@
|
|||
fun main(): u0 {
|
||||
var a = get_key();
|
||||
var b = get_key();
|
||||
}
|
8
programs/basic_while.chalk
Normal file
8
programs/basic_while.chalk
Normal file
|
@ -0,0 +1,8 @@
|
|||
fun main(): u0 {
|
||||
var a = 5;
|
||||
var b = 0;
|
||||
while(a) {
|
||||
b = b + 2;
|
||||
a = a - 1;
|
||||
}
|
||||
}
|
14
programs/comb_fib.chalk
Normal file
14
programs/comb_fib.chalk
Normal file
|
@ -0,0 +1,14 @@
|
|||
fun main(): u0 {
|
||||
var a = 1;
|
||||
var b = 1;
|
||||
while(233 - a) {
|
||||
draw_number(a, 24, 13);
|
||||
set_delay(30);
|
||||
var temp = a;
|
||||
a = b;
|
||||
b = b + temp;
|
||||
while(get_delay()){}
|
||||
draw_number(temp, 24, 13);
|
||||
}
|
||||
draw_number(a, 24, 13);
|
||||
}
|
13
programs/comb_input.chalk
Normal file
13
programs/comb_input.chalk
Normal file
|
@ -0,0 +1,13 @@
|
|||
fun main(): u0 {
|
||||
var a = 1;
|
||||
var b = 0;
|
||||
var previous = 0;
|
||||
draw_number(0, 24, 13);
|
||||
|
||||
while(a) {
|
||||
previous = b;
|
||||
b = get_key();
|
||||
draw_number(previous, 24, 13);
|
||||
draw_number(b, 24, 13);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user