Problems with network Checkers Game

HI all. I have a checkers game. But i can't create a network.
Here is my work :
Server:
http://www.filefactory.com/file/agg5a77/n/Checkers_java
Client:
http://www.filefactory.com/file/agg5a78/n/client_java
Can anybody help? =)

I'm sorry for spam. Didn't think that was spam.
Here server's part:
public class Checkers extends JPanel {
   public static void main(String[] args) {
       ServerSocket s = new ServerSocket(1989);
       while(true)
       { Socket ss=s.accept();
         ObjectInputStream in = new ObjectInputStream(ss.getInputStream());
         ObjectOutputStream out = new ObjectOutputStream(raul.getOutputStream());
        JFrame window = new JFrame("Checkers");
        Checkers content = new Checkers();
        window.setContentPane(content);
        window.setSize(500,500);
        window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        window.setResizable(false); 
        window.setVisible(true);
   }------------------------------------------------------- Here are nested class CheckersMove.
private static class CheckersMove {
      int fromRow, fromCol; 
      int toRow, toCol;    
      CheckersMove(int r1, int c1, int r2, int c2) {
         fromRow = r1;
         fromCol = c1;
         toRow = r2;
         toCol = c2;
private static class CheckersData {
void makeMove(CheckersMove move) {
         makeMove(move.fromRow, move.fromCol, move.toRow, move.toCol);
       * Make the move from (fromRow,fromCol) to (toRow,toCol).  It is
       * assumed that this move is legal.  If the move is a jump, the
       * jumped piece is removed from the board.  If a piece moves
       * the last row on the opponent's side of the board, the
       * piece becomes a king.
      void makeMove(int fromRow, int fromCol, int toRow, int toCol) {
         board[toRow][toCol] = board[fromRow][fromCol];
         board[fromRow][fromCol] = EMPTY;
         if (fromRow - toRow == 2 || fromRow - toRow == -2) {
            // The move is a jump.  Remove the jumped piece from the board.
            int jumpRow = (fromRow + toRow) / 2;  // Row of the jumped piece.
            int jumpCol = (fromCol + toCol) / 2;  // Column of the jumped piece.
            board[jumpRow][jumpCol] = EMPTY;
         if (toRow == 0 && board[toRow][toCol] == RED)
            board[toRow][toCol] = RED_KING;
         if (toRow == 7 && board[toRow][toCol] == BLACK)
            board[toRow][toCol] = BLACK_KING;
       * Return an array containing all the legal CheckersMoves
       * for the specfied player on the current board.  If the player
       * has no legal moves, null is returned. 
      CheckersMove[] getLegalMoves(int player) {
         if (player != RED && player != BLACK)
            return null;
         int playerKing;  // The constant representing a King belonging to player.
         if (player == RED)
            playerKing = RED_KING;
         else
            playerKing = BLACK_KING;
         ArrayList<CheckersMove> moves = new ArrayList<CheckersMove>();  // Moves will be stored in this list.
         /*  First, check for any possible jumps. 
         for (int row = 0; row < 8; row++) {
            for (int col = 0; col < 8; col++) {
               if (board[row][col] == player || board[row][col] == playerKing) {
                  if (canJump(player, row, col, row+1, col+1, row+2, col+2))
                     moves.add(new CheckersMove(row, col, row+2, col+2));
                  if (canJump(player, row, col, row-1, col+1, row-2, col+2))
                     moves.add(new CheckersMove(row, col, row-2, col+2));
                  if (canJump(player, row, col, row+1, col-1, row+2, col-2))
                     moves.add(new CheckersMove(row, col, row+2, col-2));
                  if (canJump(player, row, col, row-1, col-1, row-2, col-2))
                     moves.add(new CheckersMove(row, col, row-2, col-2));
         /*  If any jump moves were found, then the user must jump, so we don't
          add any regular moves.  However, if no jumps were found, check for
          any legal regualar moves.
         if (moves.size() == 0) {
            for (int row = 0; row < 8; row++) {
               for (int col = 0; col < 8; col++) {
                  if (board[row][col] == player || board[row][col] == playerKing) {
                     if (canMove(player,row,col,row+1,col+1))
                        moves.add(new CheckersMove(row,col,row+1,col+1));
                     if (canMove(player,row,col,row-1,col+1))
                        moves.add(new CheckersMove(row,col,row-1,col+1));
                     if (canMove(player,row,col,row+1,col-1))
                        moves.add(new CheckersMove(row,col,row+1,col-1));
                     if (canMove(player,row,col,row-1,col-1))
                        moves.add(new CheckersMove(row,col,row-1,col-1));
         /* If no legal moves have been found, return null.  Otherwise, create
          an array just big enough to hold all the legal moves, copy the
          legal moves from the ArrayList into the array, and return the array. */
         if (moves.size() == 0)
            return null;
         else {
            CheckersMove[] moveArray = new CheckersMove[moves.size()];
            for (int i = 0; i < moves.size(); i++)
               moveArray[i] = moves.get(i);
            return moveArray;
      }  // end getLegalMoves
       * Return a list of the legal jumps that the specified player can
       * make starting from the specified row and column.
      CheckersMove[] getLegalJumpsFrom(int player, int row, int col) {
         if (player != RED && player != BLACK)
            return null;
         int playerKing;  // The constant representing a King belonging to player.
         if (player == RED)
            playerKing = RED_KING;
         else
            playerKing = BLACK_KING;
         ArrayList<CheckersMove> moves = new ArrayList<CheckersMove>();  // The legal jumps will be stored in this list.
         if (board[row][col] == player || board[row][col] == playerKing) {
            if (canJump(player, row, col, row+1, col+1, row+2, col+2))
               moves.add(new CheckersMove(row, col, row+2, col+2));
            if (canJump(player, row, col, row-1, col+1, row-2, col+2))
               moves.add(new CheckersMove(row, col, row-2, col+2));
            if (canJump(player, row, col, row+1, col-1, row+2, col-2))
               moves.add(new CheckersMove(row, col, row+2, col-2));
            if (canJump(player, row, col, row-1, col-1, row-2, col-2))
               moves.add(new CheckersMove(row, col, row-2, col-2));
         if (moves.size() == 0)
            return null;
         else {
            CheckersMove[] moveArray = new CheckersMove[moves.size()];
            for (int i = 0; i < moves.size(); i++)
               moveArray[i] = moves.get(i);
            return moveArray;
      }  // end getLegalMovesFrom()Edited by: Java-Maker on May 10, 2009 9:10 AM

Similar Messages

  • The PyramidVille game in Facebook is not loading.I have no problems with the other games.I'm receiving the message" Forbidden 403" CSRF Verification failed.Request aborted. More information is available with Debug= True

    The PyramidVille game in Facebook is not loading.I have no problems with the other games.I'm receiving the message" Forbidden 403" CSRF Verification failed.Request aborted. More information is available with Debug= True edit

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    * Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove the Cookies" from sites causing problems:
    * Tools > Options > Privacy > Cookies: "Show Cookies"
    Reload web page(s) and bypass the cache.
    * Press and hold Shift and left-click the Reload button.
    * Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    * Press "Cmd + Shift + R" (MAC)

  • Problem with network on Iphone 4

    Please tell me if someone has a problem with network on Iphone 4?

    Of course other people have had problems. However, just knowing that other people have had some vague, undefined "network problems" most likely isn't going to be very useful. You'll get more and better help if you can give some details about your specific problem. Include who your carrier is, what country you're in. Then describe the exact nature of the problem. Then, maybe someone will be able to give good suggestions.
    And, by the way, the free bumper program ended some time ago. It also was only a "solution" for one of many possible problems.
    Best of luck.

  • I have problem with buying in games , I got the massage that the purchased can not be completed , please contact iTunes support.. I need help for my case please

    I have problem with buying in games , I got the massage that the purchased can not be completed , please contact iTunes support.. I need help for my case please

    http://www.apple.com/support/itunes/contact/

  • Since I upgrade my iphone 3gs to ios 5.1, I have several problems with network and wi-fi, any solution?

    Since I upgrade my iphone 3gs to ios 5.1, I have several problems with network and wi-fi, any solution? (No jailbreak)
    Most of the time the iphone cannot reach any network and when it can, there is no data transfer, I can only make calls and sms.

    Skizofrenias wrote:
    Since I upgrade my iphone 3gs to ios 5.1, I have several problems with network and wi-fi, any solution? (No jailbreak)
    Most of the time the iphone cannot reach any network and when it can, there is no data transfer, I can only make calls and sms.
    iOS: Troubleshooting Wi-Fi networks and connections
    iOS: Wi-Fi or Bluetooth settings grayed out or dim

  • Facing problems with network due which the phone goes into hangs status

    Facing problems with network due which the phone goes into hangs status.  some one help me with switching between 2g and 3G network

    Hi Mani Nair,
    I apologize, I'm a bit unclear on the exact nature of the issue you are describing. If you are talking about having issues with a 3G cellular data network, you may find the troubleshooting steps outlined in the following article helpful:
    iPhone cellular data connection issues
    Regards,
    - Brenden

  • SAP Screen Personas error "A problem with network connectivity has been detected"

    Hi,
    We just installed Personas release 100 SP02 and performed the
    configuration steps necessary. But when we acces the url and logon to
    personas we get the following erre
    A problem with network connectivity has been detected.
    Please check you connection and refresh your browser.
    Any help to solve this issue would be appreciated.
    Best Regards.

    Please use this checklist to see if everything is correct:
    1. restgui service handler class has CL_HTTP_EXT_ITS_BASIC
    2. SPRO -> Sap screen Personas -> Maintain system has
           - 3 letter system id
           - "Server.Url" without typo and value in http(s)://<SERVER>:<PORT>/ format 
           - "Service.Uri" without typo and value as /restgui
    3, Note 2026487 is installed
    4. If target system is different from source system then you are able to access the following
             - http(s)://<TARGETSERVER>:<PORT>/clientaccesspolicy.xml
             - http(s)://<TARGETSERVER>:<PORT>/crossdomain.xml
    5. role is assigned to user under /n/persos/admin_ui -> User Maintenance -> Search -> Show user -> Role
    If you still get error, then if you are using SSO, please check if you have configured login/create_sso2_ticket parameter correctly.
    Thanks
    Chinthan

  • Since updating Firefox I have problems with playing Zynga games

    since updating Firefox I have problems with the Zynga games I am playing. The functions often stop working so I have to reboot the game. Also there are often a lot of items missing on my screen so I can't play at all

    I have this problem, as well, since the upgrade to 4.0.1. After the upgrade, I found several 'Recovered Files' in my Trash. On taking a look, they all had to do with the Crowdstar app. Happy Aquarium, I believe, but there are several folders of them. Some of them could have to do with Zynga's FarmVille.
    However, after repeated problems, I installed Chrome 10. to see if the Facebook apps. would work. They did, without problems. That tells me the folders in Trash shouldn't have anything to do with whether they operate or not but it has something to do with something Firefox has done, or not done, with this upgrade. Frankly, I'm baffled and more than a little annoyed. :/
    However, thinking back to the upgrade, it happened suddenly while I was on the phone with AppleCare on another matter. It was they who suggested I needed to upgrade my browser and I did it immediately, on-the-spot. It wasn't what you would call a 'clean install' because I was on the phone but also online with AppleCare. The process went so fast, I remember there were things about the installation that didn't quite seem right and I do remember that the earlier version of Firefox was not removed prior to the upgrade. Is there any chance something could be out-of whack because of this? If so, I need to know how to save my passwords, bookmarks, profile, and any other critical info that would need to be transferred.

  • Upgrading to 6.1.1 hasn't solved the problem with network connection on 4S. Still "No Servise"!

    Upgrading to 6.1.1 hasn't solved the problem with network connection on 4S. Still "No Servise"!

    Same here.  Everything was fine running on ios 6.0, I don't know what possessed me to upgrade!  I contacted O2 and thet went through the usual settings; reboot; airplane mode etc and it works for a while (like 5 mins) then service is losted with the network.  I've even deleted the exchange email account and rebooted as read on the internet that this would fix the problem.... guest what....yep no joy!  This is clearly a faulty software update and need fixing pronto!  I've read that ios6.1.2 will be out soon to fix the firmware that was suppose to fix the initial network problem.   When will this be realeased Apple?!  It's hardly fit for purpose when I can't make calls or surf the internet. 

  • Problem with sound in games requiring quicktime

    I recently purchased CSI 1. I installed the game and the latest version of quicktime player. As soon as the game starts and the first character starts talking the game pauses as if loading and then plays for a second and pauses again for a few seconds. This intermittent sound problem makes it impossible to play the game as the freezing stops everything from functioning. I tried another game that requires quicktime to be installed and that game is pausing the same. Has anyone else had this problem? I have all the latest drivers installed for Vista. Any help would be much appreciated.

    Do you get any problems with sound in other (older) games? You didn't mention which drivers in particular you updated, but make sure the graphics card's ones are included.
    With regards to Half Life 2, check out this page on the Steam site:
    http://steampowered.custhelp.com/cgi...wYWdlPTE*&p_li=
    If that page doesn't open correctly for you, just go to http://www.steampowered.com , then Support, and select Half Life 2 in the product list. It should be one of the first cases listed.
    Cat

  • Problem with sound in games

    Hi all welcome as you can see I'm new to your forum. So I have a problem as it concerns the sound in games.
    Namely, I bought a Creative Headset HS-800 Fatality everything good in listening to music, etc.
    But when I go to the game, I turned the sound (someone shoots to the left I hear him right, and vice versa.)
    Yes, in all games but mostly it is felt such a battlefiel or call of duty.
    At first I thought that this is the fault of my sound card but it's not because I was in a mate and in him was the same ... This recently replaced the computer and the same thing.
    I came across the net to reverse the channels, but unfortunately I do not know how to set it up.
    Here, the data on my computer:
    Sound Card Speakers (Realtek High Definitie
    Sound Card Realtek Digital Output (Realtek
    Sound Card Realtek Digital Output (RCA) (Re
    Operating system: Windows 7 64 bit
    I would add that in tests Realtek win7 and everything is fine.
    Regards and please help as soon as possible.

    Do you get any problems with sound in other (older) games? You didn't mention which drivers in particular you updated, but make sure the graphics card's ones are included.
    With regards to Half Life 2, check out this page on the Steam site:
    http://steampowered.custhelp.com/cgi...wYWdlPTE*&p_li=
    If that page doesn't open correctly for you, just go to http://www.steampowered.com , then Support, and select Half Life 2 in the product list. It should be one of the first cases listed.
    Cat

  • Problem with network printer on Windows 7 machine

    I'm running Mavericks on a Mac Mini.  I have a Windows 7 machine with an attached Brother HL-5340D printer.  I'm using the Brother HL-5340D CUPS driver.  Whatever configuration I use, I cannot get my Mac to print from the Brother.  I have even set up dhcp on the Mac and connected to the Windows machine with a cable.  I have tried ipp, ldr/ldp, windows, ip, and most of the relevant options under advanced, and nothing works.  I've run out of ideas on what to try and how to test and where to look for hints.  All I get is the following:
    Unable to connect to ‘192.168.33.2’ due to an error.
    Not a lot of help.

    James Wilde wrote:
    1. I forgot to say that it was the Mac equivalent of dhcpd that I turned on so that the Mac is the server, on 192.168.33.1, and it has assigned the number 192.168.33.2 to the Windows box.  And yes, I do prefer in these cases to use fixed addresses, but the Windows box seemed reluctant to accept its ip address thus the decision to start dhcpd on the Mac.  After that I could not ping the Windows box from the Mac box.  I didn't try to ping the Mac from the Windows box.  I'll try that tomorrow.  As to the network, there are only these two machines on the cable network.  The default router on the Windows box is, if I remember correctly, set by dhcpd to the ip address of the house router.  I have now disabled the cable network.  See below.
    Unusual that you could not ping Windows from the Mac. Would explain why you got a connection error with this setup. But if you have now stopped using the cable connection then this is mute.
    James Wilde wrote:
    2.  The network profile is set to Home on the Windows box.  I don't see any references to Homegroup in any of my messages on this topic.  If you are referring to another post I made on a different subject, I am aware of the problems with Homegroup, and as far as I know, I have avoided this, since my wife's Windows box is the only Windows box in the house.  Everything else is either Mac or Ubuntu, apart from one or two Windows virtual machines on my Mac and Ubuntu boxes.
    No, you didn't mention Homegroup but you did mention not being able to see the Windows computer "Incidentally I now find that I can't get any result from selecting Windows in the Add Printer dialog." So I thought I would mention that Homegroup can cause this.
    James Wilde wrote:
    3.  I've tried all three options in the Add printer dialog, IP, Windows, and Advanced.  Under Advanced I have tried lpd and spoolss and ipp, under ip I have tried ipp and lpd.  The share name is Brother-HL-5340D, and the hyphen between Brother and HL I put there myself to make it one 'word'.
    I've just tried your suggestion and get the following when I click on Add.
    Unable to verify the printer on your network.
    Unable to connect to ‘192.168.1.202’ due to an error. Would you still like to create the printer?
    I've seen this occur when the LPD process is not working. Open the Services pane on the PC and check the LPD service has started. If it is running and you still get the error message, what happens if you say yes to creating the printer?
    James Wilde wrote:
    As i said, I have disabled the cable network and am using the house wifi network (all machines with fixed IPs).  I can ping the computer and have just mounted a disk on her computer with smb using Finder/Go.  The mount does appear to be read only, but at least I can open all the folders.
    Anything else I can try?
    That is a good outcome. Proves there is a functional path between both computers.
    Since you can connect using SMB, and if you cannot LPD to work, then try adding the printer again using the Windows view in the Add printer pane. You should see the workgroup used by the Win7 PC followed by the Win7 computer name. Selecting it should prompt you to authenticate (unless you have saved the account in Keychain) and then the printer share name should appear. After selecting the share, select the Generic PS driver as a test to see if you can submit a print job - open the print queue on the Win7 PC to see if the print job appears. If this does work, you can remove the printer on the Mac and add again, this time selecting the Brother driver and then see if this works.

  • Adobe reader XI: doule sided print problem with network printer (windows 8 pro)

    Hi, I'm facing a problem with my old printer, the xerox phaser 3160n. It was connected to my notebook through network connection, and everything works well with Adobe X /Win 7 OS (including the double side print, of course) last month, I have upgraded my NB to windows 8 with clean install
    clean install my printer driver for windows 8 too, and Adobe reader XI was also downloaded through official website.
    However, since I was about to use double sided print in Adobe reader XI (11.00.02) it couldn't obey the order, but just print one side as usual
    I have checked the "option" of my printer, and it was correctly set to "double-sided print". I have tried word 2013 to open the same pdf, and choose the same "double-sided print" and it works perfectly.
    Is this problem a bug? and would it be corrected in the next update version??
    (I remeber I've saw a similar issue too, with network printer, but I couldn't find it)
    Thanks!!!

    Hi,
    Meanwhile, after insatlling the latest driver for printer from the manufacture website, restart the spooler service as a test.
    Start > Run > cmd and type "net stop spooler" after that "net start spooler" or start > run > service.msc and restart it over the GUI.
    Run Printer Troubleshootor under Action Center\Troubleshooting\Programs\Printer, and check if it helps.
    And yes, the manufacture should have more sence about the printer, it's recommended to contact them.
    Yolanda Zhu
    TechNet Community Support

  • WRT160N - problem with on-line games and downloading

    Hi,
    Several months ago I bought a WRT160N router and I have a strange problem.
    When I play online games, such as QL, and someone else will start downloading from the Internet, from time to time about 10 sec I have 999 ping
    I turned on in the background ping to the router, and from time to time about 10 sec there are 2-3 ansewers with 1900-2000 ms.
    I tought that when I buy router with N-mode everything will work better, and there will be no problems with on-line gaming.
    Is there any way to fix this problem??

    I checked now and even no one is downloading there is the same problem.
    I checked on other router and it works fine.
    Next problem is when I browse youtube and play several films simultaneously, suddenly there are no responses from router, when I close them, and wait for a moment the responses are back.
    Whether anyone had similar problem??

  • Problem with #D Flash games/animation

    Hello. Ive got such problems that all 3d flash games are extremaly choppy oin my computer. Regular flash games works fine. It is not a problem with my hardware cause earlier the 3d games were working very good (even on the beta version of flash player with 3d support). any ideas how could I fix it?  Thanks in advance

    Please provide some basic information like
    your operating system / version / edition
    your web browser / version / edition
    your Flash Player version
    your display adapter & driver version

Maybe you are looking for

  • Sales Order Form

    So, I have basically tried to take a paper form we have and convert into a fillable form, but I have a few questions. 1.) Someone on here had a marvelous, MARVEOUS form that had a button that just basically added a new row for each item, rather than

  • Indesign CS6 - Interactive Buttons - Destination links changing when opened on another computer

    Hi, I have encountered a bit of a problem with Indesign CS6. I have a customer who has created an multi-chapter Indesign file which has interactive buttons within the each chapter in the book. These buttons are linking to each chapter. E.G., Buttons

  • How to Implement Hireachical Queries in ODI?

    Hello All, Please let me know how to implement Hierarchical Queries in ODI 11.1.1.6.? Pls provide any example if possible. Thanks Ravikiran

  • The making of an online game

    Hello all users of the sun forums. I've always been facinated of games and have been wrestling with the idea about learning enough to be able to make a simple online game. I got several questions, mainly to see if this is something realistic or if it

  • Dreamweaver Sync & GoDaddy Folder Structure

    DW CS4 I purchased a Deluxe account to host two domains from GoDaddy for hosting and am running into the following issue: GoDaddy organizes  multi-domain accounts on their server by specifiying a main domain (in this case http://coachinginroads.com)