예제 #1
0
    public int check(CoastCon fromCoast, CoastCon toCoast, BoatCon boat)          // 0->not finish, 1->lose, 2->win
    {
        int fromP = 0, fromD = 0, toP = 0, toD = 0;

        int[] fromCount = fromCoast.getCharacterNum();
        fromP += fromCount[0];
        fromD += fromCount[1];

        int[] toCount = toCoast.getCharacterNum();
        toP += toCount[0];
        toD += toCount[1];

        if (toP + toD == 6)
        {
            return(2);                //win
        }
        int[] boatCount = boat.getCharacterNum();
        if (boat.getStatus() == -1)
        {
            toP += boatCount[0]; toD += boatCount[1];   // boat at toCoast
        }
        else
        {
            fromP += boatCount[0]; fromD += boatCount[1];       // boat at fromCoast
        }
        if (fromP < fromD && fromP > 0)
        {
            return(1);                            //lose
        }
        if (toP < toD && toP > 0)
        {
            return(1);                   //lose
        }
        return(0);                       // not finish
    }
예제 #2
0
    int check()
    {
        int fromP = 0, fromD = 0, toP = 0, toD = 0;

        int[] fromCount = fromCoast.getCharacterNum();
        fromP += fromCount[0];
        fromD += fromCount[1];

        int[] toCount = toCoast.getCharacterNum();
        toP += toCount[0];
        toD += toCount[1];

        if (toP + toD == 6)
        {
            return(2);
        }
        int[] boatCount = boat.getCharacterNum();
        if (boat.getStatus() == -1)
        {
            toP += boatCount[0]; toD += boatCount[1];
        }
        else
        {
            fromP += boatCount[0]; fromD += boatCount[1];
        }
        if (fromP < fromD && fromP > 0)
        {
            return(1);
        }
        if (toP < toD && toP > 0)
        {
            return(1);
        }
        return(0);
    }
예제 #3
0
    public int tip(CoastCon fromCoast, CoastCon toCoast, BoatCon boat)
    {
        int fromP = 0, fromD = 0, toP = 0, toD = 0, boatst = 0;

        int[] fromCount = fromCoast.getCharacterNum();
        fromP += fromCount[0];
        fromD += fromCount[1];

        int[] toCount = toCoast.getCharacterNum();
        toP += toCount[0];
        toD += toCount[1];

        int[] boatCount = boat.getCharacterNum();
        if (boat.getStatus() == -1)
        {
            boatst = 1;
        }
        else
        {
            boatst = 0;
        }
        if (boat.getStatus() == -1)
        {
            toP += boatCount[0]; toD += boatCount[1];   // boat at toCoast
        }
        else
        {
            fromP += boatCount[0]; fromD += boatCount[1];       // boat at fromCoast
        }
        Debug.Log(fromP.ToString() + ' ' + fromD.ToString() + ' ' + get(boatst, fromP, fromD).ToString());
        for (int o = 0; o <= 1; o++)
        {
            for (int i = 0; i <= 3; i++)
            {
                for (int j = 0; j <= 3; j++)
                {
                    if (trans[get(boatst, fromP, fromD), get(o, i, j)] == 1)
                    {
                        return(get(boatst, i, j));
                    }
                }
            }
        }

        return(-1);
    }