public class Command
extends java.lang.Object
Holds methods for computing all possible instructions of 88' Standard of CoreWars
| Constructor and Description |
|---|
Command() |
| Modifier and Type | Method and Description |
|---|---|
protected static int |
add(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
add
adds the content addressed in field A to the content addressed in field B.
|
protected static int |
cmp(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
cmp
Computes a skip of the next instruction if field A equals field B
|
protected static int |
djn(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
djn
it decrements the content of field B and jumps to the address in field A if B is not zero
|
protected static int |
jmn(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
jmn
works like
jmp, except field B of the instruction must be not zero. |
protected static int |
jmp(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
jmp
sets the instruction ID to be returned to what is addressed in field A.
|
protected static int |
jmz(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
jmz
works like
jmp, except field B of the instruction must be zero. |
protected static int |
mov(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core,
Marker marker,
Players playerList,
GameHistory gameHistory)
mov
replaces an existing instruction addressed in field B of the instruction with field A corresponding to its
addressing mode.
|
protected static int |
slt(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
slt
Computes a skip of the next instruction if the content of field A is less than content of field B
|
protected static int |
spl(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core,
Players playerList)
spl
it adds the address in field A as a new process to an alternating list of processes.
|
protected static int |
sub(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
sub
subtracts the content addressed in field A from the content addressed in field B.the same instruction ID as
committed for further incrementing
|
protected static int mov(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core,
Marker marker,
Players playerList,
GameHistory gameHistory)
throws java.io.IOException
replaces an existing instruction addressed in field B of the instruction with field A corresponding to its
addressing mode.
moves an instruction addressed in field A to a position addressed in field B
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionAddressingMode,
Fieldprotected static int add(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
throws java.io.IOException
adds the content addressed in field A to the content addressed in field B.
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionAddressingMode,
Fieldprotected static int sub(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
throws java.io.IOException
subtracts the content addressed in field A from the content addressed in field B.the same instruction ID as committed for further incrementing
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionAddressingMode,
Fieldprotected static int jmp(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
throws java.io.IOException
sets the instruction ID to be returned to what is addressed in field A.
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionAddressingMode,
Fieldprotected static int jmz(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
throws java.io.IOException
works like jmp, except field B of the instruction must be zero.
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionsame instruction ID as committed for further incrementing,
Fieldprotected static int jmn(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
throws java.io.IOException
works like jmp, except field B of the instruction must be not zero.
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionAddressingMode,
Fieldprotected static int cmp(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
throws java.io.IOException
Computes a skip of the next instruction if field A equals field B
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionAddressingMode,
Fieldprotected static int slt(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
throws java.io.IOException
Computes a skip of the next instruction if the content of field A is less than content of field B
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionAddressingMode,
Fieldprotected static int djn(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core)
throws java.io.IOException
it decrements the content of field B and jumps to the address in field A if B is not zero
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionAddressingMode,
Fieldprotected static int spl(int instrID,
Instruction instruction,
RedCodeArrayList<Instruction> core,
Players playerList)
throws java.io.IOException
it adds the address in field A as a new process to an alternating list of processes.
in the next turn of the player the next one in the process list is called and so on.
instrID - - committed position of the instruction to be computedinstruction - -committed instruction to be computedjava.io.IOExceptionAddressingMode,
Field