CST 338 Low Card Game


Good morning fellow students of cohort
10 my name is Edgar Leos and today i will be talking to you about the java program
low card game which is our first program that we would use graphical interface
user interface with it so we have to understand before we get into how into
the program what java sees or what Java uses for GUIs and what he uses at
least during this what we’ve learned this week is uses J frames J labels and
J panels j frames you want to think of them as the actual working window so
this is where your actual window is J labels think of them as your your
actual items on them so it can be text, they can buttons they can be files be J panels think of them as dividers think of them as
separators for you J frames. So for phase 1 we are asked to grab the files of the
gifts or the card images and save them as icons and then save an icon array of
those icons we need to figure out what the value what are the values of the
cards and what are the suits they are the values do range from 2 to X the
suits “C”, “D”, “H”, “S” so we need to find a way to access this part of the file and
then this part of the file I do suggest working and some sort of loops to go
through each of this because you can think of these two as arrays so go through
this array and for every one of these arrays its gonna have one of these ones
go through this array and then this of this add to your array so you have your for loop for every item of value and for
every item of suit suit go ahead and add to the array the item at this value at
this suit that if they should add them all up nice and neat into the array which then
the program already provides a form of displaying it to the to the screen. So phase 2 starts with card creating the card table class this card table the only
thing that you need to keep in mind is make sure you’re well aware of J
frames difference between Jframes J panels and your J labels because you’ll be
creating your main frame which is your window, panels which will be the
subsections and labels which is what you’re going to be putting in you’re
gonna do it on your do it card on your card class so for your GUICard class
we are asked to use our old card class and have it talked to GUI to produce to
be able to make a 2d array icon array with information of where the GUI card
the card that we’re looking for this for this one just like last week’s
assignment you got to make sure you know how to traverse your 2d arrays you have
your suits and your values make sure you populate them correctly and remember
icon location zero zero if your prefer to suit
“C” for clubs, value 2. So by traversing your double array you’ll be able to
convert ints, int [0] [0] into suit C number 2 which then you can use to
construct your file name to be able to access it, your card hand and deck
updates will be working on adding a joker to where we need it
actually Joe could not joke over using X we’re adding a joker to the card and
remember to increase the number of deck cards where they need to be as well as updating adding a couple methods to your
deck your deck class to be able to put in and take out cards on them for
those just make sure you keep an eye on topCard that is very important and with
some fancy looping you should be able to do it finally phase two’s display for
this one that’s where you put in your take your card tables and you’re gonna
use J label arrays to place number your you labels remember labels are things
into your different J panels you have your computer jpanel
your plain area J panel in your hand J panel in each of these panels should be
in here divided subdivided as a grid layout with the number of cards needed
here cards and labels here in cards here which then you would use display to
traverse your J label arrays and to add on them into your displays Oh card does get
a createRandomCard [method] as well which should be fairly simple and if you know
how to traverse your suits and your values, create random ints to create those The last phase of the pro of the program
project it is creating the actual game we’re asked to do that first by grabbing
the card game framework which is a set of code that will be added to our to our
project to inspect and return cards check cards we are asked to do a few
changes in main mainly to move our inspect card method from our deck class
to the main I do suggest when you’re working on this to go ahead and set it
aside and kind of test it on your own before you slap it into the main jframe
to make sure it works nice make sure it’s talking nice to deck card and your
icons and finally by creating we are asked to create the actual game which is
the low card wins pick a card make the cards on the jframe instead of just
images to make them buttons that is very it is left very up maybe create menus
that is left very open-ended my suggestion is to declare more rules you
want to say were configurations you want to have then work on turn those rules
and configurations into pseudocode and go from there don’t test them all at
once test up one by one and good luck

Tags:, ,

Add a Comment

Your email address will not be published. Required fields are marked *