package net.shadowfacts.asmr.program import net.shadowfacts.asmr.program.blocks.StartBlock import net.shadowfacts.asmr.program.execution.ExecutableBlock import net.shadowfacts.cacao.geometry.Point /** * @author shadowfacts */ class Program { var startBlock = StartBlock().apply { position = Point.ORIGIN } val blocks = mutableListOf(startBlock) fun execute() { var currentBlock: ExecutableBlock? = startBlock.next() while (currentBlock != null) { currentBlock.execute() currentBlock = currentBlock.next() } } fun addBlock(block: Block, init: (Block) -> Unit = {}): Block { init(block) blocks.add(block) return block } }