Example #1
0
 public bool CanPlaceBlackStone(Field field)
 {
     return field.IsEmpty && FieldIsInMiddleRows(field) && FieldIsInMiddleColumns(field);
 }
Example #2
0
 public Tuple<int, int> GetCoordinates(Field field)
 {
     int row = field.Id/ColumnCount;
     int column = field.Id%ColumnCount;
     return Tuple.Create(row, column);
 }
Example #3
0
 private Field GetNewField(int row, int col)
 {
     int index = GetFieldIndex(row, col);
     var field = new Field(index, row, col);
     if (IsCentralField(row, col))
     {
         field.PlaceWhiteStone();
         _whiteField = field;
     }
     return field;
 }
Example #4
0
 private void UpdateField(Field field)
 {
     var fieldToUpdate = _fieldMap[field.Id];
     fieldToUpdate.Stone = field.Stone;
     fieldToUpdate.Selected = field.Selected;
     _blackFields.Remove(fieldToUpdate);
     if(fieldToUpdate.HasWhiteStone)
     {
         _whiteField = fieldToUpdate;
     }else
     {
         if(fieldToUpdate.HasBlackStone)
         {
             _blackFields.Add(fieldToUpdate);
         }
     }
 }
Example #5
0
 private bool FieldIsInMiddleRows(Field field)
 {
     return field.IsInMiddleRows(RowCount);
 }
Example #6
0
 private bool FieldIsInMiddleColumns(Field field)
 {
     return field.IsInMiddleColumns(ColumnCount);
 }
 public IStoneJumper GetStoneJumper(Field fromfield, Field toField)
 {
     return new StoneJumper(_fieldsGraph, fromfield, toField);
 }
 public bool CanPlaceBlackStone(Field field)
 {
     return _fieldsGraph.CanPlaceBlackStone(field);
 }
Example #9
0
 public bool Equals(Field other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other._id == _id;
 }