public PlayerActionGenerator(GameState a_gs) {
        // Generate the reserved resources:
        base_ru = new PlayerAction(a_gs.getMapWidth(), a_gs.getMapHeight());
        gs = a_gs;
        
        for(Unit u:gs.getMyUnits()) {
            if (u.hasAction()) {
                base_ru.mergeResourceUsage(u, u.getAction());
            }
        }
        
        choices = new ArrayList<Pair<Unit,List<UnitAction> > >();
        for(Unit u:gs.getMyUnits()) {
            if (!u.hasAction() && u.getActions().size() > 0) {
                choices.add(new Pair<Unit,List<UnitAction>>(u,u.getActions()));
                size*=u.getActions().size();
            }
        }

        if (choices.size() == 0) {
        	return;
        }
        //if (choices.size()==0) throw new Exception("Move generator created with no units that can execute actions!");

        choiceSizes = new int[choices.size()];
        currentChoice = new int[choices.size()];
        int i = 0;
        for(Pair<Unit,List<UnitAction> > choice:choices) {
            choiceSizes[i] = choice.m_b.size();
            currentChoice[i] = 0;
            i++;
        }
    }