<commit_before>/*
 * the maze contains squares that are clear, walls, path to exit and visited 
 * but not in final path
 */
package poulproj05;

/**
 *
 * @author marsh
 */
public class Maze {
    public static final char CLEAR = ' ', WALL = 'x', CREATURE = 'o', VISTITED = 'v', PATH = 'p';
    private char[][] maze_;
    private Creature creature_;
    private int startX, startY, endX, endY;
    private final int height, width;
    
    public int getHeight()
    {
        return height;
    }
    public int getWidth()
    {
        return width;
    }
    
    public int getStartX()
    {
        return startX;
    }
    public int getStartY()
    {
        return startY;
    }
    public static Maze LoadFromFile(String file)
    {
        
    }
    public Maze(file)
    {
        this = Maze.LoadFromFile(file);
    }
    public boolean squareIsClear(int x , int y)
    {
        if(maze_[x][y] = CLEAR)
            return true;
        return false;
    }
    public boolean atExit(int x, int y)
    {
        if(endX == x && endY == y)
        {
            return true;
        }<commit_msg>mostly done with loading maze from file<commit_after>/*
 * the maze contains squares that are clear, walls, path to exit and visited 
 * but not in final path
 */
package poulproj05;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import javax.imageio.IIOException;

/**
 *
 * @author marsh
 */
public class Maze {
    public static final char CLEAR = ' ', WALL = 'x', CREATURE = 'o', VISTITED = 'v', PATH = 'p';
    private char[][] maze_;
    private Creature creature_;
    private int startX, startY, endX, endY;
    private final int height, width;
    
    public int getHeight()
    {
        return height;
    }
    public int getWidth()
    {
        return width;
    }
    
    public int getStartX()
    {
        return startX;
    }
    public int getStartY()
    {
        return startY;
    }
    /**
     *
     */
    public Maze(String file) throws FileNotFoundException, IOException
    {
        BufferedReader fileIn = new BufferedReader(new FileReader(file));
        String heightWidth = fileIn.readLine();
        String[] hw = heightWidth.split(" ");
        if(hw.length != 2)
        {
            throw new IIOException("file is not of the correct format");
        }
        height = Integer.parseInt(hw[0]);
        width = Integer.parseInt(hw[1]);
        
        maze_ = new char[height][width];
        
        //get exit from file
        String[] exit = fileIn.readLine().split(" ");
        if(exit.length != 2)
        {
            throw new IIOException("file is not of the correct format");
        }
        endX = Integer.parseInt(exit[0]);
        endY = Integer.parseInt(exit[1]);
        
        //get start from file
        String[] start = fileIn.readLine().split(" ");
        if(start.length != 2)
        {
            throw new IIOException("file is not of the correct format");
        }
        startX = Integer.parseInt(start[0]);
        startY = Integer.parseInt(start[1]);
        
        //now read in values
        for(int i= 0; i < height; i++)
        {
            String line = fileIn.readLine();
            for(int k=0; k< width; k++)
            {
                maze_[i][k] = line.charAt(k);
                //verify value here
                
                
            }
        }
        fileIn.close();
    }
    public boolean isClear(int x , int y)
    {
        if(maze_[x][y] == CLEAR)
            return true;
        return false;
    }
    public boolean atExit(int x, int y)
    {
        if(endX == x && endY == y)
        {
            return true;
        }
{'fraction_non_alphanumeric': 0.11185442868611185, 'fraction_numerical': 0.004013914905004014, 'mean_word_length': 1.7424798239178283, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2345622', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1113, 'n_words': 328}