当前位置: 首页>>代码示例>>C#>>正文


C# IInstruction类代码示例

本文整理汇总了C#中IInstruction的典型用法代码示例。如果您正苦于以下问题:C# IInstruction类的具体用法?C# IInstruction怎么用?C# IInstruction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IInstruction类属于命名空间,在下文中一共展示了IInstruction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Parse_All

		public void Parse_All()
		{
			var reader = ConsolePlatformTester.LoadInput("input.simple.txt");
			var actual = Instruction.Read(reader).ToArray();

			var expected = new IInstruction[]
			{
				// Settings
				new HandsPerLevelInstruction(10),
				new StartingStackInstruction(2000),
				new YourBotInstruction(PlayerName.player1),
				new TimeBankInstruction(TimeSpan.FromSeconds(10)),
				new TimePerMoveInstruction(TimeSpan.FromMilliseconds(500)),
				// Match
				new RoundInstruction(1),
				new SmallBlindInstruction(10),
				new BigBlindInstruction(20),
				// Player
				new OnButtonInstruction(PlayerName.player2),
				new StackInstruction(PlayerName.player1, 2000),
				new StackInstruction(PlayerName.player2, 2000),
				new PostInstruction(PlayerName.player2, 10),
				new PostInstruction(PlayerName.player1, 20),
				new HandInstruction(PlayerName.player1, Cards.Parse("[9c,7h]")),
				new ActionInstruction(PlayerName.player2, GameAction.Call),
			};

			CollectionAssert.AreEqual(expected, actual.Take(expected.Length).ToArray());
			Assert.AreEqual(0, actual.Length);
		}
开发者ID:Corniel,项目名称:AIGames.TexasHoldEm.ACDC,代码行数:30,代码来源:InstructionTest.cs

示例2: ResolveLables

 public void ResolveLables(IInstruction[] instructions)
 {
     if (IsResolved) return;
     int pos = 0;
     for(int i = 0; i < instructions.Length; i++)
     {
         if(this.labels.AsEnumerable().Any(x => x == instructions[i].Label))
         {
             if (this.additional.Length == 1)
             {
                 this.additional[0] = (ushort) pos;
                 this.IsResolved = true;
             } else if(this.additional.Length== 2)
             {
                 if (this.labels.First() == instructions[i].Label)
                 {
                     this.additional[0] = (ushort)pos;
                     this.labels[0] = string.Empty;
                 }
                 if(this.labels[1] == instructions[i].Label)
                 {
                     this.additional[1] = (ushort) pos;
                     this.labels[1] = string.Empty;
                 }
                 this.IsResolved = this.labels.All(s => s == string.Empty);
             }
         }
         pos += instructions[i].Size;
     }
 }
开发者ID:FredrikL,项目名称:DCPU16,代码行数:30,代码来源:Instruction.cs

示例3: InstructionWidget

        public InstructionWidget( IInstruction op )
        {
            InitializeComponent();
            this.Font    = new Font("Lucida Console", 8.25f);
            m_ItalicFont = new Font(this.Font, FontStyle.Italic);

            this.Height = 15;
            this.Executed = true;
            m_Op = op;
            Selected = false;

            if (op is Scrutinizer.ISamplingInstruction)
            {
                Panel panel = new Panel();
                m_FilterBox = CreateFilterBox(op);
                m_FormatBox = CreateFormatBox(op);
                panel.Anchor = AnchorStyles.Right;
                panel.Width = m_FilterBox.Width + m_FormatBox.Width;
                m_FilterBox.Left = m_FormatBox.Width;
                panel.Controls.Add(m_FilterBox);
                panel.Controls.Add(m_FormatBox);
                this.Controls.Add(panel);
            }
            else if (op is Scrutinizer.ITextureInstruction)
            {
                m_FormatBox = CreateFormatBox(op);
                m_FormatBox.Anchor = AnchorStyles.Right;
                this.Controls.Add(m_FormatBox);
            }
        }
开发者ID:bobvodka,项目名称:Pyramid,代码行数:30,代码来源:InstructionWidget.cs

