2 player, Blackjack any suggestions?helppp

ive been designing my program of BlackJack, everything coding wise i know how to do it and have a layout of it. what im stuck on is coding 2 players into my program and ive ran out of ideas. the problem is i cant hardcode that Player 1 goes, then Player 2 where they are alternating turns. like a real game of blackjack Player 2 can only go when Player 1 chooses to Stay.
so that means Player 1 can take as many turns until the user selects Stay. then Player 2 goes. and to be fair i also have to alternate who goes first. so if Player 1 went first on the first game. when a new game is selected Player 2 goes first on the second game.
i thought about creating a Player class, a variable where it keeps track of the Player, but it seems like im off track. any suggestions to point me to the right direction.
Thanks in advance!.

hey warner, your example seems like it will alternate
consistently all the time. thanks for the example.
btw with the while(true) it should be the same if i
did this correct?
int playerNum = 1;
boolean flag = false;
while (!flag)
doSomethingWithPlayer(playerNum);
playerNum = 1 - playerNum; // 1 becomes 0, 0 becomes
1...
flag=true;
Well, it should be clear that if you code up a loop like that, it will only execute once, so the while(!flag) would be pointless. I suppose you just want to make the loop exit condition based on something (other than 'true'), but that was not what was asked - I just pointed out how you can alternate numbers.

