2019-12-09 13:20:04 +01:00
|
|
|
package intcode.opcode
|
|
|
|
|
2019-12-09 22:23:43 +01:00
|
|
|
/** Input
|
|
|
|
* Takes a single integer as input and saves it to the position given by its only parameter.
|
|
|
|
*/
|
|
|
|
case object OpCode3 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:23:43 +01:00
|
|
|
def input(tape: Array[Long], relative: Long, param1: Long, mode1: Int, input: Long): Unit =
|
2019-12-09 13:20:04 +01:00
|
|
|
{
|
|
|
|
writer(tape, relative, param1, mode1, input)
|
|
|
|
}
|
|
|
|
}
|