private void InitState() { if (InitPieceList.Count == 0) { InitializePieceStateList(); } _pieceList = InitPieceList; }
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 string ToString(PieceMap <int, IPiece> pieceList) { var buffer = new StringBuilder(); buffer.Append(CoordinateXString); buffer.Append(RiverString); for (var y = 0; y <= 9; y++) { buffer.Append(y + " ||"); for (var x = 0; x <= 8; x++) { buffer.Append(" "); var k = Utility.GetOneDimention(x, y); var piece = pieceList.Get(k); var pieceString = PrintNum ? piece.GetNumber().ToString() : piece.ToString(); buffer.Append(pieceString); } buffer.Append(" ||" + y); buffer.Append((y == 4) ? ("\n" + RiverString) : "\n"); } buffer.Append(RiverString); buffer.Append(CoordinateXString); return(buffer.ToString()); }
private void SetPieceList(PieceMap <int, IPiece> pieceList) { _pieceList = pieceList; }