Package games.war.behaviors

Source Code of games.war.behaviors.RandomCheating

package games.war.behaviors;

import game.Card;
import hand.Hand;

/**
* A behavior where the card will be randomly selected from the hand.
* @author Chris Hersh
*
*/
public class RandomCheating implements CheatingBehavior
{

    @Override
    public Card getNextCard(Hand currHand)
    {
        int index = (int) (Math.random() * currHand.getSize());
        Card nextCard = currHand.getCard(index);
        currHand.removeCard(index);
        return nextCard;
    }

}
TOP

Related Classes of games.war.behaviors.RandomCheating

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.