Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CRCP 3305 - Lab 5 Assignment

Overview

In Lab 4 we will move Lab 3 to pure java. We will also add a score board and a winner panel.

This Lab is due April 8th at 6:00am.

Part 1 (30 Points)

Move the current game to a full java program. To do this you will need to add a private Attribute Launcher l to all classes. You will then need to adjust all processing calls to go through your new attribute l. I have recreated the UML diagram and highlighted the changes in the next slide. This should be a large portion of copy and paste

This Lab is due April 8th at 6:00am

board           1

Launcher

+setting(): void

+ draw(): void

+ mousePressed(): void

+ main(String[]): void

game                 1


Game


- playerTurn :

- l: Launcher

int

Game(Launcher, int, int, int, int, int )

+ drawGame(): void

+ playerTurn(int, int): void

- addScore(Player, int): void

- printScore(): void


players


*


Player

- playerName : String

- playerScore : int

- playerColor : float[]

- l: launcher

Player(Launcher, String)

+ addScore(int): void

+ getPlayerColor(): float[]

+ setPlayerColor(float[]): void

+ getPlayerName():String

+ setPlayerName(String): void

+ getPlayerScore(): int

+ setPlayerScore(int): void

+ toString(): String


- l: Launcher

Board(Launcher, int, int, int, int)


This Lab is due Saturday April 8th at 6:00am


In part 1 we converted our program to java. In Part 2 we will be adding a scoreboard and a winner screen. Please look at the refactored UML diagram. Highlight indicates changes to the code.

This Lab is due Saturday April 8th at 6:00am


Launcher

+setting(): void

+ draw(): void

+ mousePressed(): void

+ main(String[]): void


game


1


Game

-    playerTurn :

- l: Launcher

- gameRunning : boolean

Game(Launcher, int, int, int, int, int )

+ drawGame(): void

+ playerTurn(int, int): void

- updateFinishGameState(): void


Scoreboard


Scoreboard defined on next slide



scoreboard              1


- scoreBoardX : float

- scoreBoardY: float

- PLAYER_ NAME_WIDTH: float

- PLAYER_SCORE_WIDTH: float

- SCORE_ BOARD_SINGLE_ HEIGHT: float

- l: Launcher

Scoreboard(Launcher, ArrayList<Player>, scoreboardY,scoreboardX)

+ getPlayerColor(int): float[]

+ getPlayerCount(): int

+ getWinner(): Player



UML Diagram continued next slide

This Lab is due Saturday April 8th at 6:00am


cards          *


Board

-

-

-

-

-

-

-

CARD_WIDTH: int

CARD_HEIGHT: int

cardSpacing: int

rows: int

columns: int

numberOfCards: int

l: Launcher

Board(Launcher, int, int, int, int)

- createCards() : void

- shuffleCards(): void

- setupCardLocations():void + drawBoard(): void + checkCollision(int, int): Card


This Lab is due Saturday April 8th at 6:00am

Launcher

Simply update the Launcher class by making the height of the screen 800. This will ensure you have enough room for the new scoreboard.

This Lab is due Saturday April 8th at 6:00am


Scoreboard

The scoreboard list the players vertically. The

constructor should take an ArrayList of players, the

xCord of the scoreboard and the yCord of the

scoreboard.

PLAYER_SCORE_WIDTH should be 100 by default.

PLAYER_NAME_WIDTH should be 300 by default

SCORE_BOARD_SINGLE HEIGHT should be 75

drawScoreboard should loop through each player and

draw the scoreboard the player. Two boxes should be

drawn one for the Player name and one for his score.

The width of the box should be 300 and 100. The

height of each box is 75. The color of these boxes

should match the players box.

addPlayerScore: This should take a playerIndex and a

score and add it to that player.

This Lab is due April 8th at 6:00am



Scoreboard Continued

getPlayerColor: This takes a player index and returns

the float[] with their custom color.

getPlayerCount: this returns the number of player

getWinner: this finds the player with the highest score

and returns the player Object.


This Lab is due April 8th at 6:00am



Board:

isBoardFinished() : This method checks and returns true

if every card has been clicked otherwise it returns false.

drawWinnerPanel: this method take a player object

and colors the entire screen and writes the player

name in the middle of the screen. See example below

This Lab is due Saturday April 8th at 6:00am


Game:

Add an attribute for gameRunning. Also add an

attribute for Scoreboard.

Update the Game constructor. It should now create the

players and pass the ArrayList to the scoreboard

creation. Also set game running to true.

Next we need create a meth