private void PlaceWarrior(RunningWarrior warrior, int address) { var statements = warrior.Warrior.Statements; for (var i = 0; i < statements.Count; ++i) { Memory[address + i] = new Instruction(statements[i], ModularArith.Mod(address + i), warrior.Index); } }
public GameEngine(IEnumerable <WarriorStartInfo> warriorsStartInfos) { Memory = new Memory(Parameters.CoreSize); Warriors = new List <RunningWarrior>(); var idx = 0; foreach (var wsi in warriorsStartInfos) { var warrior = new RunningWarrior(wsi.Warrior, idx++, wsi.LoadAddress, Parameters.CoreSize); Warriors.Add(warrior); PlaceWarrior(warrior, wsi.LoadAddress); } CurrentWarrior = 0; CurrentStep = 0; countLivedWarriors = Warriors.Count; }
private void ExecuteInstruction(RunningWarrior warrior, Instruction instruction) { instructionExecutor.Execute(this, instruction); warrior.LastPointer = (uint)instruction.Address; }