mercredi 6 mai 2015

how to take the greatest integer and if are 2 or more take one randomly

my code

int zone1;
int zone2;
int zone3;


public void countVotes()
{
if ((zone1 == 0) && (zone2 == 0) && (zone3 == 0))
        {               
            return;
        }
        if ((zone1 == zone2) && (zone2 == zone3))
        {
            newzone = Rnd.get(1, 3);
            return;
        }
        if ((zone2 < zone1) && (zone1 > zone3))
        {
            newzone = 1;
        }
        if ((zone1 < zone2) && (zone2 > zone3))
        {
            newzone = 2;
        }
        if ((zone1 < zone3) && (zone3 > zone2))
        {
            newzone = 3;
        }
        changeZone(newzone);
}

and is not what I exactly want, how to simple take grater integer? i cannot imagine that if i will want add more zones ;/

Aucun commentaire:

Enregistrer un commentaire