wiki:FAQ
Last modified 9 years ago Last modified on 04/04/11 15:33:59

Frequently Asked Questions

Assignment

Q: Are we keeping track of how much time we spend programming each module to determine if we stay within budget and schedule limits?

A: The main reason is so that students can get some data about their productivity so you can make better estimates for their real project. The team has a goal of keeping within a budget of 15 hours per person per week.

Q: I can't seem to build on Windows. I get this error trying to build the project with NetBeans.

 Poly\CSC308\Cheetah\CrazyEights\build.xml:78: Execute failed:
 java.io.IOException: Cannot run program "svnversion" (in directory

A: This is because you don't have Subversion installed on your workstation. If you install Subversion the problem goes away. It only takes two minutes, just download and do the install procedure.

Another solution is to install Linux. A simple easy way is with Wubi. http://wubi-installer.org/ It installs Ubuntu inside your Windows system, just as if it were another application. Then when you boot you can choose Windows or Ubuntu. It's a simple, safe, low-commitment way to try out Linux.

Q: I'm trying to SVN update and Card.java is conflicted.

A: Most probably you did an Update and the file from the repository developed by your teammate conflicted with the file in which you did your own development.

  1. You'll probably want to archive your own version of Card.java. Use the file manager to copy Card.java.mine to some archival location.
  2. Issue Subversion > Revert on Card.java.
  3. Now the author shown on Card.java will be your teammate.
  4. Now you can continue developing the Deck class.

Q: When I tried to checkout our team repository I get this error message: "Error while performing action: '/var/home/john/NetBeansProjects/Bobcat' is already a working copy for a different URL"

A: Sometime in the past you probably made the mistake of checking out some other team (like Zebra) and put it in the directory you are trying to use now. Or perhaps just a different folder in the repository tree. Most likely the solution is to use a file manager (not RapidSVN) to delete the target folder. Then do the checkout again.

Q: Can I configure NetBeans checkstyle plugin for our class standards?

A: The Crazy Eights NetBeans project is distributed with the checkstyle configuration file containing our class coding style. It's located in nbproject/308style.xml

Similarly there is an instructor-provided jar file with custom check code, found in lib/308checks.jar

To setup your NetBeans installation, Choose Tools > Options > Miscellaneous > Checkstyle Under "Config File:" browse to your location of 308style.xml. Under "Classpath" Add JAR/ZIP and specify the location of 308checks.jar.

Requirements

Q: what does {card}52 mean?

A: Go to the "Deliverables" link on the course web site and look for "Data Dictionary Notation"

Q: what are person-hours?

A: one person working for one hours is one person-hour.

Q: How do we indicate the cards in the player's hand that are legal moves?

A: As shown in the prototype, playable cards are enabled, illegal cards are disabled (greyed-out).

Q: what is the point of suit chooser?

A: when the human plays an 8, they have to nominate a suit that the opponent must follow.

Q: Does the program actually have to be tested on all the listed platforms?

A: Not on the Crazy Eights project.

Q: How do we verify the performance requirements?

A: You don't have to on Crazy Eights. Later on the real project you will.

Q: The SRS says no user manual, but isn't the "How to Play" a user manual?

A: I define "how to play" as online help. I define a user manual as an external document.

Q: Where is it specified whether the program uses a random or preset deck?

A: Requirement #1 says "random". The "preset deck" feature is for developers, not the customer, so I didn't include it in the SRS. (You could argue that it should be there anyway ...)

Design and Implementation

Q: Is there something that lists the format for what an ActionEvent should look like in Crazy8s?

A: For example:

new ActionEvent(this, 0, "pass");

Q: Where can we learn about class diagrams?

A: On course web site, click "Deliverables" then "Software Design". There are several resources listed there.

Q: What do the arrows mean?

A: Arrow means dependency. Triangle means inheritance.

Q: Which class actually contains a player's hand?

A: Table

Q: for compareTo in the Card class, what is the ordering of the suits?

A: As defined in the Suit class.

Q: In design overview it says the game can be ported to Android by adding just one class. Can you explain?

A: Add another class, "AndroidPlayer" that implements the I_Viewer interface. This class has the Android specific GUI code

Q: For the Deck class, under the !makeDeckFromFile method, there is a part of your pseudocode that says to "Create a card from the line" that was read from the file. Given that files are in the form of one letter followed by one number, is there any specific construct you want us to use, or should we use something like a case statement (for the suit)? I may just be forgetting some java syntax to do this in one line, but I don't believe there is.

A: Use the valueOf() method in the Card class.

Q: in the !makeDeckFromFile method, there is a line in the pseudocode that reads "add the card to the deck" However, because the deck's actual arraylist containing the cards is private, and the deck class itself contains no method to add a card directly, I'm lost on how to accomplish this.

A: This is a static method. It is called a "factory" method because it returns an instance of the class Deck. So you need to construct the instance inside the method, and add cards to that instance.

Q: In the method makeDeckFromFile I'm supposed to check if a line is not ignorable. I was wondering what test I should do on the input line to determine whether or not it is ignorable.

A: A line is ignorable if it is completely blank or begins with a hash mark ('#').

Q: I was doing the Table.java and had a question regarding it. I see many pseudo code saying Indicate this observable has changed and notify observers. Does this mean we are supposed to use System.out.println to notify observers? And what do we need to print exactly? Since we are integrating with different parts I think there should be a common print out.

A: No printout. If you are not familiar with Java's Observable interface, you might read the Observer API, an article from JavaWorld, or a simple example. The short answer is:

 setChanged();
 notifyObservers();

In situations where you must notify observers of which player action just occurred:

 notifyObservers(PlayerAction.draw);

Q: Can you help me understand how to implement the following lines of pseudo code? They are both from the !actionPerformed method in the GameController class.

The first line is // extract the desired suit from the tail of the command from the suit case.

A: The desired suit is the last four characters of the command; I would just use the substring() method.

The second line is // parse the command string into an integer position in the hand from the play case.

A: Use Integer.parseInt()

Q: For the GameController class, are we supposed to run both GameContollerTest and GameControllerUnitTest?

A: Only the Unit Test.

Q: in the handlePass method, how should we test to see if all players have passed?

A: There's a declaration for passingPlayers. I would add a player to it when they pass. If the size of passingPlayers equals the number of players in the game, it's a draw.

Q: How do we test ConsolePlayer? How will we demonstrate it to you?

A: For unit testing, you can run ConsolePlayerDriver. It uses a FakeTable so you can't play a real game (read the class javadocs). But it will help you see if your ConsolePlayer implementation is printing the correct stuff to the screen. Run it as in the example below. As the human player, enter the move "C1" four times, then enter "q" for quit. Your ConsolePlayer output should be exactly like the output shown below.

$ ant -Djavac.includes=crazy8s/ConsolePlayerDriver.java -Drun.class=crazy8s/ConsolePlayerDriver run-single 
Buildfile: build.xml

compile-single:

run-single:
     [java] -------------- startGame
     [java] [C1, C2, C3, C4, C5, C6, S1]
     [java]    -null-   (0)
     [java] Play this suit: clubs
     [java] +C1+C2+C3+C4+C5+C6+S1
C1
     [java] ? [C1, C2, C3, C4, C5, C6]
     [java]    -null-   (0)
     [java] Play this suit: clubs
     [java] +C1+C2+C3+C4+C5+C6
     [java] [C1, C2, C3, C4, C5, C6]
     [java] [C1, C2, C3, C4, C5]
     [java]    -null-   (0)
     [java] Play this suit: clubs
     [java] +C1+C2+C3+C4+C5
C1
     [java] ? [C1, C2, C3, C4]
     [java]    -null-   (0)
     [java] Play this suit: clubs
     [java] +C1+C2+C3+C4
     [java] [C1, C2, C3, C4]
     [java] [C1, C2, C3]
     [java]    -null-   (0)
     [java] Play this suit: clubs
     [java] +C1+C2+C3
C1
     [java] ? [C1, C2]
     [java]    -null-   (0)
     [java] Play this suit: clubs
     [java] +C1+C2
     [java] [C1, C2]
     [java] [C1]
     [java]    -null-   (0)
     [java] Play this suit: clubs
     [java] +C1
C1
     [java] ? []
     [java]    -null-   (0)
     [java] Play this suit: clubs
     [java] 
     [java] -------------- game over
     [java] kHuman wins.
     [java] Game Over - You Win!
q
     [java] ? 

BUILD SUCCESSFUL
Total time: 15 seconds

Once ComputerPlayer is integrated, we can run the automated system tests on ConsolePlayer. In the build.xml, run the target "systest". ComputerPlayer needs to be finished before the system tests will pass.

Q: For the Computer Player class, how exactly do we "create" action events? I know that the "souce" should be "this" and the command should be "suit" but how do we implement the ID portion of the constructor?

A: it's irrelevant; you can use zero.

Q: I'm new to the !MVC model and was wondering if you can specify how this method should be written for ConsolePlayer.java:

public void setup()
{
// Call update to show the table display
}

A: update(null, null);

Q: I'm not sure if this was documented somewhere that I haven't found yet, but what protocol are we supposed to use for the !getMove() method in ConsolePlayer.java? That is, exactly what should the string look like that we return and consequently pass to GameController?

A: The pseudocode spells it out. Valid moves are:
a 2-char card name (e.g., "D2")
a suit name (when the player nominates a suit)
the character 'q' if the player wants to quit
the enter key (to accept the required action of draw or pass).

Q: In the pseudo code of ConsolePlayer.getMove() method its says // WHILE move is invalid LOOP however, there is no variable called move. So are we supposed to create one in getMove() or get it from !setVisible?

A: Correct, there's no move variable. Because that's the job of !getMove(), to obtain the move. "move is invalid" is a condition. I would suggest declaring a local boolean variable, initially false. Then as you go through the logic, if you get a valid move, set the flag to true.

Q: What if the move is for a card that is in the hand but not a valid move? I noticed that that the pseudo code does not address this, and during testing my code "discards" that card even though it is not playable. // IF hand contains the card THEN I suggest should be: // IF hand contains the card and the card is playable THEN Can I make that change?

A: No, don't change the logic of the method. I intentionally didn't check for playable card. The point is that ConsolePlayer is for system testing, it's not a production component of the application. System testers are supposed to be clever enough to not enter invalid data. So the logic for the class can assume a smart tester. That way there's less logic for us to implement.

Grading

Q: Are we graded as a team for the Crazy Eights project? A: No.

Q: If a student can't get their module to integrate, is the entire team penalized?

A: No.

Q: When collaborating to get a non-working component done on integration day, how much code sharing is allowed between group members?

A: None. Other people may help diagnose problems or suggest solutions but not share their code.

Q: What are the consequences for collaboration?

A: A zero on the project.