I have enum list and method and i get error: " not all code paths return a value"
Some idea whats wrong in my method ? I am sure I always return STANY type :/

Thanks for help :)

     private enum STANY { PATROL, CHAT, EAT, SEARCH, DIE };

     private STANY giveState(int id, List&lt;Ludek&gt; gracze, List&lt;int&gt; plansza)
    {
        // Sprawdz czy gracz stoi na polu z jedzeniem i nie ma 2000 jednostek jedzenia
        bool onTheFood = false;
        onTheFood = CzyPoleZjedzeniem(id, gracze, plansza, onTheFood);

        if (onTheFood &amp;&amp; (gracze[id].IloscJedzenia &lt; startFood / 2))
            return STANY.EAT;

        // Sprawdz czy gracz nie stoi na polu z innym graczem
        bool allKnowledge = true;
        allKnowledge = CzyPoleZInnymGraczem(id, gracze, allKnowledge);

        if (!allKnowledge)
            return STANY.CHAT;

        // Jesli ma ponad i rowna ilosc jedzenia patroluj
        if (gracze[id].IloscJedzenia &gt;= startFood / 2)
            return STANY.PATROL;

        // Jesli ma mniej niz polowe jedzenia szukaj jedzenia
        if (gracze[id].IloscJedzenia &gt; 0 &amp;&amp; gracze[id].IloscJedzenia &lt; startFood / 2)
            return STANY.SEARCH;

        // Jesli nie ma jedzenia umieraj
        if (gracze[id].IloscJedzenia &lt;= 0)
            return STANY.DIE;
    }



Question: Adjustable sample size in clinical trial
Answer: Ideally that's the point of a Phase II trial. Results from these studies, often single-arm in design, are used for power calculations. Sometimes they experiment with dosing and eligibility criteria, the more moving parts in a Phase II study, the more of a gamble a Phase III study will be.

If a compound is showing to be promising a Data Monitoring Committee might recommend increasing enrollment or decreasing it appropriately. Sometimes it's about the risk of harm. If a compound is underpowered because the effect is not as powered as it was hoped to be, the DMC may end the study since the study subjects, by virtue of participating in the study, are exposing themselves to risk. Studies cannot go on perpetually as a matter of ethics.

Indeed there is a whole field of sequential adaptive trials that allows researchers to seamlessly transition from Phase II to Phase III studies. The statistical software package SeqTrial in S+ from Scott Emerson allows you to perform sample size calculations for a variety of alpha spending rules and effect sizes. 

The FDA's overreliance on "traditional" statistics is pretty against it, as it can affect the integrity of findings. It's actually a good principle in this case, and Tom Fleming has rallied against it in his paper "Discerning Hype From Substance." Basically, collating Phase II and Phase III study findings is rarely if ever appropriate, even when the protocols are similar (identical) between II and III. This is because the Phase III study only happened because Phase II looks/looked promising. So selection bias will affect the validity of those aggregated findings.