本文整理汇总了C#中Grid.square_at方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.square_at方法的具体用法?C# Grid.square_at怎么用?C# Grid.square_at使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid
的用法示例。
在下文中一共展示了Grid.square_at方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: found_diagonal_winning_line_for
private static bool found_diagonal_winning_line_for(Token token, Grid tic_tac_toe_grid)
{
bool found_winning_line = false;
var coordinate_0_0 = new Coordinate(0, 0);
var coordinate_1_1 = new Coordinate(1, 1);
var coordinate_2_2 = new Coordinate(2, 2);
var coordinate_0_2 = new Coordinate(0, 2);
var coordinate_2_0 = new Coordinate(2, 0);
if (tic_tac_toe_grid.square_at(coordinate_0_0)
.contains_token_matching(token) &&
tic_tac_toe_grid.square_at(coordinate_1_1)
.contains_token_matching(token) &&
tic_tac_toe_grid.square_at(coordinate_2_2)
.contains_token_matching(token))
found_winning_line = true;
else if (tic_tac_toe_grid.square_at(coordinate_0_2)
.contains_token_matching(token) &&
tic_tac_toe_grid.square_at(coordinate_1_1)
.contains_token_matching(token) &&
tic_tac_toe_grid.square_at(coordinate_2_0)
.contains_token_matching(token))
found_winning_line = true;
return found_winning_line;
}
示例2: found_3_tokens_in_a_column_for
private bool found_3_tokens_in_a_column_for(int column, Token token, Grid tic_tac_toe_grid)
{
return tic_tac_toe_grid.square_at(new Coordinate(0,column)).contains_token_matching(token) &&
tic_tac_toe_grid.square_at(new Coordinate(1,column)).contains_token_matching(token) &&
tic_tac_toe_grid.square_at(new Coordinate(2,column)).contains_token_matching(token);
}
示例3: found_3_tokens_in_a_row_for
private bool found_3_tokens_in_a_row_for(int row, Token token, Grid tic_tac_toe_grid)
{
return tic_tac_toe_grid.square_at(new Coordinate(row,0)).contains_token_matching(token) &&
tic_tac_toe_grid.square_at(new Coordinate(row,1)).contains_token_matching(token) &&
tic_tac_toe_grid.square_at(new Coordinate(row,2)).contains_token_matching(token);
}