本文整理汇总了C#中Board类的典型用法代码示例。如果您正苦于以下问题:C# Board类的具体用法?C# Board怎么用?C# Board使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Board类属于命名空间,在下文中一共展示了Board类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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];
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:Logic.cs
示例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));
}
开发者ID:sayedihashimi,项目名称:sudoku,代码行数:34,代码来源:BoardTests.cs
示例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;
}
开发者ID:DormantDreams,项目名称:video-game-level-scanner,代码行数:30,代码来源:LevelBuilder.cs
示例4: ToolTipInstance
public ToolTipInstance(Board board, SerializationForm json)
: base(board, json)
{
title = json.title;
desc = json.desc;
originalNum = json.originalnum;
}
开发者ID:kokose1234,项目名称:HaSuite,代码行数:7,代码来源:ToolTipInstance.cs
示例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();
}
开发者ID:JonPM,项目名称:sharpscrabble,代码行数:27,代码来源:DisplayBoard.xaml.cs
示例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;
}
开发者ID:FUR10N,项目名称:Minesweeper,代码行数:25,代码来源:BorderSolver.cs
示例7: CheckIfAddNullFigureThrowsException
public void CheckIfAddNullFigureThrowsException()
{
var board = new Board();
var position = new Position(6, 6);
IFigure figure = null;
board.AddFigure(figure, position);
}
开发者ID:kskondov,项目名称:King-Survival-4,代码行数:7,代码来源:BoardTests.cs
示例8: ShouldBePlayed
public override bool ShouldBePlayed(Board board)
{
if(board.MinionFriend.Count == 0 && board.MinionEnemy.Count == 0)
return false;
return true;
}
开发者ID:MahirZukic,项目名称:smartcustomclass,代码行数:7,代码来源:EX1_603.cs
示例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;
}
开发者ID:hyf042,项目名称:BakeryGirl_Chess,代码行数:26,代码来源:GameDescriptor.cs
示例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];
}
开发者ID:KarelinDmitriy,项目名称:SIILaba,代码行数:7,代码来源:Move.cs
示例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;
}
开发者ID:MelodySo,项目名称:LeetCode,代码行数:32,代码来源:GameOfLife.cs
示例12: WalkCommand
public WalkCommand(Point from,int width, int height,Board parent)
{
m_from = from;
m_parent = parent;
m_posibilities = CalculatePosibilities(width,height);
}
开发者ID:ericknajjar,项目名称:taticsthegame,代码行数:7,代码来源:GameBoardBuilder.cs
示例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);
}
开发者ID:Izuzusama,项目名称:4charm,代码行数:12,代码来源:Thread.cs
示例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);
}
开发者ID:ds0nt,项目名称:group-15-3,代码行数:7,代码来源:AIStateAngry.cs
示例16: _003_Does_Particular_Cell_Exist
public void _003_Does_Particular_Cell_Exist()
{
var board = new Board();
var expected = board.CellExists(new Coordinate(3, 4));
Assert.IsTrue(expected);
}
开发者ID:Zhenya21,项目名称:Checkers,代码行数:7,代码来源:BoardTests.cs
示例17: LayeredItem
public LayeredItem(Board board, Layer layer, int zm, int x, int y, int z)
: base(board, x, y, z)
{
this.layer = layer;
layer.Items.Add(this);
this.zm = zm;
}
开发者ID:kokose1234,项目名称:HaSuite,代码行数:7,代码来源:LayeredItem.cs
示例18: Start
// Use this for initialization
void Start () {
rend = gameObject.GetComponent<SpriteRenderer> ();
rend.enabled = false;
board = GameObject.FindWithTag ("Board").GetComponent<Board>();
menu = GameObject.FindWithTag ("Menu");
}
开发者ID:nevaermorr,项目名称:thesummoning,代码行数:8,代码来源:MenuHover.cs
示例19: Game
// Constructor
public Game(int playerCount)
{
numberOfPlayers = playerCount;
players = new Player[numberOfPlayers];
currentPlayer = players[InitFirstPlayer(numberOfPlayers)];
board = new Board();
}
开发者ID:ThomasKearney,项目名称:Catan,代码行数:8,代码来源:Game.cs
示例20: MainForm
public MainForm()
{
SuspendLayout();
_humanBoard = new Board();
_computerBoard = new Board(false);
_humanPlayer = new HumanPlayer("You", _computerBoard);
_computerPlayer = new ComputerPlayer("Computer");
_scoreboard = new ScoreBoard(_humanPlayer, _computerPlayer, 10, 100);
_controller = new GameController(_humanPlayer, _computerPlayer, _humanBoard, _computerBoard, _scoreboard);
_shuffleButton = CreateButton(ShuffleCharacter.ToString(), ButtonBackColor);
_newGameButton = CreateButton(NewGameCharacter.ToString(), ButtonBackColor);
_startGameButton = CreateButton(StartGameCharacter.ToString(), ButtonBackColor);
SetupWindow();
LayoutControls();
_scoreboard.GameEnded += OnGameEnded;
_shuffleButton.Click += OnShuffleButtonClick;
_startGameButton.Click += OnStartGameButtonClick;
_newGameButton.Click += OnNewGameButtonClick;
ResumeLayout();
StartNewGame();
}
开发者ID:Time-2Go,项目名称:Sea-Battle-Game,代码行数:30,代码来源:MainForm.cs
注:本文中的Board类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论