示例4: Execute

 public void Execute(IInstruction instruction)
 {
     var jtype = instruction as JTypeInstruction;
     if (jtype != null)
         JTypeExecutors[jtype.JumpType](jtype);
     else
     {
         var itype = instruction as ITypeInstruction;
         if (itype != null)
         {
             var cl = ITypeExecutors[itype.Opcode];
             cl(itype);
         }
         else
         {
             var rtype = instruction as RTypeInstruction;
             if (rtype != null)
                 RTypeExecutors[rtype.Function](rtype);
             else
             {
                 var coins = instruction as CoProcessorInstruction;
                 if (coins != null)
                     CoProcessorExecutors[coins.Format](coins);
             }
         }
     }
 }
开发者ID:bngreen,项目名称:Plasma-Emulator,代码行数:27,代码来源:InstructionExecutor.cs

示例5: InstructionWidget

        public InstructionWidget( IInstruction op )
        {
            InitializeComponent();
            this.Font   = new Font("Lucida Console", 8.25f);
            this.Height = 15;
            m_Op = op;
            this.Brush = Brushes.Black;

            if (op is Scrutinizer.ITexelLoadInstruction)
            {
                ComboBox cb = CreateFormatBox(op);
                cb.Anchor = AnchorStyles.Right;
                this.Controls.Add(cb);
            }
            if (op is Scrutinizer.ISamplingInstruction)
            {
                Panel panel = new Panel();
                ComboBox cbFilter = CreateFilterBox(op);
                ComboBox cbFormat = CreateFormatBox(op);
                panel.Anchor = AnchorStyles.Right;
                panel.Width = cbFilter.Width + cbFormat.Width;
                cbFilter.Left = cbFormat.Width;
                panel.Controls.Add(cbFilter);
                panel.Controls.Add(cbFormat);
                this.Controls.Add(panel);
            }
        }
开发者ID:Samana,项目名称:Pyramid,代码行数:27,代码来源:InstructionWidget.cs

示例6: GenerateFromInstruction

 private static string GenerateFromInstruction(IInstruction instruction)
 {
     var bytes = instruction.GetReportData();
     var sb = new StringBuilder();
     sb.Append("WR ");
     AppendBytesAsString(bytes, sb);
     return sb.ToString();
 }
开发者ID:TransistorLabs,项目名称:GlowBeanGlow,代码行数:8,代码来源:HidCodeGenerator.cs

示例7: ResolveSymbolicInstructions

        public IEnumerable<IInstruction> ResolveSymbolicInstructions(IInstruction[] instructions)
        {
            // must go through labels first, removing them when they've been added to the symbol table
            var linesWithLabelsRemoved = _hackLabelResolver.ResolveLabels(_symbolTable, instructions).ToArray();

            // then go through variables, resolving them after adding to table if not already there
            return _hackVariableResolver.ResolveVariables(_symbolTable, linesWithLabelsRemoved).ToArray();
        }
开发者ID:pavlosmcg,项目名称:furry-octo-computing-machine,代码行数:8,代码来源:HackSymbolResolver.cs

示例8: Apply

		public bool Apply(IInstruction instruction)
		{
			if (Mapping.ContainsKey(instruction.GetType()))
			{
				Mapping[instruction.GetType()].Invoke(instruction, this);
				return true;
			}
			return false;
		}
开发者ID:Corniel,项目名称:AIGames.BlockBattle.Kubisme,代码行数:9,代码来源:GameState.cs

示例9: BreakpointViewModel

        public BreakpointViewModel(IGameBoy gameboy, IInstruction inst)
        {
            _gameboy = gameboy;
              _instruction = inst;

              OriginalAddress = inst.Address;
              Address = "0x" + inst.Address.ToString("x2");
              Name = inst.Name;
        }
开发者ID:cristiandonosoc,项目名称:GBSharp,代码行数:9,代码来源:BreakpointViewModel.cs

