Answered step by step
Verified Expert Solution
Question
1 Approved Answer
HOMEWORK: Puzzle Reader This will lead nicely into a Sudoku-solving problem, which we will write after we cover recursion, in the next unit. For now,
HOMEWORK: Puzzle Reader This will lead nicely into a Sudoku-solving problem, which we will write after we cover recursion, in the next unit. For now, we'll just read and display the puzzles (which might be Sudoku or Numbrix or Magic Squares or any of several number-based puzzles). S1 S4: S9: 16: S25 S36: 1 1, 2, 3, and 4 1-9 0-F 0-P 0-Z 1x 1 puzzle 4 x 4 puzzle 9 x 9 puzzle (this is the "standard Sudoku or Numbrix dimension) 16 x 16 puzzle; a base-16 or "hex" puzzle 25 x 25 puzzle; a base-25 puzzle 36 x 36 puzzle; a base-36 puzzle Each entry in the table is a single char. The only values allowed are the digits 0-9 and the chars A-Z/a-z. We will use - or * to designate a blank square. We consider only square puzzles. Puzzles that have a number of entries that is a perfect square are processed and displayed; puzzles that do not have a number of entries that is a perfect square are rejected. Pro tip: read the entire file into a vector of characters, then check the size. If it's a perfect square, create your square table (a two-dimensional array) and copy the values (converting from char to the associated integer value) from the vector into the table. For example, the input file to the left would be displayed as the puzzle to the right. A 3 B - 1 2 3 4 CAFE 0 - 2 C 10 3 11 1 2 3 4 12 10 15 14 0 2 12 This conversion of char to int will be of great use to us in the next unit, when we explore how recursion can be used to solve number puzzles such as Sudoku and Numbrix and Magic Square. For the purposes of the homework, any value can be used in any size (but still square) puzzle. DELIVERABLES: Your Java source code. A screen shot of your program in action, run from the command line, and using the Square Puzzle Sample Input File from Moodle as the input file (as a command-line parameter). NOTE: For this homework, you need only read the puzzle values, convert to decimal, and display those decimal values. To clear the related quiz, just add them! HOMEWORK: Puzzle Reader This will lead nicely into a Sudoku-solving problem, which we will write after we cover recursion, in the next unit. For now, we'll just read and display the puzzles (which might be Sudoku or Numbrix or Magic Squares or any of several number-based puzzles). S1 S4: S9: 16: S25 S36: 1 1, 2, 3, and 4 1-9 0-F 0-P 0-Z 1x 1 puzzle 4 x 4 puzzle 9 x 9 puzzle (this is the "standard Sudoku or Numbrix dimension) 16 x 16 puzzle; a base-16 or "hex" puzzle 25 x 25 puzzle; a base-25 puzzle 36 x 36 puzzle; a base-36 puzzle Each entry in the table is a single char. The only values allowed are the digits 0-9 and the chars A-Z/a-z. We will use - or * to designate a blank square. We consider only square puzzles. Puzzles that have a number of entries that is a perfect square are processed and displayed; puzzles that do not have a number of entries that is a perfect square are rejected. Pro tip: read the entire file into a vector of characters, then check the size. If it's a perfect square, create your square table (a two-dimensional array) and copy the values (converting from char to the associated integer value) from the vector into the table. For example, the input file to the left would be displayed as the puzzle to the right. A 3 B - 1 2 3 4 CAFE 0 - 2 C 10 3 11 1 2 3 4 12 10 15 14 0 2 12 This conversion of char to int will be of great use to us in the next unit, when we explore how recursion can be used to solve number puzzles such as Sudoku and Numbrix and Magic Square. For the purposes of the homework, any value can be used in any size (but still square) puzzle. DELIVERABLES: Your Java source code. A screen shot of your program in action, run from the command line, and using the Square Puzzle Sample Input File from Moodle as the input file (as a command-line parameter). NOTE: For this homework, you need only read the puzzle values, convert to decimal, and display those decimal values. To clear the related quiz, just add them
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started