本文整理匯總了C#中Board類的典型用法代碼示例。如果您正苦於以下問題:C# Board類的具體用法?C# Board怎麽用?C# Board使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Board類屬於命名空間,在下文中一共展示了Board類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Logic
protected Logic(int width, int height, Vector2D[] homeSquares)
{
Board = new Board(width, height);
this.homeSquares = homeSquares;
availableColorFinder = new AvailableColorFinder(Board, homeSquares);
turns = new int[homeSquares.Length];
}
示例2: EqualsReturnsTrueWhenEqual
public void EqualsReturnsTrueWhenEqual()
{
int[,] data1 = {
{9,0,0, 0,0,5, 6,8,1 },
{0,6,0, 2,8,0, 7,0,0 },
{0,0,0, 0,0,6, 9,0,5 },
{0,8,0, 0,0,2, 0,4,6 },
{0,0,5, 0,0,0, 3,0,0 },
{1,9,0, 5,0,0, 0,7,0 },
{8,0,2, 9,0,0, 0,0,0 },
{0,0,9, 0,2,7, 0,6,0 },
{6,7,4, 8,0,0, 0,0,3 }
};
int[,] data2 = {
{9,0,0, 0,0,5, 6,8,1 },
{0,6,0, 2,8,0, 7,0,0 },
{0,0,0, 0,0,6, 9,0,5 },
{0,8,0, 0,0,2, 0,4,6 },
{0,0,5, 0,0,0, 3,0,0 },
{1,9,0, 5,0,0, 0,7,0 },
{8,0,2, 9,0,0, 0,0,0 },
{0,0,9, 0,2,7, 0,6,0 },
{6,7,4, 8,0,0, 0,0,3 }
};
IBoard board1 = new Board(data1);
IBoard board2 = new Board(data2);
Assert.True(board1.Equals(board2));
Assert.True(board2.Equals(board1));
Assert.True(board1.Equals(board1));
Assert.True(board2.Equals(board2));
}
示例3: BuildLevel
public void BuildLevel(Board board)
{
var children = new List<GameObject>();
foreach (Transform child in transform)
children.Add(child.gameObject);
children.ForEach(child => Destroy(child));
originalMatrix = board.Grid;
matrix = PrepareMatrix(originalMatrix);
int n = board.NoRooms;
floors = new Floor[matrix.GetLength(0)-2,matrix.GetLength(1)-2];
walls = new Wall[matrix.GetLength(0)-1, matrix.GetLength(1)-1];
Rooms = new Room[n];
graph = new Graph();
for (int i = 0; i < n; ++i)
{
Rooms[i] = new Room(i+1, DefaultFloorMaterial);
}
RoomPropertiesPanel.InitializePanel(n);
Vector3 shift = new Vector3(((matrix.GetLength(1) - 2) * unit) / 2, 0f, ((matrix.GetLength(0) - 2) * -unit) / 2);
this.transform.position = shift;
SpawnWalls();
SpawnFloors();
SpawnDoors();
foreach (var room in Rooms)
{
room.SetRoomMaterial();
}
isSaved = false;
}
示例4: ToolTipInstance
public ToolTipInstance(Board board, SerializationForm json)
: base(board, json)
{
title = json.title;
desc = json.desc;
originalNum = json.originalnum;
}
示例5: UpdateSquares
public void UpdateSquares(Board instanceBoard)
{
for (int i = 0; i < _allSquares.LongLength; i++)
{
int y = i%15; //rows
int x = i/15; //columns
Square s = instanceBoard.Get(x,y);
//remove tile
BoardSquare thisGuy = _allSquares[x,y];
thisGuy.MySquare = s;
thisGuy.PlacedTile = null;
//add tile if exists
if (!s.IsEmpty)
{
Scrabble.Core.Types.Tile t = (Scrabble.Core.Types.Tile)s.Tile;
_allSquares[x, y].PlacedTile = new Tile(t.Letter.ToString(), t.Score);
}
else if (s.WordMultiplier > 0 || s.LetterMultiplier > 0)
{
//special square, need to display accordingly
thisGuy.SquareContainer.Background = ("#" + s.Gradient).ToBrush();
}
}
Redraw();
}
示例6: FindMoves
public IEnumerable<Movement> FindMoves(Board board)
{
List<Tuple<Block, FlagCombination>> allValidCombinations = new List<Tuple<Block, FlagCombination>>();
for (int i = 0; i < board.Width; i++)
{
for (int j = 0; j < board.Height; j++)
{
Block current = board.Grid[i, j];
if (current.State != BlockState.Value || current.Value == 0)
continue;
var neighbors = new NeighborList(board.Grid, current);
if (board.isBlockSolved(current, neighbors))
continue;
int flagCount = neighbors.GetFlagCount();
var unknown = neighbors.GetUnknownBlocks().ToList();
allValidCombinations.Add(new Tuple<Block, FlagCombination>(current,
board.getValidCombinations(unknown, current.Value - flagCount)));
}
}
yield break;
}
示例7: CheckIfAddNullFigureThrowsException
public void CheckIfAddNullFigureThrowsException()
{
var board = new Board();
var position = new Position(6, 6);
IFigure figure = null;
board.AddFigure(figure, position);
}
示例8: ShouldBePlayed
public override bool ShouldBePlayed(Board board)
{
if(board.MinionFriend.Count == 0 && board.MinionEnemy.Count == 0)
return false;
return true;
}
示例9: GameDescriptor
public GameDescriptor(Board board, Unit.OwnerEnum turn)
{
units = new UnitInfo[BoardInfo.Row, BoardInfo.Col];
grids = new Board.GridState[BoardInfo.Row, BoardInfo.Col];
playerInfo = new int[2][] { new int[(int)(Unit.TypeEnum.Void)], new int[(int)(Unit.TypeEnum.Void)]};
for (int i = 0; i < BoardInfo.Row; i++)
for (int j = 0; j < BoardInfo.Col; j++)
{
units[i, j] = board.GetUnitInfo(new Position(i, j));
if (units[i, j].type == Unit.TypeEnum.Bread)
units[i, j].type = Unit.TypeEnum.Void;
grids[i, j] = board.GetGridState(new Position(i, j));
}
for(Unit.TypeEnum type = Unit.TypeEnum.Bread; type < Unit.TypeEnum.Void; type++) {
playerInfo[(int)Unit.OwnerEnum.Black][(int)type] = board.GetPlayerInfo(type,Unit.OwnerEnum.Black);
playerInfo[(int)Unit.OwnerEnum.White][(int)type] = board.GetPlayerInfo(type,Unit.OwnerEnum.White);
}
restResource = board.RestBread;
hasMove = false;
hasBuy = false;
this.turn = turn;
}
示例10: Move
public Move(Step step, Board board)
{
_board = board;
Step = new Step(step);
oldFrom = _board[(step.FromX << 3) + step.FromY];
oldTo = _board[(step.ToX << 3) + step.ToY];
}
示例11: CalculateGameOfLife
public void CalculateGameOfLife(int[,] array)
{
board = new Board (array);
row = array.GetLength (0);
col = array.GetLength (1);
int[,] temp=new int[array.GetLength(0),array.GetLength(1)];
for (int i=0; i<row; i++)
for (int j=0; j<col; j++) {
temp[i,j]=array[i,j];
}
for (int i=0; i<row; i++)
for (int j=0; j<col; j++) {
int count=board.GetAdjacentPointCount(i,j);
if(array[i,j]==1){
if(count<2){//0 or 1
temp[i,j]=0;
}
else if(count<4){//2 or 3
temp[i,j]=1;
}
else if(count>3){//3,4,5,6,7,8
temp[i,j]=0;
}
}
else if(count ==3){
temp[i,j]=1;
}
}
array = temp;
mArray = temp;
}
示例12: WalkCommand
public WalkCommand(Point from,int width, int height,Board parent)
{
m_from = from;
m_parent = parent;
m_posibilities = CalculatePosibilities(width,height);
}
示例13: BeforeEachTest
public void BeforeEachTest()
{
Target = new Board();
var positioner = new PiecePositioner(Target);
positioner.SetupStandardPieces(1);
positioner.SetupStandardPieces(8, false);
}
開發者ID:chnicholas,項目名稱:ChessTDD,代碼行數:7,代碼來源:Board_GetMovesFrom_Given_ChessboardSetupWithoutPawns_Should.cs
示例14: Thread
/// <summary>
/// Construct a thread from an initial post and a board.
/// </summary>
/// <param name="board">The parent board out of the board cache.</param>
/// <param name="op">The first post in the thread.</param>
public Thread(Board board, APIPost op)
{
Board = board;
Number = op.Number;
Posts = new SortedDictionary<ulong, Post>();
Merge(op);
}
示例15: doMove
public void doMove(Player p, Board b)
{
Console.WriteLine("This is the move when i'm angry!!!!!!!!!!!!!!");
stateMachine.goingTo.coverOpponent(p, b);
availableMoves = AICalc.getPossibleMoves(p, b);
}