Packages

t

o1.robots.tribal

Instruction

trait Instruction extends AnyRef

The trait Instruction represents instructions within RoboSpeak programs. The program of each Tribe consists of instruction objects; a TribalBot is able to execute sequences of instructions.

A single Instruction object represents an instruction for a tribal robot to do something. By way of example, here are two RoboSpeak instructions in textual form, each of which can also be represented by an Instruction object:

turn
goto 1

See the documentation of class Tribe for more details and examples of RoboSpeak.

There are various kinds of instruction objects representing the various kinds of instructions that can appear in RoboSpeak programs. However, all instructions share the common interface described by this trait. Through this interface, instructions can be examined and executed. Each instruction object, irrespective of what is does, provides the following:

  • Methods for determining basic information about the instruction: Does executing the instruction end a tribal robot's turn? On which line in a RoboSpeak program does the instruction appear?
  • A method for executing the instruction and determining which instruction to execute next.

An instruction object is immutable.

See also

Tribe

TribalBot

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Instruction
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def endsTurn: Boolean

    Determines if this instruction is of a type which ends the acting robot's turn when executed.

    Determines if this instruction is of a type which ends the acting robot's turn when executed. (move does, for instance, while ifempty does not.)

  2. abstract def execute(actor: TribalBot): Instruction

    Causes the given tribal bot to execute the instruction.

    Causes the given tribal bot to execute the instruction. What happens as a result depends on the instruction. In the case of an action instruction such as move or hack, the tribal bot does something visible. In the case of a logic instruction such as ifempty, goto or callsub, nothing visible happens immediately, but the bot does something which affects its future behavior.

    This method also determines the next instruction that is to be executed by the acting robot next after this instruction is done with. The next instruction may be either the instruction on the following line of the RoboSpeak program (e.g., after a move instruction, or after an ifempty when the square ahead is not empty), or it may be an instruction somewhere else in the program (e.g., after a goto, or after an ifempty when the square ahead is empty).

    actor

    a tribal bot whose turn it is and who is to execute the instruction

    returns

    the next instruction that is to be executed by the actor after this one (possibly only during a future turn)

  3. abstract def lineNumber: Int

    Returns the number of the line (1 or higher) that the instruction appears on the RoboSpeak program that it is a part of.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. def toString: String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped