move reset to abstract class

This commit is contained in:
2018-11-27 13:35:40 -05:00
parent dd6076441c
commit ffab11f785
2 changed files with 6 additions and 5 deletions

View File

@@ -24,11 +24,6 @@ class Interpreter93(stdinSrc: PipedWriter, stdoutDest: PipedReader)
override val stdout: PipedWriter = PipedWriter(stdoutDest)
override val instructionSet = B93Instructions() + B93Extras()
override fun reset() {
stdin.readAll()
stdout.flush()
}
}
fun main(args: Array<String>) {

View File

@@ -7,6 +7,7 @@ import befide.befunge.core.state.Data
import befide.befunge.core.state.MutableFunge
import befide.befunge.core.state.MutablePointer
import befide.befunge.core.util.Event
import befide.befunge.core.util.readAll
import java.util.*
abstract class MutableInterpreter<V, D : Data, M : Enum<M>>
@@ -67,4 +68,9 @@ abstract class MutableInterpreter<V, D : Data, M : Enum<M>>
notifyStack(StackOp.Push) { stack.push(datum) }
}
}
override fun reset() {
stdin.readAll()
stdout.flush()
}
}