advent-of-code/2019/Scala/intcode/opcode/OpCode4.scala

17 lines
400 B
Scala
Raw Permalink Normal View History

2019-12-09 13:20:04 +01:00
package intcode.opcode
2019-12-09 22:24:54 +01:00
/** Output
* Outputs the value of its only parameter.
*/
case object OpCode4 extends OpCode
2019-12-09 13:20:04 +01:00
{
/** length of an instruction */
override val length: Int = 2
/** Executes instruction for given parameters and modes */
2019-12-09 22:24:54 +01:00
def output(tape: Array[Long], relative: Long, param1: Long, mode1: Int): Long =
2019-12-09 13:20:04 +01:00
{
accessor(relative, param1, mode1, tape)
}
}