Similar Messages

  • I recently tried to import 2 CDs but on one, only the first 4 songs imported and on the second, only the first 6 imported.  The CDs work fine in a CD player.  Any suggestions?

    I recently tried to import 2 CDs but on one, only the first 4 songs imported and on the other, only the first 6 songs imported.  The CDs work fine in a CD player.  Any suggestions?

    Rip the CDs with another program on your computer, and add the resulting MP3s to your iTunes library.  (If you use Windows Media Player for this purpose, make sure the Rip Setting is on MP3, or else it will default to a useless format known as WMA.)

  • OS X 10.6.8 and missing plugin for videos despite latest version of Adobe flash player. Any suggestions please?

    I have OS X 10.6.8. Despite downloaded latest version of Adobe flash player and VLC 2.0.4 I`m in trouble with `missing plugin` for videos. Any suggestion please?

    Uninstall old Flash plugins then reinstall new ...
    Uninstall > Troubleshoot Flash Player | Mac OS
    Very important uninstall the old one first.
    Then reinstall >  http://get.adobe.com/flashplayer/?promoid=JZEFT

  • My iPod classic wont connect to the computer. The light comes on but it doesn't even come up with 'connected' screen. Have tried everything on apple troubleshoot but hasn't helped. Still works in Logitech iPod player. Any suggestions please???

    My iPod classic wont connect to the computer. The light comes on but it doesn't even come up with 'connected' screen on the ipod. Have tried different computers, usb cables and ports, as well as restarting computer, updating itunes, and rebooting ipod. Still works in Logitech iPod player, however it has just wiped itself of all songs so at the moment I'm stuck with a useless iPod. Any suggestions please???

    If you happen to have a USB docking cable that is new (or close to being new), try using that one.  If the cause is the dock connector on the iPod becoming worn, if you try it with a cable that is not worn, it's possible that it may connect for data.
    I believe the dock connector is internally part of the logic board, so it may not be economical to have a repair shop (including Apple Store Genius Bar) do the repair.  You'll need to ask for pricing. 
    If you are good at such things, this web site has DIY repair guides
    http://www.ifixit.com/Device/iPod_Original
    If it's the most recent iPod classic, it appears to be quite difficult to pry open.  I have an older 4th gen (and 3rd gen) "classic" iPod, and those are fairly eash to pry open, using the plastic tools.

  • I am trying to burn DVDs from iPhoto slideshows.  My pictures number in the hundreds and we know that iPhoto captures 99 and then "starts over".  This plays fine from the Mac Book but glitches arise on the DVD when playing it on a DVD player.  Any suggsts

    I am trying to burn DVDs from iPhoto slideshows.  My pictures number in the hundreds and we know that iPhoto captures 99 and then "starts over".  This plays fine from the Mac Book but glitches arise on the DVD when playing it on a DVD player.  Any suggestions on how to overcome the 99 "Chapter limitation" that IPhoto has?  Has anyone heard or tried an app called Vilisoft?  I read good things but I am not sure if it will do what I want.
    Jim

    Then use multipel 99 picture slideshows. 
    You can have up to 8 or 9 slideshows per menu.  If you add a sub menu reduce that by 1 and add 8 more to the sub menu.  The top menu can have links to up to 8 or so submenus (depends on the theme) and each submenu can have up to 8 or so slideshows. 
    However, converting a very large slideshow to a QT movie as Terence suggested does not envoke the 99 slide limit in iDVD.  It just becomes a single video/movie file.  So you should not have a problem with exporting at the large size, 720 x 540,
    and dragging the resulting file into the iDVD menu being sure to avoid any drop zones.
    OT

  • Unable to install Adobe Flash Player in iMAC with OS X10.7.2 Any suggestions?

    Unable to install Adobe Flash Player iniMAC with OS X 10.7.2 Lion. Any suggestions?

    I have administrative prviledges.
    I obtained the latest version from the Adobe website.
    When I double click on the .dmg file I receive a message that I need to close open browsers which I do.
    Then I get a message stating that Adobe will be installed when I reopen browers.
    Finally when I check the Applications folder I find a file titled: Install Adobe Flash Player.
    This same application is shown in the dock.
    When I click in the file in either the Applications folder or the dock, the complete installation process starts again.
    Any suggestions?

  • TS1702 ?Some of my applications have been saying I need the latest version of Adoebe Flash Player.  When I try to download it I get the following error message:  'Frame Load interrupted' and the installation stops.  Any suggestions

    Some of my applications have been saying I need the latest version of Adoebe Flash Player.  When I try to download it I get the following error message:  'Frame Load interrupted' and the installation stops.  Any suggestions?

    You can only use apps downloaded from the App store, not via a browser. There is no Flash for any iOS device including the iPod.

  • Photoshop elements 10 will not migrate to my new macbook pro/retina display.  There is no CD/DVD player on this machine.  Any suggestions on how to get Elements onto my machine?  Yes, I have the disk(s).

    Photoshop elements 10 will not migrate to my new macbook pro/retina display.  There is no CD/DVD player on this machine.  Any suggestions on how to get Elements onto my machine?  Yes, I have the disk(s).  Am I going to have to buy an external CD/DVD player to load this one program:(

    I have ordered a USB3 BluRay/DVD/CD player/burner and will use that both with my iMac ( in which the Superdrive seems to be failing ) and the MBPro Retina I just bought .

  • I want to get an external blu ray player/burner. Any suggestions?

    I want to purchase a blu ray player/burner for my Macbook Pro laptop. Any suggestions?

    https://discussions.apple.com/docs/DOC-2881

  • I can't open wmv files with Lion.  Windows media player doesn't work.  Any suggestions?

    Unable to open wmv files using Lion.  Windows media player doesn't work.  Are there any suggestions.
    Thanks

    Lynnie Marie  ---
    macfriedchikkin's reply would make sense to you if you were trying to open a camera, but if you are trying to view streming media from a web site that is a different story. It helps to be very specific about what you are tyring to do on these forums.
    I belive you would go into Firefox Preferences menu and tell it  to use VLC as the application to play WMV files. I'm still running Tiger,  however, so I can't tell you if it the latest version works wel that way. The Tiger version doesn't seem to, but a lot may have changed since then. (I'm only just getting around to installing Leopard next week now that there are too may apps I can't run on Tiger. ) Perhaps someone else on this forum can better help you set  up the player in your browser.
    Or you can cut out the middleman and give VLC the direct video URL:
    Choose Open File from the File menu and paste in the URL of the video, say,
    http://azul.streamguys.com/auduboncal-1
    or http://azul.streamguys.com/auduboncal-2
    Your media should play this way. Dont forget to save the playlist for later.
    I'l keep investigating on my end, and yes, I'm also  encouraging certain people who are streaming windows media in to switching to a different format
    Best --
    G

  • I am trying to play some videos from the internet and I get the message missing plug in.  I click on "missing plug in" and download adobe flash player.   When i try to log in again to play videos, I still get the message missing plug in.  Any suggestions?

    I am trying to play some videos from the internet and I get the message "missing plug in".  I click on the message and downlaod adobe flash player as prompted.   When I log in again to play the videos,  I still get the missing plug in message.  Any suggestions??

    that used to happen to me all the time! I would recommend going to a different sight or attempting to download it again ( you may have missed a step it can be tricky).

  • I am trying to download Adobe Flash Player but it won't download, are there any suggestions?

    I am trying to download Adobe Flash Player but it won't download, are there any suggestions?

    What is your operating system, version & edition?
    What is your browser, version & edition?
    Can you try downloading the full installer(s) for your environment from http://forums.adobe.com/thread/909550 ?

  • I have been noticing videos on hulu, youtube and even itunes have been downloading slow and pausing in the middle of watching them. Does anyone have any suggestions on what I should do? Someone told me its my media player, but I am not sure what to do.

    I have been noticing videos on hulu, youtube and even itunes have been downloading slow and pausing in the middle of watching them. Does anyone have any suggestions on what I should do? Someone told me its my media player, but I am not very good at computers and don't want to download the wrong thing.

    I have been noticing videos on hulu, youtube and even itunes have been downloading slow and pausing in the middle of watching them. Does anyone have any suggestions on what I should do? Someone told me its my media player, but I am not very good at computers and don't want to download the wrong thing.

  • Installed and verifed but Flash Player continues to crash in Firefox.  Any suggestions

    Flash Player sometime activates and then crashes after a few seconds.

    Thanks for responding Chris.  Flash Player consistently crashes no matter what site I am in.  I've tried all of the suggested fixes in Flash Player help and nothing has been successful. The computer confirms that I have downloaded the most recent file but Adobe Flash Player doesn't show in the Firfox Add Ons.  I also tried Firefox flash player suggestions but none worked.  It crashes no matter what page I am on.  If flash player is required, it crashes.  It also crashes in Internet Explorer.  I am a novice so please bear with me.  Thanks for any help you can offer.
    Jim
          From: chris.campbell <[email protected]>
    To: Jim Jones <[email protected]>
    Sent: Monday, March 16, 2015 4:26 PM
    Subject:  Installed and verifed but Flash Player continues to crash in Firefox.  Any suggestions
    Installed and verifed but Flash Player continues to crash in Firefox.  Any suggestions
    created by chris.campbell in Using Flash Player - View the full discussionHello,I'm sorry you're encountering these problems.  I'll try what I can to help. 1. Have you tried any browser other than Firefox?  It would be helpful to know if these same types of crashes occur with Internet Explorer or Google Chrome.2. Did this crashing behavior just start occurring?  If so, was there a particular update or event that preceded the crashing?3. Does the crashing happen consistently?  Ie. If you go to the same web page that contains Flash content, does it crash every time you visit?  Does it crash when you visit this page?  Flash Player Help  What pages does it crash on?4. Can you visit about:crashes within Firefox and submit some of the most recent crashes.  Once submitted, please post back with the crash URL's.4. Can you try resetting your Firefox profile?  Refresh Firefox - reset add-ons and settings
    Firefox Help5. Finally, can you try temporarily disabling protected mode to see if that makes a difference (this will be the last step in the faq)?  How do I troubleshoot Flash Player's protected mode for Firefox? Thanks,
    Chris If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7304505#7304505 and clicking ‘Correct’ below the answer Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7304505#7304505 To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"  Start a new discussion in Using Flash Player by email or at Adobe Community For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • Videos on Flash Player are stuttering. Any suggestions?

    Videos started stuttering two days ago. I am using Firefox 28. OS X 10.9.2. I updated my Flash Player software today and it hasn't fixed it. Any suggestions?

    gtoddm wrote:
    Videos started stuttering two days ago. I am using Firefox 28. OS X 10.9.2. I updated my Flash Player software today and it hasn't fixed it. Any suggestions?
    If they started stuttering two days ago and you updated today... what makes you think it's a problem with the update?
    I'm not being a smart aleck, but the problem started before the update, so it's most liekly something else.
    You may need to hard cycle your modem and/or router.
    You may want to try resetting Firefox. https://support.mozilla.org/en-US/kb/reset-firefox-easily-fix-most-problems
    My Mini has been running  the 13 beta, and I have no problems with videos. I did... about a month ago , but a Firefox reset cured a number of ills.

Maybe you are looking for

  • IPhoto won't open after reinstall and upgrade to Lion.

    Oddly enough, my screensaver still sees all the photos in my library and the associated metadata.  iPhoto won't open though.  Attached is the error log: Process:         iPhoto [3089] Path:            /Applications/iPhoto.app/Contents/MacOS/iPhoto Id

  • Can rfbibloo program be used

    Hi, The issue is, GL's are already existing in database...n i need to insert opening balance say rs. xyz for specific GL.Is that possible.using RFBIBLOO program.. Can any one help me by sending step by step procedure for it..Coz i have never workd wi

  • Is SCVMM part of SCCM 2012 R2 package?

    I understand their two different products, i was wondering do we get another tab in SCCM where we can merge SCVMM after installation? if not, can SCVMM be installed on the SCCM server? is this best practice? and lastly does SCVMM uses SQL to store an

  • Failure report

    Ok, so I've had this problem in a while now. Here's the deal: When i try to open iTunes (on Windows XP Pro) it says something about sending a failure report. I've tried to re-install it many times, but it still won't open. Does anyone have any idea o

  • I just changed my number on line but my previous number is still showing on my phone and is active.  What do I need to do?

    I just changed my number on line but my previous number is still showing on my phone and is active.  What do I need to do? Thanks.