Microsoft Word - SADI_Assignment1_sem2_2018.doc Software Architecture Design and Implementation COSC 2391/2401 Semester 2, 2018 Casino Style Card Game Assignment Part 1: Console Implementation (25...

1 answer below »
I have attached both the code zip file as well as the assignment document.
Microsoft Word - SADI_Assignment1_sem2_2018.docSoftware Architecture Design and Implementation COSC 2391/2401 Semester 2, 2018 Casino Style Card Game Assignment Part 1: Console Implementation (25 marks) NOTE: The provided Javadoc and commented interface source code is your main specification, this document only serves as an overview. You should also regularly follow the Canvas assignment discussion board for assignment related clarifications and discussion. This assignment requires you to implement a game engine and console based user interface (logging output only, no user interaction required) for a casino style card game that is loosely based on Black Jack but is for the gambler in a hurry that doesn’t want to think too hard and wants to trust in luck alone without having to worry about statistics! The rules are simple, the player places a bet and then receives a set of cards from the dealer (from a standard 52 card deck) until they bust by exceeding the limit of 21. The final score is the sum of the cards prior to the final card that caused the bust. The house then deals on their own behalf against the player .. Highest score wins! A draw is a no contest and the bet is returned to the player. The rules for cards are simple with no action required by the player. An Ace is always worth 1, Jack, Queen and King are 10 and the other cards are worth their face value. i.e. a seven of spades is worth 7 points. NOTE: players only play against the house not against each other. Also, do not worry about modelling a real Casino “Black Jack” game with its more complex rules. The focus here is on the implementation using a simple, highest card sum wins. HOW TO GET STARTED: For this assignment you are provided with a skeleton eclipse project (CardGame.zip) that contains a number of interfaces that you must implement to provide the specified behaviour as well as a simple client which will help you get started. The provided Javadoc documentation (load index.html from CardGame/docs/ into a browser to view), and commented interface source code (in the provided package model.interfaces) is your main specification, this document only serves as an overview. NOTE: You may copy and add to the provided console client code to facilitate more thorough testing. You must however ensure that the original unaltered code can still execute since we will use our own test client to check your code which is strictly based on the interfaces (this is the point of having interfaces after all!) i.e. DO NOT CHANGE ANY OF THE INTERFACES ETC. The supplied project also contains code that will validate your interfaces for the main four classes you must write (see implementation specification below), and will warn you if you have failed to implement the required interfaces or have otherwise added any non-private methods that break the public interface contract. By default the validator lists all the expected methods as well as your implemented methods so you can use output this to find problems if you fail the validation. You do not need to provide any console input, all your test data can be hard coded as in the provided SimpleTestClient.javaImplementation Specifications Your primary goal is to implement the provided GameEngine, Player, GameEngineCallback and PlayingCard interfaces, in classes called GameEngineImpl, SimplePlayer, GameEngineCallbackImpl and PlayingCardImpl. You must provide the behaviour specified by the javadoc comments in the various interfaces and the generated javadoc index.html. The imports in SimpleTestClient.java show you which packages these classes should be placed in. More specifically, you must provide appropriate constructors (these can be determined from SimpleTestClient.java and are also documented in the relevant interfaces) and method implementations (from the four interfaces) in order to ensure that your solution can be complied and tested without modifying the provided SimpleTestClient.java1 (although you can and should extend this class to thoroughly test your code). A sample output trace (OutputTrace.txt) is provided to help you write correct behaviour in the GameEngineImpl which in turn calls the GameEngineCallbackImpl class to perform the actual logging. You should follow the exact output format although we will not be checking down to individual commas or spaces! Your client code (SimpleTestClient.java and any extended derivatives) should be separate from, and use, your GameEngineImpl implementation via the GameEngine interface. Furthermore, your client should NOT call methods on any of the other interfaces/classes since these are designed to be called directly from the GameEngine2 The main implementation classes GameEngineImpl and GameEngineCallbackImpl are described in more detail below. The SimplePlayer and PlayingCardImpl are relatively straightforward data classes and should not need further explanation for their implementation (beyond the comments provided in the respective interfaces). GameEngineImpl class This is where the main game functionality is contained. All methods from the client are called through this class (see footnote). Methods in the supporting classes should only be called from GameEngineImpl. The main feature of this class that is likely different to previous code you have written is that the GameEngineImpl does not provide any output of its own (i.e. it SHOULD HAVE NO println() or log() statements other than for debugging and these should be commented or removed prior to submission). Instead it calls appropriate methods on the GameEngineCallback as it runs (see below) which is where all output is logged to the console for assignment part 1. This provides a good level of isolation and will allow you to use your GameEngineImpl unchanged in assignment 2 when we add a graphical AWT/Swing use interface! NOTE: Your GameEngineImpl must maintain a collection (or array) of Players AND a collection (or array) of GameEngineCallbacks. When a callback method should be called this must be done in a loop iterating through all callbacks. Note that each callback receives the same data so there is no need to distinguish them (i.e. they are all the same and not player specific). SimpleTestClient.java gives an example for two players and shows it is trivial to add more (simply increase the array size by adding to the initialiser). 1 A common mistake is to change the imports (sometimes accidentally!) Therefore, you MUST NOT change the imports and must place the class implementations in the expected package so that we can test your code with our own testing client. 2 This is because we will be testing your code with our own client by calling the specified GameEngine methods. We will not call methods on any other classes and therefore if your GameEngineImpl code expected other methods to be called from the client (rather than calling them itself) it won’t work! GameEngineCallbackImpl class The sole purpose of this class is to support the user interface (view) which in assignment part 1 consists of simple console/logging output. Therefore all this class needs to do is log data to the console from the parameters passed to its methods. Apart from implementing the logging (we recommend String.format() here) the main thing is to make sure you call the right method at the right time! (see below). You should also as much as possible make use the of the overidden toString() methods you will implement in SimplePlayer and PlayingCardImpl since this will simplify the logging! The only class that will call the GameEngineCallbackImpl methods is the GameEngineImpl class. For example as the dealPlayer(…) method is executing in a loop it will call the nextCard(…) method on the GameEngineCallbackImpl (via the GameEngineCallback interface). Details of the exact flow and where GameEngineCallback methods should be called are provided in the GameEngineImpl source code and associated Javadoc. IMPORTANT: The main thing to watch out for (i.e. “gotcha”) is that this class should not manage any game state or implement any game based functionality which instead belongs in the GameEngineImpl. The core test here is that we should be able to replace your GameEngineCallbackImpl with our own (which obviously knows nothing about your implementation) and your GameEngineImpl code should still work. This is a true test of encapsulation and programming using interfaces (i.e. to a specification) and is one of the main objectives of this assignment! IF YOU DO NOT FOLLOW THE NOTE ABOVE YOUR CODE WILL NOT EXECUTE PROPERLY WITH OUR TEST HARNESS AND YOU WILL LOSE MARKS! PLEASE DON’T GET CAUGHT OUT .. IF IN DOUBT ASK, WE ARE HAPPY TO HELP :) IMPLEMENTATION TIPS Before you start coding make sure you have thoroughly read this overview document and carefully inspected the supplied Java code and Javadoc documentation. It might take a bit of work but the more carefully you read before beginning coding the better prepared you will be! 1. Start by importing the supplied Java project CardGame.zip. It will not compile yet but this is normal and to be expected. 2. The first step is to get the code to compile by writing a minimal implementation of the required classes. Most of the methods can be left blank at this stage, the idea is satisfy all of the dependencies in SimpleTestClient.java that are preventing successful compilation. Eclipse can help automate much of this with the right click Source ... context menu but it is a good idea to write at least a few of the classes by hand to make sure you are confident of the relationship between classes and the interfaces that they implement. It will also help familiarise you with the class/method names and their purpose. I have already provided a partial implementation of GameEngineCallbackImpl showing the use of the Java logging framework but you will need to complete it by implementing the missing methods. 3. When writing the SimplePlayer class you will need a 3 argument constructor for the code to compile. You could leave this blank at this stage but might as well implement it by saving the parameters as instance variables/attributes. In fact you might as well implement the methods while you are there
Answered Same DayJul 28, 2020COSC2391

