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 ww .ja v a 2 s . com*/ import java.util.List; import com.tum.yahtzee.units.Cube; public class SmallStraightMove 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 == 15 || values == 30 || values == 60 || values == 31 || values == 62; } public static int calculatePoints(List<Cube> cubes) { return 30; } public SmallStraightMove(List<Cube> cubes) { } public int getPoints() { return SmallStraightMove.calculatePoints(null); } public void print() { System.out.println("Small Straight, Points: "+getPoints()); } }