package com.egloos.realmove.dp.strategy.framework; public enum Hand { SCISSOR(0), ROCK(1), PAPER(2); private int value; private Hand( int value ) { this.value = value; } public int getValue() { return this.value; } /** * * @param other * @return -1,0,1; 0 means draw, 1 means this is stronger than other. */ public int fightTo( Hand other ) { if ( this.getValue() == other.getValue() ) { return 0; } else if ( ( this.getValue() + 1 ) % 3 == other.getValue() ) { return -1; } else { return 1; } } }