//public PieceMap<int, IPiece> PieceList //{ // get => _pieceList; // private set => _pieceList = value; //} public static void InitializePieceStateList() { if (InitIntList == null) { return; } var iterator = InitIntList.GetEnumerator(); for (var y = 0; y <= 9; y++) { for (var x = 0; x <= 8; x++) { if (!iterator.MoveNext()) { continue; } var i = iterator.Current; IPiece piece = PieceFactory.GetPiece(i, x, y); if (i != 0) { InitPieceList.GetOrAdd(piece.GetK(), piece); } } } }
private PieceMap <int, IPiece> ClonePieceList() { var list = new PieceMap <int, IPiece>(PieceFactory.GetPiece(0, 10, 10)); var pieces = _pieceList.Values; foreach (var piece in pieces) { list.TryAdd(piece.GetK(), (IPiece)piece.Clone()); } return(list); }
public void TestMovePieceSimple() { var states = new State(); states = PieceMove.MovePiece(states, 7, 7, 4, 7);//user Debug.WriteLine(states.ToString()); //states = PieceMove.MovePiece(states, 1, 2, 1, 9);//com states = (AlphaBetaSearch.DoSearch(states, 1)); Debug.WriteLine(states.ToString()); states = PieceMove.MovePiece(states, 0, 9, 1, 9);//user Debug.WriteLine(states.ToString()); Assert.AreEqual(30, states.GetPieceList().Count); var piece = PieceFactory.GetPiece(23, 1, 9); Assert.AreEqual(typeof(Rook), piece.GetType()); }
public void TestGetEmptyPiece() { var piece = PieceFactory.GetPiece(0, 0, 9); Assert.AreEqual(typeof(Empty), piece.GetType()); }
public void TestGetRookPiece() { var piece = PieceFactory.GetPiece(23, 1, 9); Assert.AreEqual(typeof(Rook), piece.GetType()); }