IEnumerator GameProcess() { Result result = Result.CreateNotDone(); do { yield return(new WaitUntil(() => selectBord != null)); var bord = selectBord; selectBord = null; if (bord.HasOwner()) { continue; } bord.ChangeOwner(turnPlayer); bord.ChangeBordType(BordType.Checked); result = calclator.CalcResult(); if (!result.IsDone) { turnPlayer = turnPlayer.GetNextPlayer(); var window = Managers.UI.GetUIWindow <UIBordWindow>(); window.UpdateTurnPlayerName(turnPlayer); } } while(!result.IsDone); Owner.ChangeState(GameStateType.Result, result.Winner); }
public Kleur OverwegendeKleur() { int wit = 0, zwart = 0, geen = 0; for (int i = 0; i < Bord.GetLength(0); i++) { for (int j = 0; j < Bord.GetLength(1); j++) { if (Bord[i, j] == Kleur.Geen) { geen++; } else if (Bord[i, j] == Kleur.Wit) { wit++; } else if (Bord[i, j] == Kleur.Zwart) { zwart++; } } } if (wit > zwart) { return(Kleur.Wit); } if (zwart > wit) { return(Kleur.Zwart); } return(Kleur.Geen); }
public Dictionary <string, int> OverwegendeKleur() { int wit = 0, zwart = 0, geen = 0; for (int i = 0; i < Bord.GetLength(0); i++) { for (int j = 0; j < Bord.GetLength(1); j++) { if (Bord[i, j] == Kleur.Geen) { geen++; } else if (Bord[i, j] == Kleur.Wit) { wit++; } else if (Bord[i, j] == Kleur.Zwart) { zwart++; } } } Dictionary <string, int> temp = new Dictionary <string, int>() { { "Wit", wit }, { "Zwart", zwart }, { "Geen", geen } }; return(temp); }
static void Main(string[] args) { bord = new Bord(); computer = new Computer(bord, 1); TestPromotion(); }
/// <summary> /// Calc Diagonal Align Result /// </summary> /// <param name="isLeftToBottom"></param> /// <returns></returns> Result CalcResultDiagonal(bool isLeftToBottom) { if (HORIZONTAL_COUNT != VERTICAL_COUNT) { Debug.LogError("Not Supported BordCount. Require Equal HORIZONTAL_COUNT and VERTICAL_COUNT."); return(Result.CreateNotDone()); } var bords = new Bord[VERTICAL_COUNT]; if (isLeftToBottom) { for (int i = 0; i < bords.Length; i++) { bords[i] = Bords[i + (bords.Length * i)]; } } else { for (int i = 0; i < bords.Length; i++) { bords[i] = Bords[(bords.Length * i) + bords.Length - i - 1]; } } return(CalcResult(bords)); }
public Kleur OverwegendeKleur() { int zwartKleurig = 0; int witKleuring = 0; for (int y = 0; y < Bord.GetLength(0); y++) { for (int x = 0; x < Bord.GetLength(0); x++) { if (Bord[y, x] == Kleur.Zwart) { zwartKleurig++; } else if (Bord[y, x] == Kleur.Wit) { witKleuring++; } } } if (zwartKleurig > witKleuring) { return(Kleur.Zwart); } else if (witKleuring > zwartKleurig) { return(Kleur.Wit); } else { return(Kleur.Geen); } }
public ActionResult ManageHardware() { Asset1(); ManageHardwareModel rec = new ManageHardwareModel(); rec.HardwareListCollection = (from a in db.Assets where a.InUse == true && a.ISDelete == false join b in db.locations on a.LocationID equals b.locationid into Bord1 from tab2 in Bord1.DefaultIfEmpty() join c in db.AssetTypes on a.AssetTypeId equals c.AssetTypeId join d in db.computermanagements on a.ComputerName equals d.managementid into Bord from tab1 in Bord.DefaultIfEmpty() select new HardwareList() { ID = a.AssetID, Hardware = c.AssetName, Component = a.Name_Model_No, Model = a.ModelNo, AssignedTo = a.ComputerName == 0 ? "Not Assigned" : tab1.ComputerName, Floor = a.LocationID == 0 ? "Not Allocated" : tab2.LocationName, Quantity = a.Quantity, Ip = a.ConnectedTo, InUse = a.InUse }).ToList(); return(View(rec)); }
public static Bord Create(int bordId) { var instance = new Bord(); instance.BordId = bordId; instance.BordType = BordType.None; return(instance); }
protected bool IsRand(Veld veld, Bord bord) { if (veld == bord[0, 1] || veld == bord[1, 0] || veld == bord[1, 2] || veld == bord[2, 1]) { return(true); } return(false); }
protected bool IsHoek(Veld veld, Bord bord) { if (veld == bord[0, 0] || veld == bord[2, 2] || veld == bord[2, 0] || veld == bord[0, 2]) { return(true); } return(false); }
public string VraagBordOp() { Bord result = new Bord(); string json = JsonConvert.SerializeObject(result.stelling, Formatting.Indented); return(json); }
protected bool ZijnOpposRanden(Veld veld1, Veld veld2, Bord bord) { if (veld1 == bord[0, 1] && veld2 == bord[2, 1] || veld1 == bord[1, 0] && veld2 == bord[1, 2] || veld2 == bord[0, 1] && veld1 == bord[2, 1] || veld2 == bord[1, 0] && veld1 == bord[1, 2]) { return(true); } return(false); }
/// <summary> /// Calc Vertical Align Result /// </summary> /// <param name="column">0 ~ </param> /// <returns></returns> Result CalcResultVertical(int column) { var bords = new Bord[VERTICAL_COUNT]; for (int i = 0; i < bords.Length; i++) { bords[i] = Bords[(i * bords.Length) + column]; } return(CalcResult(bords)); }
/// <summary> /// Calc Horizontal Align Result /// </summary> /// <param name="row">0 ~ </param> /// <returns></returns> Result CalcResultHorizontal(int row) { var bords = new Bord[HORIZONTAL_COUNT]; for (int i = 0; i < bords.Length; i++) { bords[i] = Bords[i + (row * bords.Length)]; } return(CalcResult(bords)); }
protected List <Lijn> GetRandLijnen(Bord bord) { List <Lijn> randLijnen = new List <Lijn>(); randLijnen.Add(bord.Lijnen[0]); randLijnen.Add(bord.Lijnen[2]); randLijnen.Add(bord.Lijnen[3]); randLijnen.Add(bord.Lijnen[5]); return(randLijnen); }
Bord[] CreateBords() { var bords = new Bord[9]; for (int i = 0; i < bords.Length; i++) { bords[i] = Bord.Create(bordId: i); } return(bords); }
protected Veld Vork(Veld randofhoek, Veld hoek, Bord bord) { if (randofhoek.Kolom == 2) { return(bord[randofhoek.Rij - 1, hoek.Kolom - 1]); } else { return(bord[hoek.Rij - 1, randofhoek.Kolom - 1]); } }
public void Bind(Bord bord) { Bord = bord; Bord.OnChangeBordType = OnChangeBordType; Bord.OnChangeOwner = OnChangeOwner; ChangeBG(PlayerType.None); Button.onClick.AddListener(() => { OnSelectBord.Call(Bord); }); }
protected bool CheckOpWinst(Bord bord, Speler speler) { foreach (Lijn lijn in bord.Lijnen) { if (lijn.IsReeks(speler) == true) { return(true); } } return(false); }
private void makeBordButton_Click(object sender, EventArgs e) { this.bordPannel.Controls.Clear(); if (this.numericXForDataGrid.Value > 0 && this.numericYForDataGrid.Value > 0) { int x = (int)this.numericXForDataGrid.Value; int y = (int)this.numericYForDataGrid.Value; chessBord = new Bord(x, y); buttonsOnThePannel = new Button[x, y]; FillPannelGui(x, y); } }
protected List <Veld> VeldenSpeler(Bord bord, Speler speler) { List <Veld> veldenSpeler = new List <Veld>(); foreach (Veld veld in bord) { if (veld.Speler == speler) { veldenSpeler.Add(veld); } } return(veldenSpeler); }
protected int AantalIngenomen(Bord bord) { int aantalIngenomen = 0; foreach (Veld v in bord) { if (v.Speler != null) { aantalIngenomen++; } } return(aantalIngenomen); }
private void DoeZetHR(int y, int x) { for (int tempX = x + 1; tempX < Bord.GetLength(0); tempX++) { if (Bord[y, tempX] != AandeBeurt) { Bord[y, tempX] = AandeBeurt; } else { break; } } }
private void DoeZetVO(int y, int x) { for (int tempY = y + 1; tempY < Bord.GetLength(0); tempY++) { if (Bord[tempY, x] != AandeBeurt) { Bord[tempY, x] = AandeBeurt; } else { break; } } }
protected Veld MinimaxVeld(Bord bord) { Veld doel = null; Strategie besteStrategie = Minimax(bord, Speler, 0); int gekozenRij = besteStrategie.Veld.Rij; int gekozenKolom = besteStrategie.Veld.Kolom; foreach (Veld v in bord) { if (v.Kolom == gekozenKolom && v.Rij == gekozenRij) { doel = v; } } return(doel); }
public int scorePlayerBlack() { int score = 0; for (int y = 0; y < Bord.GetLength(0); y++) { for (int x = 0; x < Bord.GetLength(0); x++) { if (Bord[y, x] == Kleur.Zwart) { score++; } } } return(score); }
public bool checkHorizontal(int rijZet, int kolomZet) { //Horizontal //Check right line -> +++++ Als er minimaal 1 van de andere kleur naast zit. try { if (Bord[rijZet, kolomZet + 1] != Kleur.Geen && Bord[rijZet, kolomZet + 1] != AandeBeurt) { for (int x = kolomZet + 2; x < Bord.GetLength(0); x++) { if (Bord[rijZet, x] == AandeBeurt) { typeZet.Add(ZetType.HR); } else if (Bord[rijZet, x] == Kleur.Geen) { break; } } } } catch (Exception e) { } //Check left line -> ---- Als er minimaal 1 van de andere kleur naast zit. try { if (Bord[rijZet, kolomZet - 1] != Kleur.Geen && Bord[rijZet, kolomZet - 1] != AandeBeurt) { for (int x = kolomZet - 2; x >= 0; x--) { if (Bord[rijZet, x] == AandeBeurt) { typeZet.Add(ZetType.HL); } else if (Bord[rijZet, x] == Kleur.Geen) { break; } } } } catch (Exception e) { } return(false); }
private void DoeZetDRB(int y, int x) { while (y >= 0 && x < Bord.GetLength(0)) { y--; x++; if (Bord[y, x] != AandeBeurt) { Bord[y, x] = AandeBeurt; } else { break; } } }
private void DoeZetDLO(int y, int x) { while (y < Bord.GetLength(0) && x >= 0) { y++; x--; if (Bord[y, x] != AandeBeurt) { Bord[y, x] = AandeBeurt; } else { break; } } }
public bool Afgelopen() { for (int y = 0; y < Bord.GetLength(0); y++) { for (int x = 0; x < Bord.GetLength(0); x++) { if (Bord[y, x] == Kleur.Geen) { if (ZetMogelijk(y, x)) { return(false); } } } } return(true); }