mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Tweaked some scripts
This commit is contained in:
@@ -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
|
//constants
|
||||||
var WIDTH: int const = 12;
|
var WIDTH: int const = 12;
|
||||||
var HEIGHT: int const = 12;
|
var HEIGHT: int const = 12;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//number of iterations
|
//number of iterations
|
||||||
var SIZE: int const = 260;
|
var SIZE: int const = 100;
|
||||||
|
|
||||||
//lookup table
|
//lookup table
|
||||||
var lookup = [
|
var lookup = [
|
||||||
|
|||||||
@@ -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";
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user