private void FindSingleMoves(BgMoveList moveList, int val) { for (int i = m_BgGame.BoardSquareCount - 1; i > 0; i--) { if (m_BgGame.SquareOwner(i) == m_BgGame.CurrentPlayer) { if (m_BgGame.ValidateMove(i, i - val)) { BgMove move = new BgMove(i, i - val, null); moveList.AddBgMove(move); } } if (i <= 6 && m_BgGame.ValidateMove(i, 26)) { BgMove move = new BgMove(i, 26, null); moveList.AddBgMove(move); } } }
private void GenerateMoves(BgMoveList moveList, BgMove prevMove) { BgMoveList singleMoves = FindAllSingleMoves(); if (singleMoves.Count() > 0) { for (int i = 0; i < singleMoves.Count(); i++) { BgMove currentMove = new BgMove(singleMoves.GetBgMove(i).From, singleMoves.GetBgMove(i).To, prevMove); m_BgGame.MakeMove(currentMove.From, currentMove.To); GenerateMoves(moveList, currentMove); m_BgGame.Undo(); } } else { if (prevMove != null) { moveList.AddBgMove(BgMove.CloneFromFirst(prevMove.FirstMove)); } } }
private void GenerateMoves( BgMoveList moveList, BgMove prevMove ) { BgMoveList singleMoves = FindAllSingleMoves(); if ( singleMoves.Count() > 0 ) { for ( int i = 0; i < singleMoves.Count(); i++ ) { BgMove currentMove = new BgMove( singleMoves.GetBgMove( i ).From, singleMoves.GetBgMove( i ).To, prevMove ); m_BgGame.MakeMove( currentMove.From, currentMove.To ); GenerateMoves( moveList, currentMove ); m_BgGame.Undo(); } } else { if ( prevMove != null ) moveList.AddBgMove( BgMove.CloneFromFirst( prevMove.FirstMove ) ); } }
private void FindSingleMoves( BgMoveList moveList, int val ) { for ( int i = m_BgGame.BoardSquareCount - 1; i > 0; i-- ) { if ( m_BgGame.SquareOwner( i ) == m_BgGame.CurrentPlayer ) { if ( m_BgGame.ValidateMove( i, i - val ) ) { BgMove move = new BgMove( i, i - val, null ); moveList.AddBgMove( move ); } } if ( i <= 6 && m_BgGame.ValidateMove( i, 26 ) ) { BgMove move = new BgMove( i, 26, null ); moveList.AddBgMove( move ); } } }