Answer To: Microsoft Word - SADI_Assignment1_sem2_2018.doc Software Architecture Design and Implementation COSC...

Meenakshi answered on Jul 30 2020
75 Votes
CardGame/.classpath

    
    
    
    
    
CardGame/.project

     CardGame
    
    
    
    
        
             org.eclipse.jdt.core.javabuilde
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
CardGame/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=e
o
org.eclipse.jdt.core.compiler.problem.enumIdentifier=e
o
org.eclipse.jdt.core.compiler.source=1.8
CardGame
in/client/SimpleTestClient.class
package client;
public synchronized class SimpleTestClient {
private static java.util.logging.Logger logger;
static void ();
public void SimpleTestClient();
public static void main(String[]);
private static void printCards(java.util.Deque);
}
CardGame
in/model/interfaces/GameEngine.class
package model.interfaces;
public abstract interface GameEngine {
public static final int BUST_LEVEL = 21;
public abstract void dealPlayer(Player, int);
public abstract void dealHouse(int);
public abstract void addPlayer(Player);
public abstract Player getPlayer(String);
public abstract boolean removePlayer(Player);
public abstract void addGameEngineCallback(view.interfaces.GameEngineCallback);
public abstract boolean removeGameEngineCallback(view.interfaces.GameEngineCallback);
public abstract java.util.Collection getAllPlayers();
public abstract boolean placeBet(Player, int);
public abstract java.util.Deque getShuffledDeck();
}
CardGame
in/model/interfaces/Player.class
package model.interfaces;
public abstract interface Player {
public abstract String getPlayerName();
public abstract void setPlayerName(String);
public abstract int getPoints();
public abstract void setPoints(int);
public abstract String getPlayerId();
public abstract boolean placeBet(int);
public abstract int getBet();
public abstract void resetBet();
public abstract int getResult();
public abstract void setResult(int);
public abstract String toString();
}
CardGame
in/model/interfaces/PlayingCard$Suit.class
package model.interfaces;
public final synchronized enum PlayingCard$Suit {
public static final PlayingCard$Suit HEARTS;
public static final PlayingCard$Suit SPADES;
public static final PlayingCard$Suit CLUBS;
public static final PlayingCard$Suit DIAMONDS;
static void ();
private void PlayingCard$Suit(String, int);
public static PlayingCard$Suit[] values();
public static PlayingCard$Suit valueOf(String);
}
CardGame
in/model/interfaces/PlayingCard$Value.class
package model.interfaces;
public final synchronized enum PlayingCard$Value {
public static final PlayingCard$Value ACE;
public static final PlayingCard$Value TWO;
public static final PlayingCard$Value THREE;
public static final PlayingCard$Value FOUR;
public static final PlayingCard$Value FIVE;
public static final PlayingCard$Value SIX;
public static final PlayingCard$Value SEVEN;
public static final PlayingCard$Value EIGHT;
public static final PlayingCard$Value NINE;
public static final PlayingCard$Value TEN;
public static final PlayingCard$Value JACK;
public static final PlayingCard$Value QUEEN;
public static final PlayingCard$Value KING;
static void ();
private void PlayingCard$Value(String, int);
public static PlayingCard$Value[] values();
public static PlayingCard$Value valueOf(String);
}
Card
Game
in/model/interfaces/PlayingCard.class
package model.interfaces;
public abstract interface PlayingCard {
public static final int DECK_SIZE = 52;
public abstract PlayingCard$Suit getSuit();
public abstract PlayingCard$Value getValue();
public abstract int getScore();
public abstract String toString();
public abstract boolean equals(PlayingCard);
}
CardGame
in/validate/Validator.ja
META-INF/MANIFEST.MF
Manifest-Version: 1.0
validate/PlayerImpl.class
package validate;
public synchronized class PlayerImpl implements model.interfaces.Player {
public void PlayerImpl();
public String getPlayerName();
public void setPlayerName(String);
public int getPoints();
public void setPoints(int);
public String getPlayerId();
public boolean placeBet(int);
public int getBet();
public void resetBet();
public int getResult();
public void setResult(int);
}
validate/GECImpl.class
package validate;
public synchronized class GECImpl implements view.interfaces.GameEngineCallback {
public void GECImpl();
public void nextCard(model.interfaces.Player, model.interfaces.PlayingCard, model.interfaces.GameEngine);
public void bustCard(model.interfaces.Player, model.interfaces.PlayingCard, model.interfaces.GameEngine);
public void result(model.interfaces.Player, int, model.interfaces.GameEngine);
public void nextHouseCard(model.interfaces.PlayingCard, model.interfaces.GameEngine);
public void houseBustCard(model.interfaces.PlayingCard, model.interfaces.GameEngine);
public void houseResult(int, model.interfaces.GameEngine);
}
validate/CardImpl.class
package validate;
public synchronized class CardImpl implements model.interfaces.PlayingCard {
public void CardImpl();
public model.interfaces.PlayingCard$Suit getSuit();
public model.interfaces.PlayingCard$Value getValue();
public int getScore();
public boolean equals(model.interfaces.PlayingCard);
}
validate/Validator$ValidationException.class
package validate;
public synchronized class Validator$ValidationException extends RuntimeException {
public void Validator$ValidationException(String);
}
validate/Validator.class
package validate;
public synchronized class Validator {
private static final String FAIL_MSG =
You are either not implementing a required interface, have modified it,
or have one or more non-private methods that are not part of the Specification;
private static final String SYNTHETIC_ACCESSOR = access$;
private static final String SWITCH_TABLE = $SWITCH_TABLE;
private static final String[] IGNORED_TOKENS;
static void ();
public void Validator();
public static void validate(boolean);
private static void validateImpl(Class, Class, boolean) throws Validator$ValidationException;
private static String unqualifyMethodName(String);
private static java.util.Set createSortedSetOfNonPrivateMethodsForClass(Class);
private static boolean ignoreMethod(reflect.Method);
private static void addAllDeclaredMethods(java.util.Set, Class);
}
validate/GEImpl.class
package validate;
public synchronized class GEImpl implements model.interfaces.GameEngine {
public void GEImpl();
public void dealPlayer(model.interfaces.Player, int);
public void dealHouse(int);
public void addPlayer(model.interfaces.Player);
public model.interfaces.Player getPlayer(String);
public boolean removePlayer(model.interfaces.Player);
public void addGameEngineCallback(view.interfaces.GameEngineCallback);
public boolean removeGameEngineCallback(view.interfaces.GameEngineCallback);
public java.util.Collection getAllPlayers();
public boolean placeBet(model.interfaces.Player, int);
public java.util.Deque getShuffledDeck();
}
CardGame
in/view/GameEngineCallbackImpl.class
package view;
public synchronized class GameEngineCallbackImpl implements interfaces.GameEngineCallback {
private final java.util.logging.Logger logger;
public void GameEngineCallbackImpl();
public void nextCard(model.interfaces.Player, model.interfaces.PlayingCard, model.interfaces.GameEngine);
public void result(model.interfaces.Player, int, model.interfaces.GameEngine);
}
CardGame
in/view/interfaces/GameEngineCallback.class
package view.interfaces;
public abstract interface GameEngineCallback {
public abstract void nextCard(model.interfaces.Player, model.interfaces.PlayingCard, model.interfaces.GameEngine);
public abstract void bustCard(model.interfaces.Player, model.interfaces.PlayingCard, model.interfaces.GameEngine);
public abstract void result(model.interfaces.Player, int, model.interfaces.GameEngine);
public abstract void nextHouseCard(model.interfaces.PlayingCard, model.interfaces.GameEngine);
public abstract void houseBustCard(model.interfaces.PlayingCard, model.interfaces.GameEngine);
public abstract void houseResult(int, model.interfaces.GameEngine);
}
CardGame/docs/allclasses-frame.html
All Classes
        GameEngine
        GameEngineCallback
        Playe
        PlayingCard
        PlayingCard.Suit
        PlayingCard.Value
