hakk_builder 0.0.1
hakk_builder: ^0.0.1 copied to clipboard
A standalone API for building a hakk for use with the game `hakk.it` at http://hakk.it
Hakk Builder #
Hakk builder is an API that allows you to construct hakkML source code using Dart.
The generated source code can then be uploaded to http://hakk.it and used in competition.
Hello World #
Using the builder, you would construct the Hakk like this.
final myHakk =
hakk('hello_world', (){
blocks((){
B.entry('main', 0, 1);
});
code((){
codeBlock('main', (){
I.out('Hello World');
I.exit(0);
});
});
})
print(myHakk);
The builder generates the hakkML and outputs:
name: hello_world
blocks:
- core:
- entry: {name: "main", loc : [0, 1]}
code:
main:
- out: "Hello World"
- exit: 0
Saving The Result #
Using the example above, this library provides a helper function to save the generated source code:
saveToFile('my_hakk', myHakk);
You could of course use dart:io to save, or do whatever else you want with the source code.