static void main(String[] args) { BookShelf bookShelf = new BookShelf(4); bookShelf.appendBook(new Book("Around the World in 80 years")); bookShelf.appendBook(new Book("Bible")); bookShelf.appendBook(new Book("Cinderella")); bookShelf.appendBook(new Book("Daddy-Long-Legs")); Iterator it = bookShelf.iterator(); while (it.hasNext()) { Book book = (Book)it.next(); System.out.println(book.getName()); } } } 19
static void main(String[] args) { Player player1 = new Player("Taro", new RandomStrategy()); Player player2 = new Player(”Takashi", new LearningStrategy()); for (int i = 0; i < 10000; i ++) { Hand nextHand1 = player1.nextHand(); Hand nextHand2 = player2.nextHand(); // hand judge ... } } } 23
{ public static void main(String[] args) { Player player1 = new Player("Taro", new RandomStrategy()); Player player2 = new Player(”Takashi", new RandomStrategy()); for (int i = 0; i < 10000; i ++) { Hand nextHand1 = player1.nextHand(); Hand nextHand2 = player2.nextHand(); // hand judge ... } } } 24 考え方を交換