CardGame/docs/allclasses-noframe.html
All Classes
        GameEngine
        GameEngineCallback
        Playe
        PlayingCard
        PlayingCard.Suit
        PlayingCard.Value
CardGame/docs/constant-values.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Constant Field Values
Contents
        model.interfaces.*
model.interfaces.*
        
model.interfaces.GameEngine         Modifier and Type        Constant Field        Value
        
public static final int        BUST_LEVEL        21
        
model.interfaces.PlayingCard         Modifier and Type        Constant Field        Value
        
public static final int        DECK_SIZE        52
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
CardGame/docs/deprecated-list.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Deprecated API
Contents
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
CardGame/docs/help-doc.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
How This API Document Is Organized
This API (Application Programming Interface) document has pages co
esponding to the items in the navigation bar, described as follows.
        
Overview
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
        
Package
Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
        Interfaces (italic)
        Classes
        Enums
        Exceptions
        E
ors
        Annotation Types
        
Class/Interface
Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
        Class inheritance diagram
        Direct Subclasses
        All Known Subinterfaces
        All Known Implementing Classes
        Class/interface declaration
        Class/interface description
        Nested Class Summary
        Field Summary
        Constructor Summary
        Method Summary
        Field Detail
        Constructor Detail
        Method Detail
Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
        
Annotation Type
Each annotation type has its own separate page with the following sections:
        Annotation Type declaration
        Annotation Type description
        Required Element Summary
        Optional Element Summary
        Element Detail
        
