src/strategy/Reachability.java
public static Strategy permissive(Game game, GameInfo gameinfo) {
		assert(game != null);
		Ranks.entire(game, 1);
		if (game.states.get(game.initialState).rank < 1) // zero or -1 (infinity)
			return null;
		
		Strategy result = new Strategy(1,'r');
		
        LinkedList<Integer> queue = new LinkedList<Integer>();
		TreeSet<Integer> flag = new TreeSet<Integer>();
		queue.add(game.initialState);
		flag.add(game.initialState);
		
		while (queue.size() > 0) {
			Integer from = queue.remove();
			if (game.states.get(from).player == 1) { // restricted by the strategy
				boolean something = false;
				for (int i=0; i<Util.bitpower(game.varActionP1no()); i++) {
					int into = game.successor(gameinfo, from, i, 2);
					if (game.states.get(into).rank < game.states.get(from).rank && game.states.get(into).rank != -1) {
						// allow this action
						something = true;
						result.addBitv(game, from, i, true);
						if (!flag.contains(into) && game.states.get(into).rank != 0) {
							queue.add(into);
							flag.add(into);
						}
					} else {
						// disallow this action
						result.addBitv(game, from, i, false);
					}
				}
				assert(something);
			} else { // the opponent is allowed to move anywhere
				for (Integer into : game.transitions.get(from))
					if (!flag.contains(into) && game.states.get(into).rank != 0) {
						queue.add(into);
						flag.add(into);
					}
			}
		}
		
		return result;
	}
/**
	 * Computes permissive (multiple actions per state) safety strategy for player 2
	 * @param game		Compute for this game
	 * @param gameinfo  Info about the game
	 * @return          The strategy
	 */
Computes permissive (multiple actions per state) safety strategy for player 2
@param game          Compute for this game
@param gameinfo  Info about the game
@return          The strategy
Computes permissive ( multiple actions per state ) safety strategy for player 2 @param game Compute for this game @param gameinfo Info about the game @return The strategy
public static Strategy permissive(Game game, GameInfo gameinfo) {
		assert(game != null);
		Ranks.entire(game, 1);
		if (game.states.get(game.initialState).rank < 1) 
			return null;
		Strategy result = new Strategy(1,'r');
        LinkedList<Integer> queue = new LinkedList<Integer>();
		TreeSet<Integer> flag = new TreeSet<Integer>();
		queue.add(game.initialState);
		flag.add(game.initialState);
		while (queue.size() > 0) {
			Integer from = queue.remove();
			if (game.states.get(from).player == 1) { 
				boolean something = false;
				for (int i=0; i<Util.bitpower(game.varActionP1no()); i++) {
					int into = game.successor(gameinfo, from, i, 2);
					if (game.states.get(into).rank < game.states.get(from).rank && game.states.get(into).rank != -1) {
						something = true;
						result.addBitv(game, from, i, true);
						if (!flag.contains(into) && game.states.get(into).rank != 0) {
							queue.add(into);
							flag.add(into);
						}
					} else {
						result.addBitv(game, from, i, false);
					}
				}
				assert(something);
			} else { 
				for (Integer into : game.transitions.get(from))
					if (!flag.contains(into) && game.states.get(into).rank != 0) {
						queue.add(into);
						flag.add(into);
					}
			}
		}
		return result;
	}
public static Strategy permissive ( Game game , GameInfo gameinfo ) { assert ( game != null ) ; Ranks . entire ( game , 1 ) ; if ( game . states . get ( game . initialState ) . rank < 1 ) return null ; Strategy result = new Strategy ( 1 , 'r' ) ; LinkedList < Integer > queue = new LinkedList < Integer > ( ) ; TreeSet < Integer > flag = new TreeSet < Integer > ( ) ; queue . add ( game . initialState ) ; flag . add ( game . initialState ) ; while ( queue . size ( ) > 0 ) { Integer from = queue . remove ( ) ; if ( game . states . get ( from ) . player == 1 ) { boolean something = false ; for ( int i = 0 ; i < Util . bitpower ( game . varActionP1no ( ) ) ; i ++ ) { int into = game . successor ( gameinfo , from , i , 2 ) ; if ( game . states . get ( into ) . rank < game . states . get ( from ) . rank && game . states . get ( into ) . rank != - 1 ) { something = true ; result . addBitv ( game , from , i , true ) ; if ( ! flag . contains ( into ) && game . states . get ( into ) . rank != 0 ) { queue . add ( into ) ; flag . add ( into ) ; } } else { result . addBitv ( game , from , i , false ) ; } } assert ( something ) ; } else { for ( Integer into : game . transitions . get ( from ) ) if ( ! flag . contains ( into ) && game . states . get ( into ) . rank != 0 ) { queue . add ( into ) ; flag . add ( into ) ; } } } return result ; }
Computes permissive (multiple actions per state) safety strategy for player 2
 @param game          Compute for this game
 @param gameinfo  Info about the game
 @return          The strategy
Computes permissive ( multiple actions per state ) safety strategy for player 2 @param game Compute for this game @param gameinfo Info about the game @return The strategy
// zero or -1 (infinity) // restricted by the strategy // allow this action // disallow this action // the opponent is allowed to move anywhere