05.06.2013 Views

Yeab Wondimu Sam ballmer - Lakeside School

Yeab Wondimu Sam ballmer - Lakeside School

Yeab Wondimu Sam ballmer - Lakeside School

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Yeab</strong> <strong>Wondimu</strong><br />

<strong>Sam</strong> <strong>ballmer</strong>


Original Goal:<br />

Full Black Jack table with cards and<br />

player information.<br />

Entirely GUI<br />

Buttons for Hit and Stay<br />

Betting button / Input box<br />

All text through the Jpanel instead of<br />

Terminal Terminal.


Final Goals:<br />

Graphics:<br />

Grid Formation displaying each players cards (no<br />

table)<br />

Di Display l Pl Player chip hi count t and d name<br />

User interaction with terminal to input data.<br />

Hit and stay as well as bet run through the terminal<br />

Only 2 players and then the dealer<br />

Print out information to Jpanel. Jpanel<br />

No splitting double pairs!


Original Design:<br />

Main<br />

Create Deck and Cards<br />

Basic Blackjack math<br />

Create Images and JFrame<br />

Deck<br />

Arra ArrayList List for Cards<br />

Shuffle and Deal<br />

Card<br />

Parameter for suit, value, img<br />

Access methods


Adjusted Design:<br />

Player Class<br />

EVERYTHING!<br />

Card Panel<br />

Load Graphics<br />

Create Players<br />

Main<br />

Turn/Check Method<br />

Creates Deck<br />

Dealer Method<br />

Deck<br />

CConstructs t t Cards C d<br />

Reconstruct Method<br />

Card


Layout


Collaboration<br />

Code all written together<br />

<strong>Yeab</strong> specialized Graphics<br />

<strong>Sam</strong> specialized background<br />

calculations<br />

Much more efficient and effective


Graphical User Interface<br />

The main component of the GUI is the<br />

JFrame:<br />

Creates a frame in which you can add<br />

visual elements (buttons, labels, images,<br />

etc.)<br />

JPanel – Panel on top of the frame that<br />

repaints all the visual elements<br />

Buttons – Problems with separation of<br />

classes and implementing buttons


Early GUI


Player Class<br />

Player Class was the glue of the<br />

program<br />

Filled with accessor methods<br />

Used ArrayList to store the Cards for<br />

each player’s player s hand<br />

Accessor Methods for Setting and<br />

Accessing bet values, values getting card<br />

values from the arraylist


CardPanel Class<br />

Pros and Cons of implementing<br />

Graphics in two different classes<br />

PaintComponent method – Difficulty of<br />

drawing graphics from other classes<br />

PaintComponent method – Solution to<br />

repaint problem


Problems we Encountered<br />

Aces – 1or11? 1 or 11?<br />

Face Cards – Creating face cards to<br />

have a value of 10 through a loop<br />

Balance between JFrame and<br />

Console/Terminal<br />

GUI v. Text Based – Conflict between<br />

two


Problems with GUI<br />

Importing Images on JFrame without<br />

JPanel<br />

Repainting p g the JFrame with the images g<br />

(or lack thereof)<br />

Issues with loops in other classes (not<br />

allowing the JPanel to repaint)<br />

Thread.sleep<br />

Splitting up the GUI into 2 different<br />

classes (problems with buttons)


Other Problems


THE END

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!