public void DrawField(Player player, Point CurrentPoint, int firstDice, int secondDice) { GetСoordinates(player, firstDice, secondDice); if (IsPlacementFieldOnBooardPossible(firstDice, secondDice)) { for (var rowIndex = 0; rowIndex < (BoardMatrix.GetUpperBound(0) + 1); rowIndex++) { for (var colIndex = 0; colIndex < BoardMatrix.GetUpperBound(1) + 1; colIndex++) { if (rowIndex >= CurrentPoint.Y + 1 && rowIndex < CurrentPoint.Y + 1 + firstDice && colIndex >= CurrentPoint.X + 1 && colIndex < CurrentPoint.X + 1 + secondDice) { BoardMatrix[rowIndex, colIndex] = player.Filler; } Console.Write(BoardMatrix[rowIndex, colIndex]); } Console.WriteLine(); } var filledCells = firstDice * secondDice; EmptyCellsCount -= filledCells; player.FilledCells += filledCells; Console.WriteLine($"{player.Name}, you have already filled {player.FilledCells} cells."); } }
public void Draw(SpriteBatch spriteBatch) { for (int i = 0; i < BoardMatrix.GetLength(0); i++) { for (int j = 0; j < BoardMatrix.GetLength(1); j++) { BoardMatrix[i, j].Draw(spriteBatch); } } }
public static void DrawBoard() { for (int rowIndex = 0; rowIndex < (BoardMatrix.GetUpperBound(0) + 1); rowIndex++) { for (int colIndex = 0; colIndex < BoardMatrix.GetUpperBound(1) + 1; colIndex++) { Console.Write(BoardMatrix[rowIndex, colIndex]); } Console.WriteLine(); } }
public Form1() { InitializeComponent(); label1.Text = null; boardMatrix = new BoardMatrix(); modeGame = ModeGame.NOT_PLAYING; whoseTurn = -1; whoAreYou = -1; finishedGame = false; }
private int findFirstEmptyRow(int i_ColIndex) { int i_RowIndex = BoardMatrix.GetLength(0) - 1; for (; i_RowIndex >= 0; i_RowIndex--) { if (BoardMatrix[i_RowIndex, i_ColIndex] == (int)GameManager.ePlayerNumber.Empty) { break; } } return(i_RowIndex); }
public BoardMatrix Clone() { var clone = new BoardMatrix(BoardValues.Empty); for (var col = 0; col < 8; col++) { for (var row = 0; row < 8; row++) { clone.Set(col, row, matrix[col, row]); } } return clone; }
public bool IsColumnAvailable(int i_ColIndex) { bool i_IsColumnAvailable = false; for (int i_RowIndex = 0; i_RowIndex < BoardMatrix.GetLength(0); i_RowIndex++) { if (BoardMatrix[i_RowIndex, i_ColIndex] == (int)GameManager.ePlayerNumber.Empty) { i_IsColumnAvailable = true; break; } } return(i_IsColumnAvailable); }
public static bool IsPlacementFieldOnBooardPossible(int firstDice, int secondDice) { for (var rowIndex = 2; rowIndex < (BoardMatrix.GetUpperBound(0) - 2); rowIndex++) { for (var colIndex = 2; colIndex < BoardMatrix.GetUpperBound(1) - 2; colIndex++) { if (BoardMatrix[rowIndex, colIndex].Equals(Filler) && IsFieldFitToBoard(colIndex - 1, rowIndex - 1, firstDice, secondDice) && !IsFieldOverlapAnotherField(colIndex - 1, rowIndex - 1, firstDice, secondDice)) { return(true); } } } return(false); }
private void Button_Click(object sender, RoutedEventArgs e) { String RenjuPoints = this.Points.Text; //忽略空行 string[] ContentLines = RenjuPoints.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); BoardMatrix boardMatrix = new BoardMatrix(15); foreach (String item in ContentLines) { String points = item.Replace(" ", ""); string[] point = points.Split(','); int x = int.Parse(point[0]); int y = int.Parse(point[1]); int p = int.Parse(point[2]); boardMatrix.SetMatrixPices(x, y, p); } String ChessString = ""; for (int i = 0; i < ContentLines.Length; i++) { String points = ContentLines[i].Replace(" ", ""); string[] point = points.Split(','); int x = int.Parse(point[0]); int y = int.Parse(point[1]); int p = int.Parse(point[2]); ChessString += String.Format(" {0,2} {1}{2,-2}", i + 1, ((Char)((Char)'A' + 15 - x)).ToString(), y ); if (i % 2 == 1) { ChessString += Environment.NewLine; } } this.RenJunLibString.Text = boardMatrix.ToRenJunLib() + ChessString; }
public void StartGame(int i, int j) { Random rnd = new Random(); for (int k = 0; k < NumOfFlags; k++) { int x = rnd.Next(BoardMatrix.GetLength(0)); int y = rnd.Next(BoardMatrix.GetLength(1)); while (x == i && y == j) { x = rnd.Next(BoardMatrix.GetLength(0)); y = rnd.Next(BoardMatrix.GetLength(1)); } Rectangle rect = BoardMatrix[x, y].PositionRectangle; BoardMatrix[x, y] = new MineCell(_sapperGame, _sapperGame.GameTextures["cleanTexture"], _sapperGame.GameTextures["mineTexture"], rect, x, y); _minesList.Add((MineCell)BoardMatrix[x, y]); } }
public void InitBoard() { int middleOfHeight = BoardMatrix.GetLength(0) / 2; int middleOfWidth = BoardMatrix.GetLength(1) / 2; for (int X = 0; X < BoardMatrix.GetLength(0); ++X) { for (int Y = 0; Y < BoardMatrix.GetLength(1); ++Y) { BoardMatrix[X, Y] = eCoinColor.Empty; } } // Init the middle 4 coins BoardMatrix[middleOfHeight, middleOfWidth - 1] = eCoinColor.Black; BoardMatrix[middleOfHeight - 1, middleOfWidth - 1] = eCoinColor.White; BoardMatrix[middleOfHeight - 1, middleOfWidth] = eCoinColor.Black; BoardMatrix[middleOfHeight, middleOfWidth] = eCoinColor.White; }
private void CountAllCellsNearbyMines() { for (int i = 0; i < BoardMatrix.GetLength(0); i++) { if (i < 0 || i >= BoardMatrix.GetLength(0)) { continue; } for (int j = 0; j < BoardMatrix.GetLength(1); j++) { if (j < 0 || j >= BoardMatrix.GetLength(1)) { continue; } if (BoardMatrix[i, j].GetType() == typeof(MineCell)) { continue; } for (int k = -1; k < 2; k++) { if (k + i < 0 || k + i >= BoardMatrix.GetLength(0)) { continue; } for (int l = -1; l < 2; l++) { if (l + j < 0 || l + j >= BoardMatrix.GetLength(1)) { continue; } if (BoardMatrix[i + k, j + l].GetType() == typeof(MineCell)) { ((EmptyCell)BoardMatrix[i, j]).NearMinesNumber++; } } } } } }
private bool checkDiagonalQuartet() { bool i_ThereIsQuartet = false; int i_Chip; for (int i_ColIndex = 0; i_ColIndex < BoardMatrix.GetLength(1) - 3; i_ColIndex++) { // check right and down diagonal for (int i_RowIndex = 0; i_RowIndex < BoardMatrix.GetLength(0) - 3; i_RowIndex++) { i_Chip = BoardMatrix[i_RowIndex, i_ColIndex]; if (i_Chip != (int)GameManager.ePlayerNumber.Empty) { if ((i_Chip == BoardMatrix[i_RowIndex + 1, i_ColIndex + 1]) && (i_Chip == BoardMatrix[i_RowIndex + 2, i_ColIndex + 2]) && (i_Chip == BoardMatrix[i_RowIndex + 3, i_ColIndex + 3])) { i_ThereIsQuartet = true; break; } } } if (!i_ThereIsQuartet) { // check right and up diagonal for (int i_RowIndex = 3; i_RowIndex < BoardMatrix.GetLength(0); i_RowIndex++) { i_Chip = BoardMatrix[i_RowIndex, i_ColIndex]; if (i_Chip != (int)GameManager.ePlayerNumber.Empty) { if ((i_Chip == BoardMatrix[i_RowIndex - 1, i_ColIndex + 1]) && (i_Chip == BoardMatrix[i_RowIndex - 2, i_ColIndex + 2]) && (i_Chip == BoardMatrix[i_RowIndex - 3, i_ColIndex + 3])) { i_ThereIsQuartet = true; break; } } } } } return(i_ThereIsQuartet); }
private bool checkVerticalQuartet() { bool i_ThereIsQuartet = false; int i_Chip; for (int i_RowIndex = BoardMatrix.GetLength(0) - 4; i_RowIndex >= 0; i_RowIndex--) { for (int i_ColIndex = 0; i_ColIndex < BoardMatrix.GetLength(1); i_ColIndex++) { i_Chip = BoardMatrix[i_RowIndex, i_ColIndex]; if (i_Chip != (int)GameManager.ePlayerNumber.Empty) { if ((i_Chip == BoardMatrix[i_RowIndex + 1, i_ColIndex]) && (i_Chip == BoardMatrix[i_RowIndex + 2, i_ColIndex]) && (i_Chip == BoardMatrix[i_RowIndex + 3, i_ColIndex])) { i_ThereIsQuartet = true; break; } } } } return(i_ThereIsQuartet); }
private void Start() { agent = GetComponent <NEATAgent>(); blockBounds = blocks[0].GetComponent <SpriteRenderer>().bounds.size; blockBorders = blockBounds * new Vector2(width, hight); gameBoard = new BoardMatrix(width, hight, transform.position, blockBounds, blockBorders); waitTime = 0; currentMoveTime = waitMoveTime; currentScore = 0; comboWhitLast = false; combo = 1; pieces = 0; scoreText.text = "Score: 0"; comboText.text = "Combo: 1"; AddAllPiecesTypes(); ClearPieces(); CreateNewPiece(); StartCoroutine(MoveCurrenPiece()); }
public void Update(GameTime gameTime) { MouseState mouseState = Mouse.GetState(); if (mouseState.LeftButton != ButtonState.Pressed && mouseState.RightButton != ButtonState.Pressed) { _prevMouseState = mouseState; return; } Point mousePoint = new Point(mouseState.X, mouseState.Y); for (int i = 0; i < BoardMatrix.GetLength(0); i++) { for (int j = 0; j < BoardMatrix.GetLength(1); j++) { if (!BoardMatrix[i, j].PositionRectangle.Contains(mousePoint)) { continue; } if (mouseState.LeftButton == ButtonState.Pressed) { if (!_sapperGame.IsGameStarted) { StartGame(i, j); CountAllCellsNearbyMines(); _sapperGame.IsGameStarted = true; } BoardMatrix[i, j].OnClick(); } RightClickCheck(mouseState, i, j); } } _prevMouseState = mouseState; }
public bool PossibleMove(Position SelectedPiece, Position PositionToMove) { ChessPiece currentPiece = BoardMatrix[SelectedPiece.Row, SelectedPiece.Column]; OnPick(currentPiece); int row = PositionToMove.Row; int column = PositionToMove.Column; //If piece is not blank space if (currentPiece == null) { OnError(null, "Select a piece"); return(false); // If piece belongs to player } else if (!DoesPieceBelongToPlayer(currentPiece)) { OnError(currentPiece, "Piece doesn't belong to this player"); return(false); } else { // TODO: Collision Position[] possibleMoves = PossibleMovesWithCollission(currentPiece); if (possibleMoves.Any(move => move.Row == row && move.Column == column)) { BoardMatrix.UpdateBoard(currentPiece, currentPiece.Position, PositionToMove, OnMoving, OnDrop); TogglePlayers(); OnPlayersToggled(); ChessPiece DetectsKing; switch (CurrentPlayer) { case ChessColor.White: DetectsKing = CheckDetection(BoardMatrix.WhiteKing); break; default: DetectsKing = CheckDetection(BoardMatrix.BlackKing); break; } if (DetectsKing != null && DetectsKing.Color == CurrentPlayer) { BoardMatrix.UpdateBoard(currentPiece, currentPiece.Position, SelectedPiece, OnMoving, OnDrop); return(false); } ; return(true); } else { OnError(currentPiece, "You can't move there"); return(false); } } }
public bool IsInBorders(Point i_Cell) { return(i_Cell.X >= 0 && i_Cell.X < BoardMatrix.GetLength(0) && i_Cell.Y >= 0 && i_Cell.Y < BoardMatrix.GetLength(1)); }
static void Main(string[] args) { List <ArrayList> renJunStartList = new List <ArrayList>(); ArrayList array = new ArrayList(); #region 1、长星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼×┼┼┼┼┼9 //┼┼●┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("9, 7, 2"); array.Add("10, 6, 1"); renJunStartList.Add(array); #endregion #region 2、峡月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼┼┼┼┼7 //┼┼┼×●┼┼┼┼8 //┼┼●┼┼┼┼┼┼9 //┼┼┼┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("8, 7, 2"); array.Add("9, 6, 1"); renJunStartList.Add(array); #endregion #region 3、恒星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼×┼┼┼┼┼7 //┼┼●┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼┼┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 7, 2"); array.Add("8, 6, 1"); renJunStartList.Add(array); #endregion #region 4、水月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼×┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼●┼┼9 //┼┼┼┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 9, 2"); array.Add("9, 10, 1"); renJunStartList.Add(array); #endregion #region 5、流星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼×┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼┼┼┼┼●┼┼10 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 9, 2"); array.Add("10, 10, 1"); renJunStartList.Add(array); #endregion #region 6、云月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼●●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼┼┼┼┼┼┼┼10 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("8, 7, 1"); renJunStartList.Add(array); #endregion #region 7、浦月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼×┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼●┼┼┼9 //┼┼┼┼┼┼┼┼┼10 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 9, 2"); array.Add("9, 9, 1"); renJunStartList.Add(array); #endregion #region 8、岚月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼×┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼┼┼┼●┼┼┼10 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 9, 2"); array.Add("10, 9, 1"); renJunStartList.Add(array); #endregion #region 9、银月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼×┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼●┼┼┼┼9 //┼┼┼┼┼┼┼┼┼10 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 9, 2"); array.Add("9, 8, 1"); renJunStartList.Add(array); #endregion #region 10、明星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼×┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼┼┼●┼┼┼┼10 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 9, 2"); array.Add("10, 8, 1"); renJunStartList.Add(array); #endregion #region 11、斜月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼×┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼●┼┼┼┼┼9 //┼┼┼┼┼┼┼┼┼10 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 9, 2"); array.Add("9, 7, 1"); renJunStartList.Add(array); #endregion #region 12、名月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼×┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼●┼┼┼┼┼┼10 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 9, 2"); array.Add("10, 6, 1"); renJunStartList.Add(array); #endregion #region 13、彗星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼┼×┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼●┼┼┼┼┼┼10 array.Add("8, 8, 1"); array.Add("7, 9, 2"); array.Add("10, 6, 1"); renJunStartList.Add(array); #endregion #region 14、寒星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼●┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("6, 8, 1"); renJunStartList.Add(array); #endregion #region 15、溪月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼●┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("6, 9, 1"); renJunStartList.Add(array); #endregion #region 16、疏星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼●┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("6, 10, 1"); renJunStartList.Add(array); #endregion #region 17、花月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×●┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("7, 9, 1"); renJunStartList.Add(array); #endregion #region 18、残月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼●┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("7, 10, 1"); renJunStartList.Add(array); #endregion #region 19、雨月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●●┼┼┼8 //┼┼┼┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("8, 9, 1"); renJunStartList.Add(array); #endregion #region 20、金星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼●┼┼8 //┼┼┼┼┼┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("8, 10, 1"); renJunStartList.Add(array); #endregion #region 21、松月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼●┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("9, 8, 1"); renJunStartList.Add(array); #endregion #region 22、丘月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼●┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("9, 9, 1"); renJunStartList.Add(array); #endregion #region 23、新月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼●┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("9, 10, 1"); renJunStartList.Add(array); #endregion #region 24、瑞星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼┼┼●┼┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("10, 8, 1"); renJunStartList.Add(array); #endregion #region 25、山月开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼┼┼┼●┼┼┼9 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("10, 9, 1"); renJunStartList.Add(array); #endregion #region 26、游星开局 //4 5 6 7 8 9 101112 //┼┼┼┼┼┼┼┼┼5 //┼┼┼┼┼┼┼┼┼6 //┼┼┼┼×┼┼┼┼7 //┼┼┼┼●┼┼┼┼8 //┼┼┼┼┼┼┼┼┼9 //┼┼┼┼┼┼●┼┼10 array = new ArrayList(); array.Add("8, 8, 1"); array.Add("7, 8, 2"); array.Add("10, 10, 1"); renJunStartList.Add(array); #endregion foreach (var items in renJunStartList) { BoardMatrix boardMatrix = new BoardMatrix(15); boardMatrix.ChessRule = RenJunRule.PROHIBITED_YES; boardMatrix.User = "******"; foreach (var item in items) { //删除空格 String points = item.ToString().Replace(" ", ""); String[] myPoints = points.Split(','); boardMatrix.SetMatrixPices(int.Parse(myPoints[0]), int.Parse(myPoints[1]), int.Parse(myPoints[2])); } while (true) { Console.WriteLine(boardMatrix.ToTextMatrix()); String json = boardMatrix.ToPostJson(); HttpClientDoPost(json); if (RunFinished == true) { break; } while (GotResult == false) { Thread.Sleep(100); } String[] point = LastResult.Split(','); if (point.Length < 3) { continue; } int x = int.Parse(point[0]); int y = int.Parse(point[1]); int p = int.Parse(point[2]); boardMatrix.SetMatrixPices(x, y, p); } } }