Enum
Each enum has its own separate page with the following sections:
        Enum declaration
        Enum description
        Enum Constant Summary
        Enum Constant Detail
        
Use
Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
        
Tree (Class Hierarchy)
There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
        When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
        When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
        
Deprecated API
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
        
Index
The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
        
Prev/Next
These links take you to the next or previous class, interface, package, or related page.
        
Frames/No Frames
These links show and hide the HTML frames. All pages are available with or without frames.
        
All Classes
The All Classes link shows all classes and interfaces except non-static nested types.
        
Serialized Form
Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
        
Constant Field Values
The Constant Field Values page lists the static final fields and their values.
This help file applies to API documentation generated using the standard doclet.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-1.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
A
        addGameEngineCallback(GameEngineCallback) - Method in interface model.interfaces.GameEngine
         
        addPlayer(Player) - Method in interface model.interfaces.GameEngine
         
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-10.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
R
        removeGameEngineCallback(GameEngineCallback) - Method in interface model.interfaces.GameEngine
         
        removePlayer(Player) - Method in interface model.interfaces.GameEngine
         
        resetBet() - Method in interface model.interfaces.Playe
        
eset the bet to 0 for next round (in case player does not bet again in next round)
        result(Player, int, GameEngine) - Method in interface view.interfaces.GameEngineCallback
        
