public static void AddStrategy(STStrategy strategy) { if (false == mListSTStrategy.Contains(strategy)) { mListSTStrategy.Add(strategy); } }
// WARNING: When you get the "best" rotation and translation // from the following function, you must wait until the piece has // its origin at least as low as row 0 (zero) instead of its initial // row -1 (negative one) if any rotations (1,2,3) are required. // Perform all rotations, and then perform translations. This // avoids the problem of getting the piece jammed on the sides // of the board where rotation is impossible. *** // Also, the following strategy does not take advantage of the // possibility of using free-fall and future movements to // slide under overhangs and fill them in. public static void GetBestMoveOncePerPiece ( STBoard board, STPiece piece, bool nextPieceFlag, // false == no next piece available or known STPiece.STPieceShape nextPieceShape, // None == no piece available or known ref int bestRotationDelta, // 0 or {0,1,2,3} ref int bestTranslationDelta // 0 or {...,-2,-1,0,1,2,...} ) { bestRotationDelta = 0; bestTranslationDelta = 0; STStrategy strategy = null; strategy = GetCurrentStrategy(); if (null == strategy) { return; } strategy.GetBestMoveOncePerPiece ( board, piece, nextPieceFlag, // false == no next piece available or known nextPieceShape, // None == no piece available or known ref bestRotationDelta, // 0 or {0,1,2,3} ref bestTranslationDelta // 0 or {...,-2,-1,0,1,2,...} ); }