Class Program

java.lang.Object
dev.zemco.codegame.programs.Program

public class Program extends Object
Program is a set of instructions to be followed during execution. Each program consists of instruction descriptors and jump label mappings.

Programs may be solutions to problems created by the player. Programs are immutable.

Author:
Erik Zemčík
  • Constructor Details

    • Program

      public Program(List<InstructionDescriptor> instructionDescriptors, Map<String,Integer> jumpLabelToLinePositionMap)
      Creates an instance of Program.
      Parameters:
      instructionDescriptors - instruction descriptors list of this program, ordered in a way they should be executed
      jumpLabelToLinePositionMap - jump label to line position map of this program
      Throws:
      IllegalArgumentException - if instructionDescriptors is null or if jumpLabelToLinePositionMap is null
  • Method Details

    • getInstructionDescriptors

      public List<InstructionDescriptor> getInstructionDescriptors()
      Returns instruction descriptors of this program, ordered in a way they should be executed.
      Returns:
      unmodifiable list of instruction descriptors
    • getJumpLabelToLinePositionMap

      public Map<String,Integer> getJumpLabelToLinePositionMap()
      Returns jump label to line position mappings used for jumping to a specific position during execution.
      Returns:
      unmodifiable map of jump label mappings