public AllTest(string choice) { InitializeComponent(); jp2 = JudgmentFactory.makeJudgment(); if (choice == "函数一") { pp2 = PlayerFactory.makePlayer(1); } else if (choice == "函数二") { pp2 = PlayerFactory.makePlayer(2); } else if (choice == "函数三") { pp2 = PlayerFactory.makePlayer(3); } }
public PlayerToPC(string choice) { InitializeComponent(); Hashtable hashtable = new Hashtable(); Random rm = new Random(); int RmNum = 4; int j = 0; for (int i = 0; hashtable.Count < RmNum; i++) { int nValue = rm.Next(10); if (!hashtable.ContainsValue(nValue) && nValue != 0) { hashtable.Add(nValue, nValue); test4[j] = nValue; j++; } } num2 = test4[0] * 1000 + test4[1] * 100 + test4[2] * 10 + test4[3]; jp2 = JudgmentFactory.makeJudgment(); if (choice == "函数一") { pp2 = PlayerFactory.makePlayer(1); } else if (choice == "函数二") { pp2 = PlayerFactory.makePlayer(2); } else if (choice == "函数三") { pp2 = PlayerFactory.makePlayer(3); } pp2.init(); jp2.init(); }