示例10: PortfolioCompareSetting

        /// <summary>
        /// Initializes a new instance of the <see cref="T:B4F.TotalGiro.PortfolioComparer.PortfolioCompareSetting">PortfolioCompareSetting</see> class.
        /// </summary>
        /// <param name="compareAction">
        /// When this argument equals 'CloseOrders' it is checked whether positions exist that do not exist in the modelportfolio. 
        /// When this is the case this will result in only sell close size based orders.
        /// When the argument equals 'Rebalance' a normal rebalance is done.
        /// However the method will generate an error when positions do exist that do not exist in the modelportfolio.
        /// When the argument equals 'CashFundOrders' the remaining cash will be transferred to cash fund.
        /// </param>
        /// <param name="instruction">The instruction that generated the orders</param>
        /// <param name="engineParams">The parameters used in porfolio compare action</param>
        public PortfolioCompareSetting(PortfolioCompareAction compareAction, IInstruction instruction, InstructionEngineParameters engineParams)
        {
            if (instruction == null)
                throw new ApplicationException("The instruction is mandatory");

            this.CompareAction = compareAction;
            this.Instruction = instruction;
            this.EngineParams = engineParams;
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:21,代码来源:PortfolioCompareSetting.cs

示例11: Instruction

 public Instruction(IInstruction src)
 {
     Operation = src.Operation;
     Modifier = src.Modifier;
     ModeA = src.ModeA;
     ValueA = src.ValueA;
     ModeB = src.ModeB;
     ValueB = src.ValueB;
 }
开发者ID:pavelsavara,项目名称:nMars,代码行数:9,代码来源:Instruction.cs

示例12: CancelInstruction

        /// <summary>
        /// This method tries to cancel the instruction (if allowed).
        /// </summary>
        /// <param name="instruction">The <see cref="T:B4F.TotalGiro.Accounts.Instructions.Instruction">Instruction</see> to process</param>
        /// <param name="cancelOrders">The cancelled orders that might result from the processing</param>
        /// <returns>true when succesfull</returns>
        public bool CancelInstruction(IInstruction instruction)
        {
            int oldStatus = instruction.Status;
            string oldMessage = instruction.Message;
            int nextStatus;

            nextStatus = stateMachine.SetStatus(getStateTable(instruction.InstructionType), (int)oldStatus, (int)InstructionEvents.evCancel, (IStateMachineClient)instruction);
            if (nextStatus != 0)
                instruction.Status = nextStatus;
            return (instruction.Status != oldStatus || instruction.Message != oldMessage);
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:17,代码来源:InstructionEngine.cs

示例13: Given

        public override void Given()
        {
            this.StubbedRover = stub_a<IRover>();
            this.StubbedPlateau = stub_a<IPlateau>();
            this.StubbedInstruction = stub_a<IInstruction>();
            this.StubbedPositionChecks = stub_a<List<IPositionCheck>>();

            this.PlateauController = new PlateauController(this.StubbedPlateau);
            this.PlateauController.PositionChecks = this.StubbedPositionChecks;
            this.StubbedRover.Instruction = this.StubbedInstruction;
        }
开发者ID:blair55,项目名称:MarsRover,代码行数:11,代码来源:ObjectTests.cs

示例14: LogInstruction

 private void LogInstruction(IInstruction instruction, byte opCode)
 {
     var instructionSize = instruction.Variants[opCode].InstructionSize();
     var instructionBytes = mem.SequenceFrom(state.Pc).Take(instructionSize).ToArray();
     Console.WriteLine("{0:X2}  {1,-10}{2,-32}A:{3:X2} X:{4:X2} Y:{5:X2} P:{6:X2} SP:{7:X2}", // TODO: Cycle and scanline goes at the end
         state.Pc,
         string.Join(" ", instructionBytes.Select(x => x.ToString("X2"))),
         instruction.Disassemble(instructionBytes),
         state.A,
         state.X,
         state.Y,
         state.StatusRegister,
         state.Sp);
 }
开发者ID:Cyberlane,项目名称:LeetNES,代码行数:14,代码来源:Cpu.cs

示例15: Program

        /// <summary>
        /// Creates a new Program
        /// </summary>
        /// <param name="processor">the processor for this program</param>
        /// <param name="instructions">the program instructions</param>
        /// <param name="debugInfo">optional program debug information</param>
        public Program(Processor processor, IList<IInstruction> instructions,
                        ProgramDebugInfo debugInfo = null)
        {
            this.DebugInfo = debugInfo;
            this.Processor = processor;

            // Check instructions size
            if (instructions.Count > processor.RomSize)
            {
                throw new ArgumentException("Number of instructions > size of instruction ROM");
            }

            // Create new readonly instructions array
            IInstruction[] instructionArray = new IInstruction[processor.RomSize];
            instructions.CopyTo(instructionArray, 0);
            this.Instructions = new ReadOnlyCollection<IInstruction>(instructionArray);
        }
开发者ID:jcowgill,项目名称:PicoBlazeSim,代码行数:23,代码来源:Program.cs


注:本文中的IInstruction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。