Bug 402 - It is found that there was no coordinate for user's reference, so that they have to count to get the coordinate.
Summary: It is found that there was no coordinate for user's reference, so that they h...
Status: RESOLVED FIXED
Alias: None
Product: CS3343 2020 Group 9_Chinese Chess
Classification: Unclassified
Component: ChessGame (show other bugs)
Version: V2.0
Hardware: PC Windows
: --- major
Assignee: DUAN Longteng
URL:
Depends on:
Blocks:
 
Reported: 2020-11-14 00:11 HKT by DUAN Longteng
Modified: 2020-12-06 18:31 HKT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DUAN Longteng 2020-11-14 00:11:20 HKT

    
Comment 2 DUAN Longteng 2020-11-14 00:17:42 HKT
The problem is solved and the new code is:

public void printChessBoard() {
		
		int maxChessNameLenwithSpace = 15;
		for(int i=9;i>=0;i--) {
			System.out.print(i);
			for(int j=0;j<9;j++) {
				int fill;
				if(this.chessBoardDetails[j][i] != null)
					fill = maxChessNameLenwithSpace - this.chessBoardDetails[j][i].length();
				else
					fill = 14;
				int leftfill = fill/2;
				int rightfill = fill - leftfill;
					for(int k=0;k<leftfill;k++)
						System.out.print('-');
					if (this.chessBoardDetails[j][i] != null)
						System.out.print(this.chessBoardDetails[j][i]);							
					else
						System.out.print('+');
					for(int k=0;k<rightfill;k++)
						System.out.print('-');
			}
			if(i == 0) {
				System.out.println();
				System.out.println("        0              1              2              3              4              5              6              7              8       ");
				return;
			}
			else if (i == 5) {
				System.out.println();
				System.out.println(" |      |              |              |              |              |              |              |              |              |      |");
				System.out.println(" |      |              |              |              |              |              |              |              |              |      |");
				System.out.println(" |      |              |              |              |              |              |              |              |              |      |");
			}
			else {
				System.out.println();
				System.out.println(" |      |              |              |              |              |              |              |              |              |      |");
				System.out.println(" |      |              |              |              |              |              |              |              |              |      |");
			}
		}

	}
Comment 3 DUAN Longteng 2020-11-27 22:55:03 HKT
Add:
Steps to produce this bug:
Typing "new game",
A initial game board appears,
The chessboard has no coordinate.

Engineer to solve this bug: DUAN Longteng