called when the player has bust with final result (result is score prio
to the last card that caused the bust)
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-11.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
S
        setPlayerName(String) - Method in interface model.interfaces.Playe
         
        setPoints(int) - Method in interface model.interfaces.Playe
         
        setResult(int) - Method in interface model.interfaces.Playe
         
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-12.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
T
        toString() - Method in interface model.interfaces.Playe
         
        toString() - Method in interface model.interfaces.PlayingCard
         
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-13.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
V
        valueOf(String) - Static method in enum model.interfaces.PlayingCard.Suit
        
Returns the enum constant of this type with the specified name.
        valueOf(String) - Static method in enum model.interfaces.PlayingCard.Value
        
Returns the enum constant of this type with the specified name.
        values() - Static method in enum model.interfaces.PlayingCard.Suit
        
Returns an a
ay containing the constants of this enum type, in
the order they are declared.
        values() - Static method in enum model.interfaces.PlayingCard.Value
        
Returns an a
ay containing the constants of this enum type, in
the order they are declared.
        view.interfaces - package view.interfaces
         
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-2.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
B
        BUST_LEVEL - Static variable in interface model.interfaces.GameEngine
         
        bustCard(Player, PlayingCard, GameEngine) - Method in interface view.interfaces.GameEngineCallback
        
called when the card causes the player to bust
this method is called instead of GameEngineCallback.nextCard(Player, PlayingCard, GameEngine)
this method is called before GameEngineCallback.result(Player, int, GameEngine)
use this to update your display for each card or log to console
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-3.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
D
        dealHouse(int) - Method in interface model.interfaces.GameEngine
        
Same as dealPlayer() but deals for the house and calls the house versions
of the callback methods on GameEngineCallback, no player parameter is
required

After the house deal has finished but BEFORE calling houseResult() win/loss values
are applied to all players based on their bet
        dealPlayer(Player, int) - Method in interface model.interfaces.GameEngine
        
Deal cards to the player, increments of delay are in milliseconds (ms)

1.
        DECK_SIZE - Static variable in interface model.interfaces.PlayingCard
         
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-4.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
E
        equals(PlayingCard) - Method in interface model.interfaces.PlayingCard
         
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-5.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
G
        GameEngine - Interface in model.interfaces
        
Assignment interface for SADI providing main Card Game model functionality
        GameEngineCallback - Interface in view.interfaces
        
