private void boardUi_Move(Locat i_Source, Locat i_Dest) { if (m_ActiveGame.GameOn()) { if (m_PlayVSComputer) { m_ActiveGame.PlayingMove(i_Source, i_Dest); if (m_ActiveGame.IsTurnPass) { computerPlayingMove(); } } else { m_ActiveGame.PlayingMove(i_Source, i_Dest); } if (m_ActiveGame.IsTurnPass) { updateAfterTurnPass(); } } if (!m_ActiveGame.GameOn()) { gameOver(); } }
protected virtual void OnBoardUiMove(Locat i_Source, Locat i_Dest) { if (BoardUiMove != null) { BoardUiMove.Invoke(i_Source, i_Dest); } }
private void boardLogic_Move(Locat i_LocateThatChange, eCheckers i_ChangeToThisType) { string newTextToButton = string.Empty; switch (i_ChangeToThisType) { case eCheckers.Non: newTextToButton = string.Empty; break; case eCheckers.CheckerX: newTextToButton = "X"; break; case eCheckers.CheckerO: newTextToButton = "O"; break; case eCheckers.CheckerU: newTextToButton = "U"; break; case eCheckers.CheckerK: newTextToButton = "K"; break; } m_Ui.ChangeTextOnButton(i_LocateThatChange, newTextToButton); }
public ActionResult DeleteConfirmed(int id) { Locat locat = db.Locats.Find(id); db.Locats.Remove(locat); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "LocID,LocDetails")] Locat locat) { if (ModelState.IsValid) { db.Entry(locat).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(locat)); }
public ActionResult Create([Bind(Include = "LocID,LocDetails")] Locat locat) { if (ModelState.IsValid) { db.Locats.Add(locat); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(locat)); }
private static string makeStringOfActive(Locat i_Source, Locat i_Destination) { StringBuilder activeToReturn = new StringBuilder("Aa>Aa"); activeToReturn[0] = (char)(i_Source.X + (byte)'A'); activeToReturn[1] = (char)(i_Source.Y + (byte)'a'); activeToReturn[2] = '>'; activeToReturn[3] = (char)(i_Destination.X + (byte)'A'); activeToReturn[4] = (char)(i_Destination.Y + (byte)'a'); return(activeToReturn.ToString()); }
public static string TheMoveToDoForMultiEating(CheckersLogic i_TheGameNow, string i_LastMove) { string activeToContinueEat = null; Locat forChech = new Locat((byte)(i_LastMove[3] - 'A'), (byte)(i_LastMove[4] - 'a')); Locat yaad = new Locat(); i_TheGameNow.CanToMultiEat(forChech, out yaad); activeToContinueEat = makeStringOfActive(forChech, yaad); return(activeToContinueEat); }
// GET: Locats/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Locat locat = db.Locats.Find(id); if (locat == null) { return(HttpNotFound()); } return(View(locat)); }
private static bool Player2CanToEat(CheckersLogic i_TheGameNow, out string o_ActiveToEat) { o_ActiveToEat = null; bool playerCanToEat = false; Locat yaad = new Locat(); foreach (var makor in i_TheGameNow.m_VellsOfPlayer2) { if (i_TheGameNow.player2CanToEat(makor, out yaad)) { o_ActiveToEat = makeStringOfActive(makor, yaad); playerCanToEat = true; break; } } return(playerCanToEat); }
private static bool Player1CanToMove(Logic i_TheGameNow, out MoveToDo o_ActiveToMove) { o_ActiveToMove = null; bool playerCanToMove = false; Locat destintionIndex = new Locat(); foreach (Locat sourceIndex in i_TheGameNow.r_VellsOfPlayer1) { if (i_TheGameNow.Player1CanToMove(sourceIndex, ref destintionIndex)) { o_ActiveToMove = new MoveToDo(sourceIndex, destintionIndex); playerCanToMove = true; break; } } return(playerCanToMove); }
public ButtonLocat(Locat i_LocateToButton) { m_LocatOfButton = i_LocateToButton; }
public MoveToDo(Locat i_Source, Locat i_Dest) { m_Source = i_Source; m_Dest = i_Dest; }
public void ChangeTextOnButton(Locat i_LocateOfButton, string i_NewTextToButton) { m_MatOfButton[i_LocateOfButton.Y, i_LocateOfButton.X].Text = i_NewTextToButton; }
private void initializeButtonBoard() { int lengthAndWidthOfButton = m_FormOfBoard.ClientSize.Width / r_SizeOfBoard; Locat locateForButtons = new Locat(); int spaceForLabels = m_LabelPlayer1.Top + m_LabelPlayer1.Height; m_MatOfButton = new ButtonLocat[r_SizeOfBoard, r_SizeOfBoard]; for (int i = 0; i < r_SizeOfBoard; i++) { for (int j = 0; j < r_SizeOfBoard; j++) { if (i < ((r_SizeOfBoard / 2) - 1) && (i + j) % 2 != 0) { locateForButtons.X = (byte)j; locateForButtons.Y = (byte)i; ButtonLocat buttonOfPlayr1 = new ButtonLocat(locateForButtons); buttonOfPlayr1.Text = k_Player1Sign; buttonOfPlayr1.Width = lengthAndWidthOfButton; buttonOfPlayr1.Height = lengthAndWidthOfButton; buttonOfPlayr1.Left = j * lengthAndWidthOfButton; buttonOfPlayr1.Top = (i * lengthAndWidthOfButton) + spaceForLabels; buttonOfPlayr1.Click += button_Cliked; m_FormOfBoard.Controls.Add(buttonOfPlayr1); m_MatOfButton[i, j] = buttonOfPlayr1; } else if (i >= ((r_SizeOfBoard / 2) + 1) && (i + j) % 2 != 0) { locateForButtons.X = (byte)j; locateForButtons.Y = (byte)i; ButtonLocat buttonOfPlayr2 = new ButtonLocat(locateForButtons); buttonOfPlayr2.Text = k_Player2Sign; buttonOfPlayr2.Width = lengthAndWidthOfButton; buttonOfPlayr2.Height = lengthAndWidthOfButton; buttonOfPlayr2.Left = j * lengthAndWidthOfButton; buttonOfPlayr2.Top = (i * lengthAndWidthOfButton) + spaceForLabels; buttonOfPlayr2.Click += button_Cliked; m_FormOfBoard.Controls.Add(buttonOfPlayr2); m_MatOfButton[i, j] = buttonOfPlayr2; } else { locateForButtons.X = (byte)j; locateForButtons.Y = (byte)i; ButtonLocat buttonOfEmptyPlace = new ButtonLocat(locateForButtons); buttonOfEmptyPlace.Text = k_EmptyPlace; buttonOfEmptyPlace.Width = lengthAndWidthOfButton; buttonOfEmptyPlace.Height = lengthAndWidthOfButton; buttonOfEmptyPlace.Left = j * lengthAndWidthOfButton; buttonOfEmptyPlace.Top = (i * lengthAndWidthOfButton) + spaceForLabels; if ((i + j) % 2 == 0) { buttonOfEmptyPlace.BackColor = Color.Gray; buttonOfEmptyPlace.Enabled = false; } else { buttonOfEmptyPlace.Click += button_Cliked; } m_FormOfBoard.Controls.Add(buttonOfEmptyPlace); m_MatOfButton[i, j] = buttonOfEmptyPlace; } } } }