-
[java] blackjack problem
public class Game { /** Suggested constants for use throughout the game. To use one of these in another class, specify * the Game class first, e.g. Game.ACE_LOW_VALUE. */ public static final int ACE_LOW_VALUE = 1; // bottom value for ace public static final int ACE_HIGH_VALUE = 11; // top value for ace public static final int BLACKJACK = 21; // instant win - to go over is to lose public static final int DEALER_STOP = 17; // dealer cannot stand until at least this value /* Some suggested fields */ private Deck deck; // a deck of cards private InputReader reader; // keyboard reader private ArrayList<Card> hand; // the cards the player is holding /** * Constructor for objects of class Game */ public Game() { // initialize fields deck = new Deck(); reader = new InputReader(); hand = new ArrayList<Card>(); } /** * This method holds the game logic. The user is repeatedly * prompted to play another round. When the user has chosen to stop * playing, the final tally of wins and losses is reported. * */ public void play() { dealCard(); dealCard(); dealCard(); showHand(); } /* * Deal one card from the deck and put it into the player's hand. */ private void dealCard() { // deal card to player hand.add (deck.takeCard()); } /* * Play out the player's turn. * The player may choose to hit or stand, unless the player's * cards total more than BLACKJACK, in which case the player * is "busted". */ public void playerTurn() { // player's turn // an example of how to use the reader object: System.out.print("Your choice: hit or stand? "); String response = reader.readInputLine().trim().toLowerCase(); if (response.equals("hit")) {// process response } } /* * Calculates and returns the value of the hand. An ace is worth ACE_HIGH_VALUE * unless it would cause a "bust", in which case it is worth ACE_LOW_VALUE. */ public int getHandValue() { // calculate hand value int sum = 0; Iterator<Card> it = hand.iterator(); while (it.hasNext()) { for (Card card: hand) { int handValue = card.getValue(); sum += handValue; handValue++; return sum; } } return 0; } /* * Shows the cards in the player's hand. */ private void showHand() { System.out.println("your cards:"); // show the cards for(Card card : hand) { System.out.println(""+card.toString()); } System.out.println(); // blank line } } Card is a class. hand is an arraylist of Card. the problem is that return 10. why? when i invoked play(), it should return 30. but it return as 10. i think hardest.
-
the sharing printer problem
1. yes 2. No 3. No, there is not any. 4.remote/network
-
the sharing printer problem
no one replies?
-
the sharing printer problem
A-COMPUTER (with hp officejet v40 printer, Windows XP SP2) B-NOTEBOOK (Windows Vista Home Premium) I want to share the printer of A to B, the B installed the sharing printer and setup one. However, it can print out within A, but it can't print out when B wants to print. What is wrong with that?
-
hot fix problems...
Wait, do you mean you do not know how to download that? http://www.microsoft.com/downloads/details...E4-6B57EF57EF64
-
HOTFIXES: Windows XP SP2 & Windows 2000 SP4
KB912945 -› Internet Explorer ActiveX update Download -› 4.77MB (February 10, 2006) Switches: KB912945.exe /q /n /z (RyanVM warns that people don't integrate to your Windows XP installation. However, I have not tested it by using the [GuiRunOnce] of Winnt.sif.) There is no downloading link of KB892130.
-
KB911564
You can install that update by using the [GuiRunOnce] section of winnt.sif. the update will be installed on the first logon after installing windows.
-
HOTFIXES: Windows XP SP2 & Windows 2000 SP4
Ryan, have you tested to apply this update when it is first logon after installation of Windows? I mean, use the [GuiRunOnce] of winnt.sif and don't use the integration.
-
HOTFIXES: Windows XP SP2 & Windows 2000 SP4
Microsoft public the info to let the adminstrator or manager on Thurs before patch day. Microsoft public the info of the patches on 11:00 of pacific time on patch day.
-
HOTFIXES: Windows XP SP2 & Windows 2000 SP4
There is a new non-critical hotfix... KB896344(v2) You cannot transfer files and settings from a computer that is running a 32-bit edition of Windows XP to a computer that is running Windows XP Professional x64 Edition 1.26MB http://www.microsoft.com/downloads/info.as...isplayLang%3den I don't know..because it is in Optional software updates of Windows Update v6
-
Lang Folder
The guide says I can delete the LANG folder, but I can't. I need them to read a Traditional Chinese. why? because I am a Taiwanese.
-
HOTFIXES: Windows XP SP2 & Windows 2000 SP4
@argon007KB885884 is just a contextual update , only for the Office XP funs . so not everybody need it . <{POST_SNAPBACK}> Yeah, i know. it is for Office XP only. However, I recommended this hotfix to be added to RyanVM's Pack.
-
HOTFIXES: Windows XP SP2 & Windows 2000 SP4
To Ryan, When I install your pack to my windows xp, Windows Update still have one update to want me to install. KB885884
-
Microsoft Plus! for Windows XP
Wow, you reply so fast.. thanks a lot...
-
Microsoft Plus! for Windows XP
Echo Installing Microsoft Plus! for Windows XP Start /wait Plus!\Microsoft Plus! for Windows XP.msi /qb The problem is that: 1. The space can not be recognized in Command Prompt. 2. If I rename it to remove the space, there will be an error. so, how to install it sliently? Thanks.