Assignment interface for SADI to notify client of GameEngine events e.g.
        getAllPlayers() - Method in interface model.interfaces.GameEngine
         
        getBet() - Method in interface model.interfaces.Playe
         
        getPlayer(String) - Method in interface model.interfaces.GameEngine
         
        getPlayerId() - Method in interface model.interfaces.Playe
         
        getPlayerName() - Method in interface model.interfaces.Playe
         
        getPoints() - Method in interface model.interfaces.Playe
         
        getResult() - Method in interface model.interfaces.Playe
         
        getScore() - Method in interface model.interfaces.PlayingCard
         
        getShuffledDeck() - Method in interface model.interfaces.GameEngine
        
A debug method to return a deck of cards containing 52 unique cards in
random/shuffled orde
        getSuit() - Method in interface model.interfaces.PlayingCard
         
        getValue() - Method in interface model.interfaces.PlayingCard
         
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-6.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
H
        houseBustCard(PlayingCard, GameEngine) - Method in interface view.interfaces.GameEngineCallback
        
HOUSE version of
GameEngineCallback.bustCard(Player, PlayingCard, GameEngine)
        houseResult(int, GameEngine) - Method in interface view.interfaces.GameEngineCallback
        
called when the HOUSE has bust with final result (result is score prior to the last card
that caused the bust)

PRE-CONDITION: This method should only be called AFTER bets have been updated on all Players
so this callback can log Player results

Called from dealHouse(int)
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-7.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
M
        model.interfaces - package model.interfaces
         
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-8.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
N
        nextCard(Player, PlayingCard, GameEngine) - Method in interface view.interfaces.GameEngineCallback
        
called for each card as the house is dealing to a Player, use this to
update your display for each card or log to console
        nextHouseCard(PlayingCard, GameEngine) - Method in interface view.interfaces.GameEngineCallback
        
called as the house is dealing their own hand, use this to update you
display for each card or log to console
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index-files/index-9.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
A B D E G H M N P R S T V 
P
        placeBet(Player, int) - Method in interface model.interfaces.GameEngine
        
the implementation should forward the call to the Player class to handle
        placeBet(int) - Method in interface model.interfaces.Playe
         
        Player - Interface in model.interfaces
        
Assignment interface for SADI representing the playe
to be implemented by SimplePlayer class with the following constructor:
public SimplePlayer(String playerId, String playerName, int initialPoints)

NOTE: playerID is unique and if another player with same id is added it replaces the previous playe
        PlayingCard - Interface in model.interfaces
        
Assignment interface for SADI representing a PlayingCard

(setting values is handled by the implementing class constructor(s))
        PlayingCard.Suit - Enum in model.interfaces
         
        PlayingCard.Value - Enum in model.interfaces
         
A B D E G H M N P R S T V 
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Lette
        Next Lette
        Frames
        No Frames
        All Classes
CardGame/docs/index.html
CardGame/docs/model/interfaces/class-use/GameEngine.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Uses of Interface
model.interfaces.GameEngine
        
Packages that use GameEngine         Package        Description
        view.interfaces         
        
        
Uses of GameEngine in view.interfaces
Methods in view.interfaces with parameters of type GameEngine         Modifier and Type        Method and Description
        void        GameEngineCallback.bustCard(Player player,
PlayingCard card,
GameEngine engine)
called when the card causes the player to bust
this method is called instead of GameEngineCallback.nextCard(Player, PlayingCard, GameEngine)
this method is called before GameEngineCallback.result(Player, int, GameEngine)
use this to update your display for each card or log to console
        void        GameEngineCallback.houseBustCard(PlayingCard card,
GameEngine engine)
HOUSE version of
GameEngineCallback.bustCard(Player, PlayingCard, GameEngine)
        void        GameEngineCallback.houseResult(int result,
GameEngine engine)
called when the HOUSE has bust with final result (result is score prior to the last card
that caused the bust)

PRE-CONDITION: This method should only be called AFTER bets have been updated on all Players
so this callback can log Player results

