KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > innig > macker > example > modularity > player > impl > CyclicPlayer


1 package net.innig.macker.example.modularity.player.impl;
2
3 import net.innig.macker.example.modularity.player.*;
4 import net.innig.macker.example.modularity.game.*;
5 import java.util.*;
6
7 public class CyclicPlayer
8     implements Player
9     {
10     public Move nextMove(Set legalMoves, Move otherPreviousMove)
11         {
12         List legalMovesL = new ArrayList(legalMoves);
13         return (Move) legalMovesL.get(++state % legalMovesL.size());
14         }
15     
16     private int state = hashCode();
17     }
Popular Tags