Tweaked some scripts

This commit is contained in:
2023-02-14 09:21:22 +00:00
parent 0737b2a483
commit 57af5a6d59
3 changed files with 16 additions and 29 deletions

View File

@@ -1,3 +1,18 @@
/*
How to run this program:
toyrepl -n -t scripts/level.toy
How to move around:
move(up);
move(down);
move(left);
move(right);
*/
//constants
var WIDTH: int const = 12;
var HEIGHT: int const = 12;

View File

@@ -1,5 +1,5 @@
//number of iterations
var SIZE: int const = 260;
var SIZE: int const = 100;
//lookup table
var lookup = [

View File

@@ -1,28 +0,0 @@
import standard;
//test every
{
var a = [1, 2, 3];
var d = ["one": 1, "two": 2];
var counter = 0;
fn f(k, v) {
print " > " + string k + " : " + string v;
counter++;
return v;
}
assert a.every(f) == true, "array.every() == true failed";
assert d.every(f) == true, "dictionary.every() == true failed";
assert counter == 5, "Unexpected number of calls for _every() == true";
counter = 0;
a[1] = false;
d["two"] = false;
assert a.every(f) == false, "array.every() == false failed";
assert d.every(f) == false, "dictionary.every() == false failed";
assert counter == 4, "Unexpected number of calls for _every() == false";
}