/**
 * Copyright (C) 2022 by Martin Robillard. See https://codesample.info/about.html
 */
package e2.chapter9;

import java.util.List;
import java.util.function.Function;

/**
 * Demonstration code for the Strategy pattern applied
 * using functional-style design. See Section 9.5.
 */
public class AutoPlayer
{
	private Function<List<Card>, Card> aSelectionStrategy;

	public AutoPlayer(Function<List<Card>, Card> pSelectionStrategy) {
		aSelectionStrategy = pSelectionStrategy;
	}

	@SuppressWarnings("unused")
	public void play() {
		Card selected = aSelectionStrategy.apply(getCards());
		/* ... */
	}

	// Gets the cards to supply to the strategy
	private List<Card> getCards() { 
		return null; // this is a stub
	}
}