예제 #1
0
    public int GetNegativeLimit()
    {
        int posx = block.xpos;
        int posy = block.ypos;

        do
        {
            if (block.rotation)
            {
                posy--;
            }
            else
            {
                posx--;
            }
        } while (PuzzleSlide.Empty(win.puzzle.puzzle, posx, posy));

        if (block.rotation)
        {
            return(posy + 1);
        }
        if (block.target && posx == 4)
        {
            return(6);
        }
        return(posx + 1);
    }
예제 #2
0
    public int GetPositiveLimit()
    {
        int posx = block.xpos;
        int posy = block.ypos;

        if (block.rotation)
        {
            posy += block.ylen + 1;
        }
        else
        {
            posx += block.xlen + 1;
        }

        while (PuzzleSlide.Empty(win.puzzle.puzzle, posx, posy))
        {
            if (block.rotation)
            {
                posy++;
            }
            else
            {
                posx++;
            }
        }

        if (block.rotation)
        {
            return(posy - (1 + block.ylen));
        }
        return(posx - (1 + block.xlen));
    }
예제 #3
0
    public PuzzleSlideWindow(EventManager.Event e)
    {
        eventData = e;
        Game game = Game.Get();

        questPuzzle = e.qEvent as QuestData.Puzzle;

        if (game.quest.puzzle.ContainsKey(questPuzzle.sectionName))
        {
            puzzle    = game.quest.puzzle[questPuzzle.sectionName] as PuzzleSlide;
            lastMoves = puzzle.moves;
        }
        else
        {
            puzzle = new PuzzleSlide(questPuzzle.puzzleLevel);
        }

        CreateWindow();
    }
예제 #4
0
    public PuzzleSlideWindow(EventManager.Event e)
    {
        eventData = e;
        Game game = Game.Get();

        questPuzzle = e.qEvent as QuestData.Puzzle;

        if (game.quest.puzzle.ContainsKey(questPuzzle.sectionName))
        {
            puzzle    = game.quest.puzzle[questPuzzle.sectionName] as PuzzleSlide;
            lastMoves = puzzle.moves;
        }
        else
        {
            // FIXME: dynamic generation too slow
            //puzzle = new PuzzleSlide(questPuzzle.puzzleLevel);
            puzzle = new PuzzleSlide(PuzzleSlide.HardCodedPuzzle());
        }

        CreateWindow();
    }
예제 #5
0
        static void Main(string[] args)
        {
            int level = 2;

            if (args.Length > 0)
            {
                int.TryParse(args[0], out level);
            }
            int index = 1;

            while (true)
            {
                PuzzleSlide ps = new PuzzleSlide(level);

                string write = ps.ToString(index.ToString());
                index++;

                using (StreamWriter sw = File.AppendText("output.ini"))
                {
                    sw.WriteLine(write);
                }
            }
        }
예제 #6
0
    public bool CheckMove(List <PuzzleSlide.Block> state, PuzzleSlide.Block b, int dir)
    {
        Vector2 target = b.GetMove(dir);

        return(PuzzleSlide.Empty(state, Mathf.RoundToInt(target.x), Mathf.RoundToInt(target.y)));
    }
예제 #7
0
    public bool CheckMove(int[] state, int b, int dir)
    {
        Vector2 target = PuzzleSlide.Block.GetMove(b, dir, 1);

        return(PuzzleSlide.Empty(state, (int)Math.Round(target.x), (int)Math.Round(target.y)));
    }