Back to project page yahtzee4android.
The source code is released under:
GNU General Public License
If you think the Android project yahtzee4android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.tum.yahtzee.moves; //from w w w . java2s . c o m import java.util.List; import com.tum.yahtzee.units.Cube; public class LargeStraightMove implements IBaseMove { public static boolean validate(List<Cube> cubes) { int values = 0; for(Cube cube : cubes) { switch(cube.getNumber()) { case 0: if((values & 1) == 0) values += 1; break; case 1: if((values & 2) == 0) values += 2; break; case 2: if((values & 4) == 0) values += 4; break; case 3: if((values & 8) == 0) values += 8; break; case 4: if((values & 16) == 0) values += 16; break; case 5: if((values & 32) == 0) values += 32; break; default: return false; } } return values == 31 || values == 62; } public static int calculatePoints(List<Cube> cubes) { return 40; } public LargeStraightMove(List<Cube> cubes) { } public int getPoints() { return LargeStraightMove.calculatePoints(null); } public void print() { System.out.println("Large Straight, Points: "+getPoints()); } }