Called from dealHouse(int)
        void        GameEngineCallback.nextCard(Player player,
PlayingCard card,
GameEngine engine)
called for each card as the house is dealing to a Player, use this to
update your display for each card or log to console
        void        GameEngineCallback.nextHouseCard(PlayingCard card,
GameEngine engine)
called as the house is dealing their own hand, use this to update you
display for each card or log to console
        void        GameEngineCallback.result(Player player,
int result,
GameEngine engine)
called when the player has bust with final result (result is score prio
to the last card that caused the bust)
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
CardGame/docs/model/interfaces/class-use/GameEngineCallback.html
JavaScript is disabled on your
owser.
Skip navigation links
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Uses of Interface
model.interfaces.GameEngineCallback
        
        
Uses of GameEngineCallback in model.interfaces
Methods in model.interfaces with parameters of type GameEngineCallback         Modifier and Type        Method and Description
        void        GameEngine.addGameEngineCallback(GameEngineCallback gameEngineCallback) 
        boolean        GameEngine.removeGameEngineCallback(GameEngineCallback gameEngineCallback) 
Skip navigation links
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
CardGame/docs/model/interfaces/class-use/Player.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Uses of Interface
model.interfaces.Playe
        
Packages that use Player         Package        Description
        model.interfaces         
        view.interfaces         
        
        
Uses of Player in model.interfaces
Methods in model.interfaces that return Player         Modifier and Type        Method and Description
        Player        GameEngine.getPlayer(java.lang.String id) 
Methods in model.interfaces that return types with arguments of type Player         Modifier and Type        Method and Description
        java.util.Collection        GameEngine.getAllPlayers() 
Methods in model.interfaces with parameters of type Player         Modifier and Type        Method and Description
        void        GameEngine.addPlayer(Player player) 
        void        GameEngine.dealPlayer(Player player,
int delay)
Deal cards to the player, increments of delay are in milliseconds (ms)

1.
        boolean        GameEngine.placeBet(Player player,
int bet)
the implementation should forward the call to the Player class to handle
        boolean        GameEngine.removePlayer(Player player) 
        
Uses of Player in view.interfaces
Methods in view.interfaces with parameters of type Player         Modifier and Type        Method and Description
        void        GameEngineCallback.bustCard(Player player,
PlayingCard card,
GameEngine engine)
called when the card causes the player to bust
this method is called instead of GameEngineCallback.nextCard(Player, PlayingCard, GameEngine)
this method is called before GameEngineCallback.result(Player, int, GameEngine)
use this to update your display for each card or log to console
        void        GameEngineCallback.nextCard(Player player,
PlayingCard card,
GameEngine engine)
called for each card as the house is dealing to a Player, use this to
update your display for each card or log to console
        void        GameEngineCallback.result(Player player,
int result,
GameEngine engine)
called when the player has bust with final result (result is score prio
to the last card that caused the bust)
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
CardGame/docs/model/interfaces/class-use/PlayingCard.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Uses of Interface
model.interfaces.PlayingCard
        
Packages that use PlayingCard         Package        Description
        model.interfaces         
        view.interfaces         
        
        
Uses of PlayingCard in model.interfaces
Methods in model.interfaces that return types with arguments of type PlayingCard         Modifier and Type        Method and Description
        java.util.Deque        GameEngine.getShuffledDeck()
A debug method to return a deck of cards containing 52 unique cards in
random/shuffled orde
Methods in model.interfaces with parameters of type PlayingCard         Modifier and Type        Method and Description
        boolean        PlayingCard.equals(PlayingCard card) 
        
Uses of PlayingCard in view.interfaces
Methods in view.interfaces with parameters of type PlayingCard         Modifier and Type        Method and Description
        void        GameEngineCallback.bustCard(Player player,
PlayingCard card,
GameEngine engine)
called when the card causes the player to bust
this method is called instead of GameEngineCallback.nextCard(Player, PlayingCard, GameEngine)
this method is called before GameEngineCallback.result(Player, int, GameEngine)
use this to update your display for each card or log to console
        void        GameEngineCallback.houseBustCard(PlayingCard card,
GameEngine engine)
HOUSE version of
GameEngineCallback.bustCard(Player, PlayingCard, GameEngine)
        void        GameEngineCallback.nextCard(Player player,
PlayingCard card,
GameEngine engine)
called for each card as the house is dealing to a Player, use this to
update your display for each card or log to console
        void        GameEngineCallback.nextHouseCard(PlayingCard card,
GameEngine engine)
called as the house is dealing their own hand, use this to update you
display for each card or log to console
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
CardGame/docs/model/interfaces/class-use/PlayingCard.Suit.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Uses of Class
model.interfaces.PlayingCard.Suit
        
