public void TestWhiteSimpleBackwardKill() { int[][] whiteChs = new int[1][]; whiteChs[0] = new[] { 3, 3 }; int[][] blackChs = new int[2][]; blackChs[0] = new[] { 4, 4 }; blackChs[1] = new[] { 2, 4 }; TableCells.Create(GenerateArrayCellImplementations()); Game.StartTestlGame(whiteChs, blackChs); int counter = 0; foreach (Move move in GameDataHandler.WhiteCheckers[0].AllowedMoves) { if (move.ToCell == TableCells.Cell[5, 5]) { if (move.Killed.Contains(TableCells.Cell[4, 4].Checker)) { counter++; } } if (move.ToCell == TableCells.Cell[1, 5]) { if (move.Killed.Contains(TableCells.Cell[2, 4].Checker)) { counter++; } } } Game.Clear(); Assert.AreEqual(counter, 2); }
private TableCell GetCell(int index) { TableRows rows = table.Rows; TableCells cells = rows[index - 1].Cells; return(cells[0]); }
public void TestWhiteQueenTrippleKill() { int[][] whiteChs = new int[1][]; whiteChs[0] = new[] { 2, 5 }; int[][] blackChs = new int[3][]; blackChs[0] = new[] { 1, 4 }; blackChs[1] = new[] { 2, 1 }; blackChs[2] = new[] { 5, 2 }; TableCells.Create(GenerateArrayCellImplementations()); Game.StartTestlGame(new int[0][], blackChs, whiteChs); int counter = 0; foreach (Move move in GameDataHandler.WhiteCheckers[0].AllowedMoves) { if (move.ToCell == TableCells.Cell[7, 4]) { if (move.Killed.Contains(TableCells.Cell[1, 4].Checker)) { if (move.Killed.Contains(TableCells.Cell[2, 1].Checker)) { if (move.Killed.Contains(TableCells.Cell[5, 2].Checker)) { counter++; } } } } } Game.Clear(); Assert.AreEqual(counter, 1); }
public void WriteTo(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("TableRow"); { Visibility.WriteTo(xmlWriter); TableCells.WriteTo(xmlWriter); xmlWriter.WriteElementString("Height", Height.ToString()); } xmlWriter.WriteEndElement(); }
/// <summary> /// Start new game /// </summary> public static void StartNormalGame(Color color, CheckerGraphicalImplementation[,,] graphicalImplementation, bool vsCPU = false) { Initialize(color, vsCPU); TableCells.Draw(); DisposeNormal(color, graphicalImplementation); ComputeMoves(color); }
/// <summary> /// Delete game data /// </summary> public static void Clear() { GameDataHandler.WhiteCheckers = null; GameDataHandler.BlackCheckers = null; GameDataHandler.PreviousMoves = null; GameDataHandler.CurrentMoveIndex = 0; Unselect(); GameDataHandler.Selected = null; TableCells.Clear(); }
public TableCell GetCell(int column) { if (TableCells.Count() <= column) { return(null); } TableCell tableCell = TableCells[column]; tableCell.Column = column; tableCell.Row = Index; return(tableCell); }
public List <ContactData> GetContactList() { List <ContactData> list = new List <ContactData>(); Table table = manager.MainWindow.Get <Table>("uxAddressGrid"); TableRows tableRows = table.Rows; foreach (TableRow row in tableRows) { TableCells cells = row.Cells; list.Add(new ContactData(cells[0].Value.ToString(), cells[1].Value.ToString())); } return(list); }
public virtual List <Customer> Search(CustomerSearchCriteria criteria) { NameTextBox().Text = criteria.Name; window.Get <TextBox>("ageTextBox").Text = criteria.Age; window.Get <Button>("search").Click(); TableRows rows = window.Get <Table>("foundCustomers").Rows; List <Customer> foundCustomers = new List <Customer>(); rows.ForEach(delegate(TableRow obj) { TableCells cells = obj.Cells; Customer customer = new Customer(cells["Name"].Value.ToString(), cells["Age"].Value.ToString(), cells["PhoneNumber"].Value.ToString()); foundCustomers.Add(customer); }); return(foundCustomers); }
private void InitializeField() { this.SuspendLayout(); this._fieldBox = new PictureBox(); this._fieldBox.Location = new Point(0, 25); this._fieldBox.Name = "Field"; this._fieldBox.Size = new Size(600, 600); this.Controls.Add(this._fieldBox); TableCells.Create(GenerateArrayCellImplementations()); for (byte i = 0; i < 8; i++) { for (byte j = 0; j < 8; j++) { this._fieldBox.Controls.Add((PictureBox)TableCells.Cell[i, j].GetImage()); } } this.ResumeLayout(false); }
public void TestBlackSimpleGo() { int[][] blackChs = new int[1][]; blackChs[0] = new[] { 3, 3 }; TableCells.Create(GenerateArrayCellImplementations()); Game.StartTestlGame(new int[0][], blackChs, isWhite: false); int counter = 0; foreach (Move move in GameDataHandler.BlackCheckers[0].AllowedMoves) { if (move.ToCell == TableCells.Cell[4, 4]) { counter++; } if (move.ToCell == TableCells.Cell[2, 4]) { counter++; } } Game.Clear(); Assert.AreEqual(counter, 2); }
public void TestWhiteQueenGo() { int[][] whiteChs = new int[1][]; whiteChs[0] = new[] { 4, 4 }; TableCells.Create(GenerateArrayCellImplementations()); Game.StartTestlGame(new int[0][], new int[0][], whiteChs); int counter = 0; foreach (Move move in GameDataHandler.WhiteCheckers[0].AllowedMoves) { if (move.ToCell == TableCells.Cell[2, 2]) { counter++; } if (move.ToCell == TableCells.Cell[6, 2]) { counter++; } } Game.Clear(); Assert.AreEqual(counter, 2); }