CS 122 - Homework #1 - Due Tuesday, January 29, 2019 "Chess Moves" The purpose of this assignment is to give you more practice with if statements and loops. You will write two short programs. The first program is called Bishop.java. This program will take two command-line arguments. They are the row and column number of the current location of a chess bishop. Your program will determine all of the possible legal destinations of the bishop from its current position. In chess, the bishop is allowed to move diagonally as far as the player wants while still remaining on the board. The second program is called Knight.java. It is analogous to the first program. The command-line arguments will give the current location of a knight, and your program needs to print out all of the legal destinations of the knight. In chess, a knight is allowed to move to a square that is located two cells away in one direction, and one cell away in a perpendicular direction. Throughout this program, you should assume that the rows and columns are each numbered from 1 to 8, inclusive, with row 1 at the top of the chess board, and column 1 along the left side. You may assume that the user will supply legal input. Also assume that there are no other pieces on the chess board to obstruct your piece's movement. Each of your programs should print one destination per line. Make sure your output format matches the examples below. Print out the possible destinations in row-major order. In other words, when you list the destinations, square a,b appears before square c,d if and only if a < c or (a = c and b < d). Here is some example I/O for each program: java Bishop 4 6 1,3 2,4 2,8 3,5 3,7 5,5 5,7 6,4 6,8 7,3 8,2 java Knight 4 7 2,6 2,8 3,5 5,5 6,6 6,8 When you are ready to submit, send me an e-mail message containing your two Java source files as attachments. Send .java files, not .class files. Your program must exhibit good programming style. If not, your submission may be considered unacceptable, and you will need to revise and resubmit. Here are some guidelines you should follow for all homework in this class: * Your program should begin with a block comment (or Javadoc comment) containing the name of the source file, your name, the date, and a general description of the program, its assumptions, and how to run. If you believe your program is not completely correct, then you should explain, as best you can, what your program can and cannot do correctly. In this case, it would be helpful to identify what aspect of the assignment you found most challenging. * In later programs, you will be writing programs containing multiple methods. In this case, each method should be preceded by a block comment or Javadoc comment. * Other comments should appear within the code highlighting important choices you had to make in solving the problem. Routine or trivial steps do not need to be commented. * A comment should describe the effect of several statements, not just one statement, unless there is something highly significant about that single statement. * No source line should be more than 80 characters long. * All curly braces should be vertically aligned. * Inner blocks of code should be indented 2 or 3 spaces. Choose 2 or 3, and use this amount of indentation consistently throughout your program. Do not use tabs to indent. * Put a space on either side of an operator. * Use blank lines to enhance the readability of your program. But use blank lines judiciously. Do not double-space every statement. * Use meaningful identifiers. For an example of good programming style, refer to the Dice.java program in the January 23 notes. Don't hesitiate to ask me for clarifications or help on this assignment. Good luck!