Beispiel #1
0
        internal static IInstruction Parse(string[] splited)
        {
            PlayerName name;

            if (splited.Length == 4 && Enum.TryParse <PlayerName>(splited[1], true, out name) && name != PlayerName.None)
            {
                switch (splited[2])
                {
                case "row_points": return(RowPointsInstruction.Parse(name, splited));

                case "combo": return(ComboInstruction.Parse(name, splited));

                case "skips": return(SkipsInstruction.Parse(name, splited));

                case "field": return(FieldInstruction.Parse(name, splited));
                }
            }
            return(null);
        }
		public void Parse_FieldInstruction_Player2Array()
		{
			var act = Instruction.Parse("update player2 field 0,1,2,2;0,0,0,2;3,3,3,3");
			var exp = new FieldInstruction(PlayerName.Player2, new int[,]
			{
				{0, 1, 2, 2},
				{0, 0, 0, 2},
				{3, 3, 3, 3},
			});

			Assert.AreEqual(exp.ToString(), act.ToString());
		}