예제 #1
0
        public MoveAttempt getEasyMove()
        {
            List <MoveAttempt> ms = this.getAllDoableMoveJumpAttempts();
            Random             r  = new Random();
            MoveAttempt        m  = ms[r.Next(0, ms.Count)];

            return(m);

            //if (!forceJumps && (m = this.getRandomDoableMoveAttempt()) != null) {
            //    return m;
            //} else {
            //    return getRandomDoableMoveJump();
            //}
        }
예제 #2
0
        public MoveAttempt getRandomDoableMoveJump()
        {
            if (multiJumpLoc != null)
            {
                Vector doable = getDoableJumps(board.getCellContents(multiJumpLoc))[0];
                return(new MoveAttempt(multiJumpLoc.getY(), multiJumpLoc.getX(),
                                       multiJumpLoc.getY() + doable.getY(), multiJumpLoc.getX() + doable.getX()));
            }
            MoveAttempt jump = getRandomDoableJumpAttempt();

            if (jump != null)
            {
                return(jump);
            }
            MoveAttempt move = getRandomDoableMoveAttempt();

            if (move != null)
            {
                return(move);
            }
            throw new NoMovesLeftException();
        }
예제 #3
0
        public static List <List <MoveAttempt> > getFullTurns(List <MoveAttempt> possibility, GameLogic g)
        {
            List <List <MoveAttempt> > fullturns = new List <List <MoveAttempt> >();

            g.makeMove(possibility[possibility.Count - 1]);
            if (g.multiJumpLoc == null)
            {
                fullturns.Add(possibility);
            }
            else
            {
                foreach (Vector v in g.getDoableJumps(g.board.getCellContents(g.multiJumpLoc)))
                {
                    MoveAttempt        move = new MoveAttempt(v, g.board.getCellContents(g.multiJumpLoc));
                    List <MoveAttempt> p    = new List <MoveAttempt>();
                    p.AddRange(possibility);
                    p.Add(move);
                    GameLogic newG = new GameLogic(g);
                    g.makeMove(move);
                    fullturns.AddRange(getFullTurns(p, newG));
                }
            }
            return(fullturns);
        }
예제 #4
0
 public Move makeMove(MoveAttempt a)
 {
     return makeMove(a.getYStart(), a.getXStart(), a.getYEnd(), a.getXEnd());
 }
예제 #5
0
 public static List<List<MoveAttempt>> getFullTurns(List<MoveAttempt> possibility, GameLogic g)
 {
     List<List<MoveAttempt>> fullturns = new List<List<MoveAttempt>>();
     g.makeMove(possibility[possibility.Count-1]);
     if(g.multiJumpLoc == null) {
         fullturns.Add(possibility);
     } else {
         foreach(Vector v in g.getDoableJumps(g.board.getCellContents(g.multiJumpLoc))) {
             MoveAttempt move = new MoveAttempt(v, g.board.getCellContents(g.multiJumpLoc));
             List<MoveAttempt> p = new List<MoveAttempt>();
             p.AddRange(possibility);
             p.Add(move);
             GameLogic newG = new GameLogic(g);
             g.makeMove(move);
             fullturns.AddRange(getFullTurns(p, newG));
         }
     }
     return fullturns;
 }
예제 #6
0
 public Move makeMove(MoveAttempt a)
 {
     return(makeMove(a.getYStart(), a.getXStart(), a.getYEnd(), a.getXEnd()));
 }