Project 4 Puzzle/Deque.java Project 4 Puzzle/Deque.java @SuppressWarnings("unchecked") public class Deque { private Item[] deque; private int front;//points to the front item in the deque...

1 answer below »
Built in Java classes may not be used to implement this. Loc and Deque can be changed but Grid can not be modified.


Project 4 Puzzle/Deque.java Project 4 Puzzle/Deque.java @SuppressWarnings("unchecked") public class Deque {     private Item[] deque;     private int front;//points to the front item in the deque     private int back;//points to the first open position at the back of the deque     private int size;     private int init_cap;     /***      *constructor: create an empty Deque with initial      *capacity of 10      */     public Deque() {     this.deque = (Item[]) new Object[10];     this.size = 0;     this.front = 0;     this.back = 0;     this.init_cap = 10;     }     /***      *constructor: create an empty Deque with initial      *capacity of n      */     public Deque(int n) {     this.deque = (Item[]) new Object[n];     this.size = 0;     this.front = 0;     this.back = 0;     this.init_cap = n;     }          /***      *add an item to the front of the Deque      *double the array capacity if Deque is full      */     public void addToFront(Item item) {     if(this.isEmpty()) {         deque[front] = item;         changeIndex(true, false);         size++;         return;     } else if(this.size == deque.length)         this.resize(2*deque.length);     changeIndex(false, true);     deque[front] = item;     size++;     }     /***      *add an item to the back of the Deque;      *double the array capacity if the Deque is full      ***/     public void addToBack(Item item) {     if(this.size() == deque.length)         this.resize(2*deque.length);     deque[back] = item;     size++;     changeIndex(true, false);     }     /***      *remove and return the front item from the Deque;      *throw EmptyDequeException if the Deque is empty;      *reduce the array capacity by half if the size       *of the Deque size falls below floor(N/4) where      *N is the array capacity, but do not resize it       *to be below the default capacity, which is 10      ***/     public Item getFirst() throws EmptyDequeException {     if(size == 0)         throw new EmptyDequeException();     Item ret = deque[front];     size--;     deque[front] = null;     changeIndex(true, true);     int fourth = deque.length/4;     if(size < fourth && deque.length 2 ="">= init_cap)         resize(deque.length/2);     return ret;     }      /***      *remove and return the back item from the Deque;      *throw EmptyDequeException if the Deque is empty;      *reduce the array capacity by half if the size       *of the Deque size falls below floor(N/4) where      *N is the array capacity, but do not resize it       *to be below the default capacity, which is 10      ***/     public Item getLast() throws EmptyDequeException {     if(size == 0)         throw new EmptyDequeException();     changeIndex(false, false);     Item ret = deque[back];     size--;     deque[back] = null;     int fourth = deque.length/4;     if(size < fourth && deque.length 2 ="">= init_cap)         resize(deque.length/2);     return ret;     }          /***      *return true if the Deque is empty;      *return false if the Deque is not empty      ***/     public boolean isEmpty() {     return size == 0;     }     /***      *return the size of the Deque (i.e. the       *number of elements currently in the Deque)      ***/     public int size() {     return this.size;     }     /***      *return but do not remove the front item in the Deque;      *throw an EmptyDequeException if the Deque is empty      */     public Item peekFirst() throws EmptyDequeException {     if(size == 0)         throw new EmptyDequeException();     return deque[front];     }     /***      *return but do not remove the back item in the Deque;      *throw an EmptyDequeException if the Deque is empty      */     public Item peekLast() throws EmptyDequeException {     if(size == 0)         throw new EmptyDequeException();     int b = (back - 1) % deque.length;     if(b < 0)         b +=" deque.length;"     return deque[b];=""     }=""     =""     /***=""      *return the underlying array=""      ***/=""     public item[] getarray() {=""     return deque;=""     }=""     public void printdeque() {=""     for(int i =" front; i != back; i = (i+1)%deque.length)"         system.out.println(deque[i]);=""     }=""     =""     /***=""      *resize the array to be of size max=""      ***/=""     private void resize(int max) {=""     item[] newarray =" (Item[]) new Object[max];"     for(int i ="">< size; i++) {         newarray[i] =" deque[front];"         changeindex(true, true);=""     }=""     deque =" newArray;"     this.front =" 0;"     this.back =" size;"     }=""     /***=""      *increment or decrement front or back index=""      ***/=""     private void changeindex(boolean inc, boolean isfront) {=""     if(inc && isfront)  {=""         front =" (front + 1) % deque.length;"     }=""     else if(!inc && isfront) {=""         front =" (front - 1) % deque.length;">< 0)         front +=" deque.length;"     } else if(inc && !isfront) =""         back =" (back + 1) % deque.length;"     else {=""         back =" (back - 1) % deque.length;">< 0)         back +=" deque.length;"     }=""     }="" }="" project="" 4="" puzzle/emptydequeexception.java="" project="" 4="" puzzle/emptydequeexception.java="" public class emptydequeexception extends exception {=""     public emptydequeexception() {=""     super();=""     }="" }="" project="" 4="" puzzle/grid.java="" project="" 4="" puzzle/grid.java="" import java.io.bufferedreader;="" import java.io.filereader;="" import java.io.ioexception;="" import java.util.random;="" import java.util.arrays;="" public class grid {=""     private loc[][] grid;=""     private int accesscount;=""     //constructor: creates a new grid based on =""     //an input file=""     //filename: the name of the file=""     //isstrings: true if the the grid contains strings;=""     //false if it contains integers=""     public grid(string filename, boolean isstrings) {=""     this.accesscount =" 0;"     bufferedreader reader;=""     try {=""         reader =" new BufferedReader(new FileReader(filename));"         string line =" reader.readLine();"         if(line !=" null) {"         int n =" Integer.parseInt(line);"         int i =" 0;"         grid =" new Loc[n][n];"         line =" reader.readLine();"         int r =" 0;"         while(line !=" null) {"             string[] str =" line.split(" ");">< n)             break;=""             for(int c ="">< n; c++) {             grid[r][c] =" new Loc(r, c, str[c]);"             i++;=""             }=""             r++;=""             line =" reader.readLine();"         }=""         } =""     }catch (exception e) {=""         e.printstacktrace();=""     }=""     }=""     //creates a string representation of the grid=""     public string tostring() {=""     string str =" "";"     for(int r ="">< grid.length; r++) {         for(int c ="">< grid[0].length; c++) {         str +=" grid[r][c].getVal() + " ";"         }=""         str +=" "\n";"     }=""     return str;=""     }=""     //returns the size of the grid (i.e. n for =""     //an n x n grid--all grids are square!    =""     public int size() {=""     return grid.length;=""     }=""     //returns the location at (i, j) or null if (i, j)=""     //is outside the grid=""     public loc getloc(int i, int j) {=""     if(checkindex(i) && checkindex(j)) {=""         accesscount++;=""         return grid[i][j];=""     }=""     return null;=""     }=""     //returns the string value at (i, j) or=""     //null if it is outside the grid=""     public string getval(int i, int j) {=""     loc loc =" getLoc(i, j);"     if(loc !=" null)"         return loc.getval();=""     return null;=""     }=""     //returns the integer value at (i, j)=""     //or -999 if the location is outside the grid=""     //note: this only works for integer grids!=""     public int getintval(int i, int j) {=""     string str =" getVal(i, j);"     if(str !=" null)"         return integer.parseint(str);=""     return -999;=""     }=""     //returns the access count=""     public int getaccesscount() {=""     return this.accesscount;=""     }=""     //reset access count=""     public void resetaccesscount() {=""     this.accesscount =" 0;"     }=""     //checks the index to see if it is in the grid=""     private boolean checkindex(int i) {=""     return i ="">= 0 && i < grid.length;     } }           project 4 puzzle/loc.java project 4 puzzle/loc.java public class loc {     public final int row;     public final int col;     private string val;     //constructor     //x is row, y is column     public loc(int x, int y, string val) {     this.row = x;     this.col = y;     this.val = val;     }     //returns loc in the form (row, col)     public string tostring() {     return "(" + row + ", " + col + ")";     }     //returns the string value at this location     public string getval() {     return val;     }     //returns the integer value at this location     //note: this should only be used if the location     //contains an integer!     public int getintval() {     return integer.parseint(val);     } } project 4 puzzle/project 4 .pdf project 4 grids. part 1. word search in this part, the grid you are given will contain individual letters represented as strings, and you must implement a word search. a word can occur as any path from the first letter to the last where a step in the path can go up, right, down, or left. (no diagonals). also, it is possible for the same letter to be used more than once in the same word. (see arizona example below.) the output for this search should be a string representation of the locations in the path as shown below. examples: arizona: (0, 0)(1, 0)(2, 0)(2, 1)(1, 1)(0, 1)(0, 0) university: (6, 3)(5, 3)(5, 4)(5, 5)(6, 5)(7, 5)(7, 4)(7, 3)(8, 3)(8, 4) wildcats: (9, 0)(8, 0)(8, 1)(7, 1)(7, 2)(8, 2)(9, 2)(9, 1) additionally, the search function will take two integer parameters that indicate the row and column that your search will start from. your implementation should follow these guidelines. ● use a bfs algorithm to find the first character in the word. this search will not be included in the final path that is printed out, but it is included in the overall grid access counts, so it is important to use bfs in order to find the closest option first and go on from there. ● once you find a possible starting place for the word, use a dfs algorithm to search for the word itself. ● always search a locations neighbors in the following order: up, right, down, left. if you don’t, you may get an alternate route that does not match the test cases. example: let’s say we are searching the above grid for arizona starting at (2, 3). first we search for the closest “a” using a bfs algorithm, which is at (2, 2). we then use dfs to search for the word. when we don’t find it, we continue the bfs for the next closest “a”. eventually, we find the correct “a” and find the path as noted above. testing. ● test cases and test code is provided for you. keep in mind that these may not necessarily catch all possible errors, so it’s up to you to make sure you are handling any corner cases. ● for each word that is searched, you get 1 point for getting the correct path and 1 point for using an appropriate number of grid accesses. these are calculated for you. ● to avoid any differences in string output, use the tostring method provided in loc.java to print out the locations. do not add anything in between them. provided code. besides the test code, you are provided with the grid.java class. you should not change this code as it will not be included in your submission. however, you may change the loc.java class, and you should include your version of loc.java in your submission even if you don’t change it. you are also provided with the deque.java and the emptydequeexception.java class, which you are allowed to change as well. or, if you prefer, you can use your own implementation from project 1. you are not allowed to use other imported structures, but a deque should be enough for your bfs and dfs implementations as it can function as both a stack and a queue. api. implement your solution in a class called puzzle.java. the required methods are listed below. method signature description public puzzle(grid grid) constructor public string find(string word, int r, int c) find and return (as a string) the path containing word; start the search at (r, c) other notes about grading: ● if you do not follow the directions (e.g. importing classes without permission, not using an array for the deque, etc.), you may not receive credit for that part of the assignment. ● good coding style includes: using good indentation, using meaningful variable names, using informative comments, breaking out reusable functions instead of repeating them, etc. ● if you implement something correctly but in an inefficient way, you may not receive full credit. ● in cases where efficiency is determined by counting something like array accesses, it is considered academic dishonesty to intentionally try to avoid getting more access counts without actually improving the efficiency of the solution, so if you are in doubt, it is always best to ask. if you are asking, then we tend to assume that you are trying to do the project correctly. ● if you have questions about your graded project, you may contact the tas and set up a meeting to discuss your grade with them in person. regrades on programs that do not work will only be allowed under limited circumstances, usually with a standard 20-point deduction. all regrade requests should be submitted according to the guidelines in the syllabus and within the allotted time frame. project 4 puzzle/puzzle1_test.txt 15 q l s u t r l w v f s b a i a z a l w r a d i j k g r n r l a w b a n n j h k t h o e e g i g i n e l a l a j u w t c e s s a i j l y o l f k n i i r h h r t r c n g e s w d h r j c g a r f n a o c s e a w w i u v n w s e d l n i n w a n g f g g a o p w s i u a e t i d r a e l p r u p t l h a s y c r r f i k k c a a h g n i h f o e e g j i i e e f f r y g f d n a e u g y h u q a z a g r o d n d e v g h k y s j u t f r o u c s e r q a w u p l e d project 4 puzzle/puzzle2_test.txt 25 v g l g i r l w v f s c k r a l e b u t t p d k p z i e w u a c i j k g r s u p a a e l i p a n c r a u b a n a n a k t h o l u o r y l a e l i v e u i m t p e h o i n j u i t c d e z i l a y a p a p s s g e e i y t g t l n i w r s s g e e r u n w g t h r p r t p a k a a d h e j t h r t r q a e w j b a r e f e a b a h e l h w r r t r t u d l e h l b r b e r m e l s a r c o u a a r f i a n e e i y a d o a o p w t a m o a r u s n w n l o q u a t c s o r w p r a n w a l l e y p e c o p w s r f e h s b o i k u a a l c p b e h b e w p r u n g a r e s l w g q p i n e o v r n g e n i k u a a v n w e b a n m u l b e r r y a s t n i w b e r a y d k t i c u d e v g a k e s j u t r f g a r f t u h c d e k u c d e n q a w u p l a y o m i r i h c b h e t b e h o g v j e y n i w w w o d i     }="" }=""     =""     ="" project="" 4="" puzzle/loc.java="" project="" 4="" puzzle/loc.java="" public class loc {=""     public final int row;=""     public final int col;=""     private string val;=""     //constructor=""     //x is row, y is column=""     public loc(int x, int y, string val) {=""     this.row =" x;"     this.col =" y;"     this.val =" val;"     }=""     //returns loc in the form (row, col)=""     public string tostring() {=""     return "(" + row + ", " + col + ")";=""     }=""     //returns the string value at this location=""     public string getval() {=""     return val;=""     }=""     //returns the integer value at this location=""     //note: this should only be used if the location=""     //contains an integer!=""     public int getintval() {=""     return integer.parseint(val);=""     }="" }="" project="" 4="" puzzle/project="" 4="" .pdf="" project="" 4="" grids.="" part="" 1.="" word="" search="" in="" this="" part,="" the="" grid="" you="" are="" given="" will="" contain="" individual="" letters="" represented="" as="" strings,="" and="" you="" must="" implement="" a="" word="" search.="" a="" word="" can="" occur="" as="" any="" path="" from="" the="" first="" letter="" to="" the="" last="" where="" a="" step="" in="" the="" path="" can="" go="" up,="" right,="" down,="" or="" left.="" (no="" diagonals).="" also,="" it="" is="" possible="" for="" the="" same="" letter="" to="" be="" used="" more="" than="" once="" in="" the="" same="" word.="" (see="" arizona="" example="" below.)="" the="" output="" for="" this="" search="" should="" be="" a="" string="" representation="" of="" the="" locations="" in="" the="" path="" as="" shown="" below.="" examples:="" arizona:="" (0,="" 0)(1,="" 0)(2,="" 0)(2,="" 1)(1,="" 1)(0,="" 1)(0,="" 0)="" university:="" (6,="" 3)(5,="" 3)(5,="" 4)(5,="" 5)(6,="" 5)(7,="" 5)(7,="" 4)(7,="" 3)(8,="" 3)(8,="" 4)="" wildcats:="" (9,="" 0)(8,="" 0)(8,="" 1)(7,="" 1)(7,="" 2)(8,="" 2)(9,="" 2)(9,="" 1)="" additionally,="" the="" search="" function="" will="" take="" two="" integer="" parameters="" that="" indicate="" the="" row="" and="" column="" that="" your="" search="" will="" start="" from.="" your="" implementation="" should="" follow="" these="" guidelines.="" ●="" use="" a="" bfs="" algorithm="" to="" find="" the="" first="" character="" in="" the="" word.="" this="" search="" will="" not="" be="" included="" in="" the="" final="" path="" that="" is="" printed="" out,="" but="" it="" is="" included="" in="" the="" overall="" grid="" access="" counts,="" so="" it="" is="" important="" to="" use="" bfs="" in="" order="" to="" find="" the="" closest="" option="" first="" and="" go="" on="" from="" there.="" ●="" once="" you="" find="" a="" possible="" starting="" place="" for="" the="" word,="" use="" a="" dfs="" algorithm="" to="" search="" for="" the="" word="" itself.="" ●="" always="" search="" a="" locations="" neighbors="" in="" the="" following="" order:="" up,="" right,="" down,="" left.="" if="" you="" don’t,="" you="" may="" get="" an="" alternate="" route="" that="" does="" not="" match="" the="" test="" cases.="" example:="" let’s="" say="" we="" are="" searching="" the="" above="" grid="" for="" arizona="" starting="" at="" (2,="" 3).="" first="" we="" search="" for="" the="" closest="" “a”="" using="" a="" bfs="" algorithm,="" which="" is="" at="" (2,="" 2).="" we="" then="" use="" dfs="" to="" search="" for="" the="" word.="" when="" we="" don’t="" find="" it,="" we="" continue="" the="" bfs="" for="" the="" next="" closest="" “a”.="" eventually,="" we="" find="" the="" correct="" “a”="" and="" find="" the="" path="" as="" noted="" above.="" testing.="" ●="" test="" cases="" and="" test="" code="" is="" provided="" for="" you.="" keep="" in="" mind="" that="" these="" may="" not="" necessarily="" catch="" all="" possible="" errors,="" so="" it’s="" up="" to="" you="" to="" make="" sure="" you="" are="" handling="" any="" corner="" cases.="" ●="" for="" each="" word="" that="" is="" searched,="" you="" get="" 1="" point="" for="" getting="" the="" correct="" path="" and="" 1="" point="" for="" using="" an="" appropriate="" number="" of="" grid="" accesses.="" these="" are="" calculated="" for="" you.="" ●="" to="" avoid="" any="" differences="" in="" string="" output,="" use="" the="" tostring="" method="" provided="" in="" loc.java="" to="" print="" out="" the="" locations.="" do="" not="" add="" anything="" in="" between="" them.="" provided="" code.="" besides="" the="" test="" code,="" you="" are="" provided="" with="" the="" grid.java="" class.="" you="" should="" not="" change="" this="" code="" as="" it="" will="" not="" be="" included="" in="" your="" submission.="" however,="" you="" may="" change="" the="" loc.java="" class,="" and="" you="" should="" include="" your="" version="" of="" loc.java="" in="" your="" submission="" even="" if="" you="" don’t="" change="" it.="" you="" are="" also="" provided="" with="" the="" deque.java="" and="" the="" emptydequeexception.java="" class,="" which="" you="" are="" allowed="" to="" change="" as="" well.="" or,="" if="" you="" prefer,="" you="" can="" use="" your="" own="" implementation="" from="" project="" 1.="" you="" are="" not="" allowed="" to="" use="" other="" imported="" structures,="" but="" a="" deque="" should="" be="" enough="" for="" your="" bfs="" and="" dfs="" implementations="" as="" it="" can="" function="" as="" both="" a="" stack="" and="" a="" queue.="" api.="" implement="" your="" solution="" in="" a="" class="" called="" puzzle.java.="" the="" required="" methods="" are="" listed="" below.="" method="" signature="" description="" public="" puzzle(grid="" grid)="" constructor="" public="" string="" find(string="" word,="" int="" r,="" int="" c)="" find="" and="" return="" (as="" a="" string)="" the="" path="" containing="" word;="" start="" the="" search="" at="" (r,="" c)="" other="" notes="" about="" grading:="" ●="" if="" you="" do="" not="" follow="" the="" directions="" (e.g.="" importing="" classes="" without="" permission,="" not="" using="" an="" array="" for="" the="" deque,="" etc.),="" you="" may="" not="" receive="" credit="" for="" that="" part="" of="" the="" assignment.="" ●="" good="" coding="" style="" includes:="" using="" good="" indentation,="" using="" meaningful="" variable="" names,="" using="" informative="" comments,="" breaking="" out="" reusable="" functions="" instead="" of="" repeating="" them,="" etc.="" ●="" if="" you="" implement="" something="" correctly="" but="" in="" an="" inefficient="" way,="" you="" may="" not="" receive="" full="" credit.="" ●="" in="" cases="" where="" efficiency="" is="" determined="" by="" counting="" something="" like="" array="" accesses,="" it="" is="" considered="" academic="" dishonesty="" to="" intentionally="" try="" to="" avoid="" getting="" more="" access="" counts="" without="" actually="" improving="" the="" efficiency="" of="" the="" solution,="" so="" if="" you="" are="" in="" doubt,="" it="" is="" always="" best="" to="" ask.="" if="" you="" are="" asking,="" then="" we="" tend="" to="" assume="" that="" you="" are="" trying="" to="" do="" the="" project="" correctly.="" ●="" if="" you="" have="" questions="" about="" your="" graded="" project,="" you="" may="" contact="" the="" tas="" and="" set="" up="" a="" meeting="" to="" discuss="" your="" grade="" with="" them="" in="" person.="" regrades="" on="" programs="" that="" do="" not="" work="" will="" only="" be="" allowed="" under="" limited="" circumstances,="" usually="" with="" a="" standard="" 20-point="" deduction.="" all="" regrade="" requests="" should="" be="" submitted="" according="" to="" the="" guidelines="" in="" the="" syllabus="" and="" within="" the="" allotted="" time="" frame.="" project="" 4="" puzzle/puzzle1_test.txt="" 15="" q="" l="" s="" u="" t="" r="" l="" w="" v="" f="" s="" b="" a="" i="" a="" z="" a="" l="" w="" r="" a="" d="" i="" j="" k="" g="" r="" n="" r="" l="" a="" w="" b="" a="" n="" n="" j="" h="" k="" t="" h="" o="" e="" e="" g="" i="" g="" i="" n="" e="" l="" a="" l="" a="" j="" u="" w="" t="" c="" e="" s="" s="" a="" i="" j="" l="" y="" o="" l="" f="" k="" n="" i="" i="" r="" h="" h="" r="" t="" r="" c="" n="" g="" e="" s="" w="" d="" h="" r="" j="" c="" g="" a="" r="" f="" n="" a="" o="" c="" s="" e="" a="" w="" w="" i="" u="" v="" n="" w="" s="" e="" d="" l="" n="" i="" n="" w="" a="" n="" g="" f="" g="" g="" a="" o="" p="" w="" s="" i="" u="" a="" e="" t="" i="" d="" r="" a="" e="" l="" p="" r="" u="" p="" t="" l="" h="" a="" s="" y="" c="" r="" r="" f="" i="" k="" k="" c="" a="" a="" h="" g="" n="" i="" h="" f="" o="" e="" e="" g="" j="" i="" i="" e="" e="" f="" f="" r="" y="" g="" f="" d="" n="" a="" e="" u="" g="" y="" h="" u="" q="" a="" z="" a="" g="" r="" o="" d="" n="" d="" e="" v="" g="" h="" k="" y="" s="" j="" u="" t="" f="" r="" o="" u="" c="" s="" e="" r="" q="" a="" w="" u="" p="" l="" e="" d="" project="" 4="" puzzle/puzzle2_test.txt="" 25="" v="" g="" l="" g="" i="" r="" l="" w="" v="" f="" s="" c="" k="" r="" a="" l="" e="" b="" u="" t="" t="" p="" d="" k="" p="" z="" i="" e="" w="" u="" a="" c="" i="" j="" k="" g="" r="" s="" u="" p="" a="" a="" e="" l="" i="" p="" a="" n="" c="" r="" a="" u="" b="" a="" n="" a="" n="" a="" k="" t="" h="" o="" l="" u="" o="" r="" y="" l="" a="" e="" l="" i="" v="" e="" u="" i="" m="" t="" p="" e="" h="" o="" i="" n="" j="" u="" i="" t="" c="" d="" e="" z="" i="" l="" a="" y="" a="" p="" a="" p="" s="" s="" g="" e="" e="" i="" y="" t="" g="" t="" l="" n="" i="" w="" r="" s="" s="" g="" e="" e="" r="" u="" n="" w="" g="" t="" h="" r="" p="" r="" t="" p="" a="" k="" a="" a="" d="" h="" e="" j="" t="" h="" r="" t="" r="" q="" a="" e="" w="" j="" b="" a="" r="" e="" f="" e="" a="" b="" a="" h="" e="" l="" h="" w="" r="" r="" t="" r="" t="" u="" d="" l="" e="" h="" l="" b="" r="" b="" e="" r="" m="" e="" l="" s="" a="" r="" c="" o="" u="" a="" a="" r="" f="" i="" a="" n="" e="" e="" i="" y="" a="" d="" o="" a="" o="" p="" w="" t="" a="" m="" o="" a="" r="" u="" s="" n="" w="" n="" l="" o="" q="" u="" a="" t="" c="" s="" o="" r="" w="" p="" r="" a="" n="" w="" a="" l="" l="" e="" y="" p="" e="" c="" o="" p="" w="" s="" r="" f="" e="" h="" s="" b="" o="" i="" k="" u="" a="" a="" l="" c="" p="" b="" e="" h="" b="" e="" w="" p="" r="" u="" n="" g="" a="" r="" e="" s="" l="" w="" g="" q="" p="" i="" n="" e="" o="" v="" r="" n="" g="" e="" n="" i="" k="" u="" a="" a="" v="" n="" w="" e="" b="" a="" n="" m="" u="" l="" b="" e="" r="" r="" y="" a="" s="" t="" n="" i="" w="" b="" e="" r="" a="" y="" d="" k="" t="" i="" c="" u="" d="" e="" v="" g="" a="" k="" e="" s="" j="" u="" t="" r="" f="" g="" a="" r="" f="" t="" u="" h="" c="" d="" e="" k="" u="" c="" d="" e="" n="" q="" a="" w="" u="" p="" l="" a="" y="" o="" m="" i="" r="" i="" h="" c="" b="" h="" e="" t="" b="" e="" h="" o="" g="" v="" j="" e="" y="" n="" i="" w="" w="" w="" o="" d="">
Answered 1 days AfterApr 20, 2021

Answer To: Project 4 Puzzle/Deque.java Project 4 Puzzle/Deque.java @SuppressWarnings("unchecked")...

Vaishnavi R answered on Apr 21 2021
157 Votes
currproj/greyass1/.classpath

    
        
            
        
    
    
    
currproj/greyass1/.project

     greyass1
    
    
    
    
        
             org.eclipse.jdt.core.javabuilder
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
currproj/greyass1/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=15
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enable
d
org.eclipse.jdt.core.compiler.source=15
currproj/greyass1/bin/Deque.class
currproj/greyass1/bin/EmptyDequeException.class
currproj/greyass1/bin/Grid.class
currproj/greyass1/bin/Loc.class
currproj/greyass1/bin/Puzzle.class
currproj/greyass1/bin/puzzle1_test.txt
15
Q L S U T R L W V F S B A I A
Z A L W R A D I J K G R N R L
A W B A N N J H K T H O E E G
I G I N E L A L A J U W T C E
S S A I J L Y O L F K N I I R
H H R T R C N G E S W D H R J
C G A R F N A O C S E A W W I
U V N W S E D L N I N W A N G
F G G A O P W S I U A E T I D
R A E L P R U P T L H A S Y C
R R F I K K C A A H G N I H F
O E E G J I I E E F F R Y G F
D N A E U G Y H U Q A Z A G R
O D N D E V G H K Y S J U T F
R O U C S E R Q A W U P L E D
currproj/greyass1/bin/puzzle2_test.txt
25
V G L G I R L W V F S C K R A L E B U T T P D K P
Z I E W U A C I J K G R S U P A A E L I P A N C R
A U B A N A N A K T H O L U O R Y L A E L I V E U
I M T P E H O I N J U I T C D E Z I L A Y A P A P
S S G E E I Y T G T L N I W R S S G E E R U N W G
T H R P R T P A K A A D H E J T H R T R Q A E W J
B A R E F E A B A H E L H W R R T R T U D L E H L
B R B E R M E L S A R C O U A A R F I A N E E I Y
A D O A O P W T A M O A R U S N W N L O Q U A T C
S O R W P R A N W A L L E Y P E C O P W S R F E H
S B O I K U A A L C P B E H B E W P R U N G A R E
S L W G Q P I N E O V R N G E N I K U A A V N W E
B A N M U L B E R R Y A S T N I W B E R A Y D K T
I C U D E V G A K E S J U T R F G A R F T U H C D
E K U C D E N Q A W U P L A Y O M I R I H C B H E
T B E H O G V J E Y N I W W W O D I J K G Z H U T
B E E I E T G N L R D H R A E W J H K T H A W O A
R R R T P D I A W R K S W L E H O I V H U I G T N
V R A W O R L E Y E B A O P E O Y T G R C H R G A
S Y U C E P A L H S R W P R G T P D A A W A H R R
N W O G K V D G G E S I K N W O L E E A S B R A G
A L N G Q B A N G D R I A N L C P A E V H A N I E
N A F P R U E W L A R M N W E F V I N I I W I K M
T G Q K U A A R I B U A A L G Q I L O L I T H R O
H K E J P I N E R E I Y T G F L W O B R V E W J P
currproj/greyass1/bin/puzzle3_test.txt
50
O K L A H O M A C A M Y K I O V G P U T T P D K P H R W P C A M D I A T U U E I E L E R J U L R T N
Z I S W N A E N O K E R E L O Q U A T O R A N C R U K I K H I B O Y N O P A B N E O R U B Y I Y I N
A G R U O O R R N G H O L U O A E P A E L I V T U L T H R M N A L R D W G Y K G A U P B N H A T R W
I G T P E R O I G O L I T T L E R H C K Y O A O P U E W J B O D W R K W J P C I Q P V A N G R Y E L
S S G E R I Y T G S L N I O R S S A D E R N N W G L D K S O D N G O O H L E A V J E B Y S T F R A G
T H R Y R T E D K E A D H A P T H A T R G A E W J O N I Q B I A D O R I O A L G B L R J U L I R O M
J G A R F R A N C N E N E W R E T R Y E D L E H L N L E R U E W W L R T C Z B P A W U B L I O E W N
U A V R M F E L A I R L A U A A K F R A N E E I O O A R F A A D H A J E H A M A N G N L W W P B U G
N G B E O P W T N O P A R N Z N W A R O Q U I T P H N W I S E N E W R R E B B A R D D U R I K W A A
E D L B P R I N T M L L E Y A E N O E W U R F A H A E N O N R L A U A W E E U E W W K E W K S A R A
A L O L K U C A R S O N C I T Y W P B U I G N R E B E W P U P A R N Z K T R A A R I O R K N A I S E
U I L E Q P I E L E V R N G E E I K W A N A N W E E O I K P L L E Y A U G U S T A R E R J U L R T N
B H N M U L N E O D Y Y S T R I W S A R I Y D N T R A W S C P B E H B E E Y A T L G R U B L I Y I O
I C E D E I G A U E R J U L R L G A R D E P A A B R F G A O V R N G E S Y W R Y E A P B E H A T R O
E K E C P E I Q P R U B L I Y E M A N O H L B B U B I M A R Y Y S T R O R A F R A N N R N G R Y E T
A B E E O G V J E Y N L W W W P D I S K N O M B C W C D I E R J U L R T R A I R O Q Y T S T F R A R
Y A E I S T G B A T O N R O U G E H K E N C W O I C A N H H R U B L I Y I M A O E W U R J A L I R O
O R R T P S P A W R K E W K E N O E R G U H G T R I C A B P B E H G T R G A P B U I U B L I O E W H
M T A W O S A E Y E B B O P U O Y T E R C S A I I R Y L O V R N N R Y E D L K W A N N L W W P B U R
I Y U C A P B H H B R E P R G N T D E A W A H R B A T I I Y Y I T F R A N E S A R C D U R I K W O N
R W O R K M A N A O O R K N W E R A L Y S B O O A N S N S R S U L I R O Q U I T C Z K E W K S O R F
I L I G Q B A R D L R R A N L C P U A F H R W P C I O C E N B L I O E W U R F E H A O R K N A M O A
H W F P R U D W W L L Y N W E F V R A R I K I K A N A O A C O L U M B U S G A R E B R I K W A O M O
C G Q K U A R R I K U A A L G Q Y A C I U T H R L S D L E M U R I K W A N V N W E E W K S A R C Y D
P O M E G R O N A T E Y T G F U P E A R A E W J B P A N R K E W K S A R C Y D K T R E R J U L R T E
I G Q S D R F O R E A R K I R B S R N R A M E N T O N G O O R K N A I S Y W C D I E R U B E I Y I C
I K R U N W T L R Y I R I T A L A R A E P N O Q B A R D O R R A N C W O R A N H H R P B E F A T R N
Q O K A A R R K U A A P R I O R A T O D E R E R U E W W L R Y N O T S E L R A H C P V X N A R Y E E
W O I S L Y A B O O A K I A A C I S K L A I S U A A R I K U A A L S S G E I E L O V Y Y I T F R A D
L C P U E H H R W P E E G E A H H K T E C W O G R A N A T E Y T G A H R B N E O R Y R J U N I R O I
E F V R A J I K I K U B A R R O E V G I H G T A R D O R E V N E D B O O K G A U E R U B L A E E W V
G Q Y C R T E T H R G U E W W R T E R F S S G P D E A W A H R B N R W P C I Q P R U N L W S P O U O
N C P U H R H F W P E E G R A H E K T G A H R Q E E Y S B O O K G K I K R D O R R A D U R I K T H R
I F V R A E I K F K U B A R D O E M O N T P E L I E R Y D K K M A T H R D E A W A H K E W K S R R P
T Q Y A R V Y T H E G U E W W Y T E R I A R T A R A E P N O Q B A E W J E E Y S B O O R K N A U S R
S E Y S B O O E K U R A R E E M A T O R D H R A T O H E R E R U E D K K A R I C H M O N D T H F W R
U E H H R D P E N G R S W E A D I S K P A R C I S K G A I S U A N A T E E A J U L R T E R J U K R T
A A G I K I K U B N R D O T A H H K T S R A E H K S A L T L A K E C I T Y L B L I Y I R U B L N Y I
A R T U T H R G U E E N O N D E E V G U R E E M A K T V G U B O O S A R P E E H A E R P B E H A T R
U E H B R W P E E G R R E E C Y L E R C W E A D I V G P R C A R T A R A V I N G R R U V R N G R Y E
R A G I K I K U B A R I S Y N I H L T N K T A H H C D T A H D H R A T O Y G S S F P B Y Y S T F R A
O O R S N W P A N A E O K O D O T V I U O D D O E W Y T E U C A R T A R R H C L I V R R J U L I R O
O R R M N L T P E R O I S J U I T Y D V E E W Y T E M A T O L D H R A T U B I I O L Y U B L I O E W
L R Y A W E G E R I Y I G B L N I W R S H Y A H H A D I N K G A R C I S A B L M U L O C L W R E V U
K U A R L G R Y R T D D K A A D H A J T K S D O E A H C K T N R A E H K D U P I K U B P U E D V O A
T E Y C G F A R A A A N C S E N E W R R A J A I T D O E V G U R E E M A K E E R N N L K A W K O B O
R A R K M A V R M F E L A N R L A U A A G B L N I R Y T E R C W E A D I O F F R A M O G T N O M A S
Y N G Q B A Q Y A R T U T L R G U E W S E N A D D A H H K T N K T A H H Y A A I C U B S K G N A C I
A A P R U E E Y S B O S C O I A A R E N R L E N E D O E V G U O D D O E N A L F N P L K T N R A E H
O A K U A A E H H R W P E M B N E L E H R G R L A U Y T I C N O S K C C T R I T R E I C G U R E E M
currproj/greyass1/bin/PuzzleTest.class
currproj/greyass1/bin/test_output1.txt
(12, 10)(11, 10)(10, 10)(9, 10)(9, 11)(10, 11)(10, 12)(9, 12)(8, 12)(7, 12)(7, 13)
101
(1, 1)(1, 2)(2, 2)(2, 3)(3, 3)(4, 3)(4, 2)
43
(0, 14)(1, 14)(2, 14)(2, 13)(1, 13)(0, 13)(0, 14)
278
(12, 2)(12, 1)(12, 0)(11, 0)(10, 0)(9, 0)(9, 1)
846
(6, 6)(5, 6)(5, 7)(4, 7)(3, 7)(3, 8)
440
currproj/greyass1/bin/test_output2.txt
(6, 7)(6, 8)(6, 9)(7, 9)(8, 9)(7, 9)(7, 8)
1188
(20, 21)(19, 21)(19, 22)(19, 23)(20, 23)(21, 23)(21, 22)
1325
(21, 5)(21, 6)(21, 7)(21, 8)(22, 8)(22, 9)(21, 9)(20, 9)(19, 9)(19, 8)
1078
(6, 0)(6, 1)(7, 1)(7, 0)(8, 0)(8, 1)(9, 1)(9, 0)
1485
(0, 17)(0, 16)(0, 15)(0, 14)(0, 13)(1, 13)(1, 12)
1274
(2, 2)(1, 2)(0, 2)(0, 1)(1, 1)(2, 1)(3, 1)
296
(0, 17)(1, 17)(2, 17)(3, 17)(3, 16)(3, 15)
1383
(10, 14)(10, 15)(11, 15)(11, 16)(11, 15)
348
(14, 22)(14, 23)(15, 23)(15, 24)(16, 24)(17, 24)
1553
(24, 18)(23, 18)(23, 17)(22, 17)(22, 16)(22, 17)(21, 17)
2026
currproj/greyass1/bin/test_output3.txt
(47, 48)(46, 48)(45, 48)(44, 48)(43, 48)(43, 47)(43, 46)(44, 46)(44, 45)
9937
(0, 29)(0, 30)(0, 31)(1, 31)(1, 32)(0, 32)(0, 33)(0, 34)
1154
(0, 8)(0, 7)(0, 6)(1, 6)(2, 6)(2, 5)(2, 4)(1, 4)
5147
(21, 24)(22, 24)(22, 25)(22, 26)(23, 26)(22, 26)
2989
(49, 35)(48, 35)(48, 36)(49, 36)(49, 37)(48, 37)(48, 38)(47, 38)(46, 38)(46, 39)(47, 39)(47, 40)(46, 40)(45, 40)(45, 39)(45, 38)(44, 38)(44, 37)(43, 37)(43, 38)(42, 38)(41, 38)
9661
(3, 18)(3, 17)(4, 17)(4, 18)
890
(13, 1)(12, 1)(11, 1)(11, 2)(11, 3)
566
(0, 29)(1, 29)(1, 30)(2, 30)(2, 31)
2324
(48, 12)(48, 13)(47, 13)(48, 13)(49, 13)(49, 14)(48, 14)(48, 15)
6900
(23, 47)(22, 47)(21, 47)(20, 47)(20, 48)(20, 47)(20, 46)
1852
(0, 8)(1, 8)(2, 8)(2, 9)(3, 9)
4716
(29, 1)(28, 1)(27, 1)(27, 2)(28, 2)(28, 3)(28, 4)(27, 4)(26, 4)(25, 4)(25, 3)
7747
(21, 27)(21, 26)(20, 26)(19, 26)(19, 25)(18, 25)(17, 25)(16, 25)(16, 26)
3602
(28, 15)(27, 15)(27, 14)(26, 14)(26, 13)(27, 13)(28, 13)
5565
(39, 29)(38, 29)(38, 30)(37,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here