private bool InputMolecule(WaldoType type)
        {
            InputFactory factory = Reactor.GetInputFactory(type);
            Atom         atom    = factory.Generate();

            return(atomManager.Add(atom));
        }
Beispiel #2
0
 /// <summary>
 /// Creates a new waldo with the specified (x,y) coordinate and starting direction.
 /// </summary>
 /// <param name="start">the start information for the waldo</param>
 /// <param name="bound">the rectangular grid the waldo is confined to</param>
 public Waldo(StartInstruction start, Rectangle bound, WaldoType type)
 {
     this.x                = start.x;
     this.y                = start.y;
     this.bound            = bound;
     this.Type             = type;
     this.CurrentDirection = start.direction;
     this.Atom             = null;
 }
Beispiel #3
0
 /// <summary>
 /// Gets the direction and instruction on the tile for the given waldo type.
 /// </summary>
 /// <param name="type">the waldo type (alpha or beta)</param>
 /// <returns>the direction and instruction commands</returns>
 public Tuple <Direction, Instruction> GetCommands(WaldoType type)
 {
     if (type == WaldoType.Alpha)
     {
         return(new Tuple <Direction, Instruction>(directionAlpha, instructionAlpha));
     }
     else
     {
         return(new Tuple <Direction, Instruction>(directionBeta, instructionBeta));
     }
 }
 private bool RemoveOutput(WaldoType type)
 {
     if (type == WaldoType.Alpha)
     {
         return(atomManager.RemoveTargetOuput(Reactor.AlphaOutput.ExpectedAtom.Molecule, Reactor.outZoneAlpha));
     }
     else
     {
         return(atomManager.RemoveTargetOuput(Reactor.BetaOutput.ExpectedAtom.Molecule, Reactor.outZoneBeta));
     }
 }
 public InputFactory GetInputFactory(WaldoType type)
 {
     return(type == WaldoType.Alpha ?
            AlphaInput : BetaInput);
 }