From 2cf498f7bf1311ebca156315a0c9ac25b0addef5 Mon Sep 17 00:00:00 2001 From: Cody Date: Tue, 27 Jun 2023 04:03:26 -0500 Subject: Working conways game of life --- examples/hello.sloth | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'examples/hello.sloth') diff --git a/examples/hello.sloth b/examples/hello.sloth index 8abb65c..75071c3 100644 --- a/examples/hello.sloth +++ b/examples/hello.sloth @@ -1,4 +1,23 @@ +foreign fn printdeez(nutz: Int); +foreign fn print(str: String); +foreign fn randGen(min: Int, max: Int) Int; + fn main() Int { + var x: [Int] = [5]; + vpopi(x); + var i: Int = 0; + while i < 100 { + vpushi(x, randGen(0, 100)); + i = i + 1; + } + + var y: Int = vgeti(x, 42); + var y: Int = vgeti(x, 45); + var y: Int = vgeti(x, 41); + var y: Int = vgeti(x, 49); + printdeez(y); + + print("Hello World\n"); return 0; } -- cgit v1.2.3