Packages that use PlayingCard.Suit         Package        Description
        model.interfaces         
        
        
Uses of PlayingCard.Suit in model.interfaces
Methods in model.interfaces that return PlayingCard.Suit         Modifier and Type        Method and Description
        PlayingCard.Suit        PlayingCard.getSuit() 
        static PlayingCard.Suit        PlayingCard.Suit.valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
        static PlayingCard.Suit[]        PlayingCard.Suit.values()
Returns an a
ay containing the constants of this enum type, in
the order they are declared.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
CardGame/docs/model/interfaces/class-use/PlayingCard.Value.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Uses of Class
model.interfaces.PlayingCard.Value
        
Packages that use PlayingCard.Value         Package        Description
        model.interfaces         
        
        
Uses of PlayingCard.Value in model.interfaces
Methods in model.interfaces that return PlayingCard.Value         Modifier and Type        Method and Description
        PlayingCard.Value        PlayingCard.getValue() 
        static PlayingCard.Value        PlayingCard.Value.valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
        static PlayingCard.Value[]        PlayingCard.Value.values()
Returns an a
ay containing the constants of this enum type, in
the order they are declared.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
CardGame/docs/model/interfaces/GameEngine.html
JavaScript is disabled on your
owser.
Skip navigation links
        Overview
        Package
        Class
        Use
        Tree
        Deprecated
        Index
        Help
        Prev Class
        Next Class
        Frames
        No Frames
        All Classes
        Summary: 
        Nested | 
        Field | 
        Constr | 
        Method
        Detail: 
        Field | 
        Constr | 
        Method
model.interfaces
Interface GameEngine
        
public interface GameEngine
Assignment interface for SADI providing main Card Game model functionality
        Author:
        Caspar Ryan
        
        
Field Summary
Fields         Modifier and Type        Field and Description
        static int        BUST_LEVEL 
        
Method Summary
All Methods Instance Methods Abstract Methods         Modifier and Type        Method and Description
        void        addGameEngineCallback(GameEngineCallback gameEngineCallback) 
        void        addPlayer(Player player) 
        void        dealHouse(int delay)
Same as dealPlayer() but deals for the house and calls the house versions
of the callback methods on GameEngineCallback, no player parameter is
required

After the house deal has finished but BEFORE calling houseResult() win/loss values
are applied to all players based on their bet
        void        dealPlayer(Player player,
int delay)
Deal cards to the player, increments of delay are in milliseconds (ms)

1.
        java.util.Collection        getAllPlayers() 
        Player        getPlayer(java.lang.String id) 
        java.util.Deque        getShuffledDeck()
A debug method to return a deck of cards containing 52 unique cards in
random/shuffled orde
        boolean        placeBet(Player player,
int bet)
the implementation should forward the call to the Player class to handle
        boolean        removeGameEngineCallback(GameEngineCallback gameEngineCallback) 
        boolean        removePlayer(Player player) 
        
        
Field Detail
        
BUST_LEVEL
static final int BUST_LEVEL
        See Also:
        Constant Field Values
        
Method Detail
        
dealPlaye
void dealPlayer(Player player,
int delay)
Deal cards to the player, increments of delay are in milliseconds (ms)

1. deal a card to the playe
2. call GameEngineCallback.nextCard(...)
3. continue looping until the player busts
(default value of GameEngine.BUST_TOTAL=21)
4. GameEngineCallback.bustCard(...)
5. call GameEngineCallback.result(Player, int, GameEngine)
with final result for player (the pre bust total)
6. update the player with final result so it can be retrieved late
        Parameters:
        player - the cu
ent player who will have their result set at the end
of the hand
        delay - the delay between cards being dealt
        See Also:
        GameEngineCallback
        
dealHouse
void dealHouse(int delay)
Same as dealPlayer() but deals for the house and calls the house versions
of the callback methods on GameEngineCallback, no player parameter is
required

After the house deal has finished but BEFORE calling houseResult() win/loss values
are applied to all players based on their bet
        Parameters:
        delay - the delay between cards being dealt
        See Also:
        GameEngineCallback,
dealPlayer(Player,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here