public void AI_MjesovitaSimulacijaIspravnoDajeTaktike() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 2, 3, 3, 4 }); Polje p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaNapipavanjeRazmak)); ai.ObradiPogodak(rezultatGadjanja.promasaj); p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaNapipavanjeRazmak)); ai.ObradiPogodak(rezultatGadjanja.pogodak); p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaTrazenjeSmjeraRazmak)); ai.ObradiPogodak(rezultatGadjanja.promasaj); p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaTrazenjeSmjeraRazmak)); ai.ObradiPogodak(rezultatGadjanja.pogodak); p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaUnistavanjeRazmak)); ai.ObradiPogodak(rezultatGadjanja.promasaj); p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaTrazenjeSmjeraRazmak)); ai.ObradiPogodak(rezultatGadjanja.pogodak); p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaUnistavanjeRazmak)); ai.ObradiPogodak(rezultatGadjanja.potopljen); p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaNapipavanjeRazmak)); }
void NextGame() { NextGameButtonVisibility = Visibility.Collapsed; GameMessage = ""; Title = "Diff " + Difficulty; WholeBoard = new PentagoBoard(); base.RaisePropertyChanged("WholeBoard"); var AI = AIFactory.NextAI(WholeBoard, Difficulty / 2); if (Difficulty % 2 == 1) { Control = new GameControl(WholeBoard, AI, null); Control.GameOver = postGameProcess; Control.RotatabilityChange = new GameControl.RotatabilityChangeHandler(RotateAction); Control.Start(); } else { Title += " - You go first"; Control = new GameControl(WholeBoard, null, AI); Control.GameOver = postGameProcess; Control.RotatabilityChange = new GameControl.RotatabilityChangeHandler(RotateAction); Control.Start(); } }
public void AIRazmak_GadjajDajePoljeUnutarMreze() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 4 }); ai.Gadjaj(); Assert.IsTrue(ai.Mreza.polja.Contains(ai.zap.gadjanoPolje)); }
private void InitAiTree() { mAiEntity = AIFactory.Creat(this.baseProp.aiTmplId, this); if (mAiEntity == null) { mAiEntity = new ComAI(this); } }
public AINpc(string Name, Transform Trans, CombatTeam Team, float[] InitAttr) : base(Name, Trans, Team, InitAttr) { AIData_ = new BehaviorInputData(); AIData_.Enabled = true; AIData_.Attacker = this; AIData_.Node = AIFactory.CreateNormalAI(); AIData_.SkillID = 0; }
public static AIFactory Instance() { if (mAIFactory == null) { mAIFactory = new AIFactory(); } return mAIFactory; }
void ComputerVsHuman() { WholeBoard = new PentagoBoard(); base.RaisePropertyChanged("WholeBoard"); Control = new GameControl(this.WholeBoard, null, AIFactory.NextAI(WholeBoard, 2, false, 1)); Control.GameOver = new GameControl.GameOverHandler(GameOver); Control.RotatabilityChange = new GameControl.RotatabilityChangeHandler(RotateAction); Control.Start(); }
public void AI_ObradiPogodakIspravnoRadiZaPromasaj() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 1, 2, 3, 3, 4 }); ai.Gadjaj(); ai.ObradiPogodak(rezultatGadjanja.promasaj); Assert.IsTrue(ai.zap.trenutnaMeta.Count == 0); Assert.IsFalse(ai.Mreza.polja.Contains(ai.zap.gadjanoPolje)); }
public void AI_IzvaziMjerenjeBrzine() { // zanima nas samo brzina izvrsavanja testa AIFactory.Pravila = PravilaIgre.DodirivanjeZabranjeno; int[] duljine = new int[] { 4, 3, 2, 1 }; AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, duljine); ai.Izvazi(); }
public void AI_InitializeIspravnoPostavljaParametre() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(5, 5, new int[] { 2, 3, 3, 4 }); Assert.IsTrue(((List <Polje>)ai.Mreza.DajSlobodnaPolja()).Count == 25); Assert.IsTrue(ai.Flota.Count == 4); Assert.IsTrue(ai.Flota.Contains(2)); Assert.IsTrue(ai.Flota.FindAll(x => x == 3).Count == 2); Assert.IsTrue(ai.Flota.Contains(4)); }
public void AI_NakonPrvogPogotkaTaktikaJeTrazenjeSmjera() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 2, 3, 3, 4 }); Polje p = ai.Gadjaj(); ai.ObradiPogodak(rezultatGadjanja.pogodak); p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaTrazenjeSmjeraRazmak)); }
public void AI_NakonPotapanjaTaktikaJeNapipavanje() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 2, 3, 3, 4 }); Polje p = ai.Gadjaj(); ai.ObradiPogodak(rezultatGadjanja.potopljen); p = ai.Gadjaj(); Assert.IsInstanceOfType(ai.Taktika, typeof(TaktikaNapipavanjeRazmak)); }
void ComputerVsComputer() { WholeBoard = new PentagoBoard(); //WholeBoard[1, 2].State = Status.StateEnum.black; //WholeBoard[1, 1].State = Status.StateEnum.black; //WholeBoard[1, 4].State = Status.StateEnum.black; //WholeBoard[4, 1].State = Status.StateEnum.white; //WholeBoard[4, 4].State = Status.StateEnum.white; base.RaisePropertyChanged("WholeBoard"); Control = new GameControl(this.WholeBoard, AIFactory.NextAI(WholeBoard, 2, false, 0), new AIPlayer(WholeBoard, 2)); Control.GameOver = new GameControl.GameOverHandler(GameOver); Control.RotatabilityChange = new GameControl.RotatabilityChangeHandler(RotateAction); Control.Start(); }
public void AIFactoryIspravnoDajeAIZaPravila() { AITemplate ai = AIFactory.DajAI(); Assert.IsInstanceOfType(ai, typeof(AIRazmak)); AIFactory.Pravila = PravilaIgre.DodirivanjeDozvoljeno; AITemplate a1 = AIFactory.DajAI(); Assert.IsInstanceOfType(a1, typeof(AIDodirivanje)); AIFactory.Pravila = PravilaIgre.DodirivanjeZabranjeno; AITemplate a2 = AIFactory.DajAI(); Assert.IsInstanceOfType(a2, typeof(AIRazmak)); }
public void AIRazmak_GadjajNakonPogotkaDajePoljeDoGadjanogPolja() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 4 }); ai.Gadjaj(); Polje prvoPolje = ai.zap.gadjanoPolje; ai.ObradiPogodak(rezultatGadjanja.pogodak); ai.Gadjaj(); Polje drugoPolje = ai.zap.gadjanoPolje; Assert.IsTrue((prvoPolje.Redak == drugoPolje.Redak && Math.Abs(prvoPolje.Stupac - drugoPolje.Stupac) == 1) || (prvoPolje.Stupac == drugoPolje.Stupac && Math.Abs(prvoPolje.Redak - drugoPolje.Redak) == 1)); }
public GameApp() { msInstance = this; mEventSystem = new EventSystem(); mSceneManager = new SceneManager(); mWindowManager = new WindowManager(); mDataManager = new DataManager(); mResourceManager = new ResourceManager(); mToucheManager = new TouchManager(); mAIFactory = new AIFactory(); mItemManage = new ItemManager(); mGMHandler = new GMHandler(); mModuleManager = new ModuleManager(); mSoundManager = new SoundManager(); mDropManager = new DropManager(); mConditionManager = new ConditionManager(); mStageDataManager = new StageDataManager(); mPlayerController = new PlayerController(); mBloodUIManager = new BloodUIManager(); mBossBloodUIManager = new BossBloodUIManager(); mPlayerDataPool = new PlayerDataPool(); mYesOrNoMgr = new YesOrNoBoxManager(); mUIEffectMgr = new UIEffectManager(); mInputSystem = new InputSystem(); mStoryManager = new StoryManager(); mPromptManager = new PromptUIManager(); mPaoPaoManager = new PaoPaoManager(); mGuideManager = new GuideManager(); mAnimationManager = new AnimationManager(); mPlayerHeadUIManager = new PlayerHeadUIManager(); mUIResourceManager = new UIResourceManager(); mAnnounceItemManager = new AnnounceItemManager(); mPopTipManager = new PopTipManager(); mQuackUIManager = new QuackUIManager(); mEggManager = new EggManager(); mShopManager = new ShopManager(); mStrFilterManager = new StrFilterManager(); mFightGradeManager = new FightGradeManager(); mMailItemManager = new MailItemManager(); mSettingManager = new SettingManager(); mZhushouManager = new ZhushouManager(); mOtherDataPool = new OtherDataPool(); mActivityManager = new ActivityManager(); mLoadingManager = new LoadingManager(); mChargeItemManager = new ChargeItemManager(); mChargeMsgManager = new ChargeMsgManager(); }
public void AI_IzvaziIspravnoRacunaTezinuZaStupac() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(5, 1, new int[] { 4 }); ai.Izvazi(); foreach (Polje p in ai.Mreza.polja) { if (p.Redak > 0 && p.Redak < 4) { Assert.IsTrue(p.Tezina == 2); } else { Assert.IsTrue(p.Tezina == 1); } } }
public void AIRazmak_GadjajNakonDvaPogotkaNastavljaSustavnoGadjatiUIstomSmjeru() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 4 }); ai.Gadjaj(); Polje prvoPolje = ai.zap.gadjanoPolje; ai.ObradiPogodak(rezultatGadjanja.pogodak); ai.Gadjaj(); Polje drugoPolje = ai.zap.gadjanoPolje; ai.ObradiPogodak(rezultatGadjanja.pogodak); ai.Gadjaj(); Polje trecePolje = ai.zap.gadjanoPolje; Assert.IsTrue((prvoPolje.Redak == trecePolje.Redak && Math.Abs(prvoPolje.Stupac - trecePolje.Stupac) == 2) || (prvoPolje.Stupac == trecePolje.Stupac && Math.Abs(prvoPolje.Redak - trecePolje.Redak) == 2)); }
public void AIRazmak_EliminirajBrodIspravnoEliminiraPoljaZaBrodUUglu() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 4 }); Brod b = new Brod(new List <Polje>() { new Polje(0, 0), new Polje(0, 1), new Polje(0, 2), new Polje(0, 3) }); List <Polje> prosireniBrod = new List <Polje>(); ai.EliminirajBrod(b.Polja); prosireniBrod = b.Polja; prosireniBrod.Add(new Polje(1, 0)); prosireniBrod.Add(new Polje(1, 1)); prosireniBrod.Add(new Polje(1, 2)); prosireniBrod.Add(new Polje(1, 3)); prosireniBrod.Add(new Polje(0, 4)); Assert.IsFalse(prosireniBrod.Intersect(ai.Mreza.DajSlobodnaPolja()).Any()); }
public void AIRazmak_GadjajNakonPogotkaIPromasajaJosUvijekDajePoljeDoGadjanogPolja() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 4 }); ai.Gadjaj(); Polje prvoPolje = ai.zap.gadjanoPolje; ai.ObradiPogodak(rezultatGadjanja.pogodak); ai.Gadjaj(); Polje drugoPolje = ai.zap.gadjanoPolje; ai.ObradiPogodak(rezultatGadjanja.promasaj); ai.Gadjaj(); Polje trecePolje = ai.zap.gadjanoPolje; Assert.IsTrue((prvoPolje.Redak == trecePolje.Redak && Math.Abs(prvoPolje.Stupac - trecePolje.Stupac) == 1) || (prvoPolje.Stupac == trecePolje.Stupac && Math.Abs(prvoPolje.Redak - trecePolje.Redak) == 1)); Assert.AreNotEqual(prvoPolje, drugoPolje); }
private void btnFight_Click(object sender, EventArgs e) { // na pocetku ukloni stare flote ako postoje if (mojaFlotaGUI != null) { this.Controls.Remove(mojaFlotaGUI); } if (protivnikFlotaGUI != null) { this.Controls.Remove(protivnikFlotaGUI); } BrodograditeljTemplate brodograditelj = BrodograditeljFactory.DajBrodograditelja(); int[] duljine = SastaviListuBrodova(); int redaka = (int)numRedaka.Value; int stupaca = (int)numStupaca.Value; flota = brodograditelj.SloziFlotu(redaka, stupaca, duljine); mojaFlotaGUI = new FlotaGUI(redaka, stupaca); mojaFlotaGUI.sirina = 250; mojaFlotaGUI.Location = new Point(20, 170); mojaFlotaGUI.ZadajFlotu(flota); this.Controls.Add(mojaFlotaGUI); protivnikFlotaGUI = new FlotaNeprijatelj(redaka, stupaca); protivnikFlotaGUI.sirina = 250; protivnikFlotaGUI.Location = new Point(370, 170); this.Controls.Add(protivnikFlotaGUI); ai = AIFactory.DajAI(); ai.Initialize(redaka, stupaca, duljine); // iniciraj protivnika protivnik = new OOMPotapanje.Protivnik(redaka, stupaca, duljine); // zapocni igru ProgressChangedEventArgs x; bgWorker.RunWorkerAsync(); }
public void AIRazmak_EliminirajBrodIspravnoEliminiraPolja() { AITemplate ai = AIFactory.DajAI(); ai.Initialize(10, 10, new int[] { 4 }); Brod b = new Brod(new List <Polje>() { new Polje(4, 4), new Polje(4, 5), new Polje(4, 6), new Polje(4, 7) }); List <Polje> prosireniBrod = new List <Polje>(); ai.EliminirajBrod(b.Polja); foreach (Polje p in b.Polja) { prosireniBrod.Add(p); prosireniBrod.Add(new Polje(p.Redak, p.Stupac + 1)); prosireniBrod.Add(new Polje(p.Redak, p.Stupac - 1)); prosireniBrod.Add(new Polje(p.Redak + 1, p.Stupac)); prosireniBrod.Add(new Polje(p.Redak - 1, p.Stupac)); } Assert.IsFalse(prosireniBrod.Intersect(ai.Mreza.DajSlobodnaPolja()).Any()); }
public AbstractPlayer Produce(PentagoBoard board, int level) { return(AIFactory.NextAI(board, level)); }
public void Init(Dictionary <string, UnityAction <string> > keywords, UnitData d, Unit u) { unit = u; keywordActions = keywords; unitAI = AIFactory.GetAI(d.UnitName, u); }
public AIFactory() { instance = this; aiList.Add((int)AIType.AI_TYPE_TEST, new TestAI(null)); aiList.Add((int)AIType.AI_TYPE_KANDAO, new KanDaoAI(null)); aiList.Add((int)AIType.AI_TYPE_SHEJI, new SheJiAI(null)); aiList.Add((int)AIType.AI_TYPE_3, new LianShe2(null)); aiList.Add((int)AIType.AI_TYPE_4, new SanShe(null)); aiList.Add((int)AIType.AI_TYPE_5, new LianShe(null)); aiList.Add((int)AIType.AI_TYPE_6, new QuanPao(null)); aiList.Add((int)AIType.AI_TYPE_7, new ZhiZhu(null)); aiList.Add((int)AIType.AI_TYPE_8, new MuNaiYi(null)); aiList.Add((int)AIType.AI_TYPE_9, new AIType_9(null)); aiList.Add((int)AIType.AI_TYPE_10, new AIType_10(null)); aiList.Add((int)AIType.AI_TYPE_11, new AIType_11(null)); aiList.Add((int)AIType.AI_TYPE_12, new AIType_12(null)); aiList.Add((int)AIType.AI_TYPE_13, new AIType_13(null)); aiList.Add((int)AIType.AI_TYPE_14, new AIType_14(null)); aiList.Add((int)AIType.AI_TYPE_15, new AIType_15(null)); aiList.Add((int)AIType.AI_TYPE_FOLLOW, new FollowAI(null)); aiList.Add((int)AIType.AI_TYPE_17, new AIType_17(null)); aiList.Add((int)AIType.AI_TYPE_18, new AIType_18(null)); aiList.Add((int)AIType.AI_TYPE_19, new AIType_19(null)); aiList.Add((int)AIType.AI_TYPE_XUNLUO, new XunLuo(null)); aiList.Add((int)AIType.AI_TYPE_21, new AIType_21(null)); aiList.Add((int)AIType.AI_TYPE_22, new AIType_22(null)); aiList.Add((int)AIType.AI_TYPE_23, new AIType_23(null)); aiList.Add((int)AIType.AI_TYPE_24, new AIType_24(null)); aiList.Add((int)AIType.AI_TYPE_25, new AIType_25(null)); aiList.Add((int)AIType.AI_TYPE_26, new AIType_26(null)); aiList.Add((int)AIType.AI_TYPE_27, new AIType_27(null)); aiList.Add((int)AIType.AI_TYPE_28, new AIType_28(null)); aiList.Add((int)AIType.AI_TYPE_29, new AIType_29(null)); aiList.Add((int)AIType.AI_TYPE_30, new AIType_30(null)); aiList.Add((int)AIType.AI_TYPE_31, new AIType_31(null)); aiList.Add((int)AIType.AI_TYPE_32, new AIType_32(null)); aiList.Add((int)AIType.AI_TYPE_33, new AIType_33(null)); aiList.Add((int)AIType.AI_TYPE_34, new AIType_34(null)); aiList.Add((int)AIType.AI_TYPE_35, new AIType_35(null)); aiList.Add((int)AIType.AI_TYPE_36, new AIType_36(null)); aiList.Add((int)AIType.AI_TYPE_MAO, new MaoAI(null)); aiList.Add((int)AIType.AI_TYPE_38, new AIType_38(null)); aiList.Add((int)AIType.AI_TYPE_39, new AIType_39(null)); aiList.Add((int)AIType.AI_TYPE_40, new AIType_40(null)); aiList.Add((int)AIType.AI_TYPE_41, new AIType_41(null)); aiList.Add((int)AIType.AI_TYPE_42, new AIType_42(null)); aiList.Add((int)AIType.AI_TYPE_43, new AIType_43(null)); aiList.Add((int)AIType.FortuneMaoAI, new FortuneMaoAI(null)); aiList.Add((int)AIType.XunLuoNoLoop, new XunLuoNoLoop(null)); aiList.Add((int)AIType.AI_TYPE_46, new AIType_46(null)); aiList.Add((int)AIType.AI_TYPE_47, new AIType_47(null)); aiList.Add((int)AIType.AI_TYPE_48, new AIType_48(null)); aiList.Add((int)AIType.AI_TYPE_200, new SheJiShouWei(null)); aiList.Add((int)AIType.AI_TYPE_201, new QuanDaZhuang(null)); aiList.Add((int)AIType.AI_TYPE_202, new PaoDaZhuang(null)); aiList.Add((int)AIType.AI_TYPE_1000, new AIType_1000(null)); aiList.Add((int)AIType.AI_TYPE_1001, new AIType_1001(null)); aiList.Add((int)AIType.AI_TYPE_1002, new AIType_1002(null)); aiList.Add((int)AIType.AI_TYPE_1003, new AIType_1003(null)); aiList.Add((int)AIType.AI_TYPE_1004, new AIType_1004(null)); aiList.Add((int)AIType.AI_TYPE_1005, new AIType_1005(null)); aiList.Add((int)AIType.AI_TYPE_1100, new AIType_1100(null)); aiList.Add((int)AIType.AI_TYPE_1101, new AIType_1101(null)); aiList.Add((int)AIType.AI_TYPE_1102, new AIType_1102(null)); aiList.Add((int)AIType.AI_TYPE_1103, new AIType_1103(null)); aiList.Add((int)AIType.AI_TYPE_1104, new AIType_1104(null)); aiList.Add((int)AIType.AI_TYPE_1105, new AIType_1105(null)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _experimentPanel_DataLoaded(object sender, EventArgs e) { //Depending on experimental type of output data (numerical or categorical or boolean) // prepare the panels for parameters and type of the factory. if (_GPModel == GPModelType.ANNMODEL) { //create facotry based on column data type if (_experimentPanel.IsCategoricalOutput) { this._mainANNFactory = new PSOFactory(); } else { this._mainANNFactory = new BPFactory(); } // if (_setANNPanel == null) { _setANNPanel = new ANNSettingsPanel(); loadGPPanelInMainWindow(this, _setANNPanel, "Settings"); //lock some parameters based on type of output variable if (_experimentPanel.Experiment.GetOutputColumnType() == Core.Experiment.ColumnDataType.Binary || _experimentPanel.Experiment.GetOutputColumnType() == Core.Experiment.ColumnDataType.Categorical ) { _setANNPanel.SetLearnigAlgorithm(1); } else { _setANNPanel.SetLearnigAlgorithm(0); } _setANNPanel.LockLearningAlgoritm(); } if (_runANNPanel == null) { _runANNPanel = new ANNRunPanel(); loadGPPanelInMainWindow(this, _runANNPanel, "Modeling"); } if (_infoPanel == null) { _infoPanel = new InfoPanel(); loadGPPanelInMainWindow(this, _infoPanel, "Info"); } if (_runANNPanel != null) { this._mainANNFactory.ReportIteration += new EvolutionHandler(annFactory_ReportIteration); _runANNPanel.UpdateChartDataPoint(_experimentPanel.GetOutputValues(), false); _isFileDirty = true; } } else//Preparing GP for modelling nd prediction { //create facotry based on column data type if (_experimentPanel.IsBinarylOutput || _experimentPanel.IsCategoricalOutput) { this._mainGPFactory = new GPFactoryClass(); } else if (_experimentPanel.GetOutputColumnType() == Core.Experiment.ColumnDataType.Numeric) { this._mainGPFactory = new GPFactory(); } else { throw new Exception("Unknown output value type!"); } if (_funPanel == null) { _funPanel = new FunctionPanel(); loadGPPanelInMainWindow(this, _funPanel, "Functions"); } if (_setPanel == null) { _setPanel = new SettingsPanel(); loadGPPanelInMainWindow(this, _setPanel, "Settings"); } //set problem type _setPanel.SetParamForClassification(_experimentPanel.GetOutputColumnType()); if (_runPanel == null) { _runPanel = new RunPanel(); loadGPPanelInMainWindow(this, _runPanel, "Run"); } if (_resultPanel == null) { _resultPanel = new ResultPanel(); loadGPPanelInMainWindow(this, _resultPanel, "Result"); } if (_infoPanel == null) { _infoPanel = new InfoPanel(); loadGPPanelInMainWindow(this, _infoPanel, "Info"); } //set base run panel on _runPAnel _baseRunPanel = _runPanel; if (_runPanel != null) { this._mainGPFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution); _runPanel.ResetSolution(); _runPanel.UpdateChartDataPoint(_experimentPanel.GetOutputValues(), false); _isFileDirty = true; } if (_funDefinit != null) { _funDefinit.btnFinishAnalFun.Click += btnFinishAnalFun_Click; } if (_setPanel != null) { _setPanel.ResetSolution += _setPanel_ResetSolution; } } }