Package Stutsman.C4.net

Examples of Stutsman.C4.net.Server


{
  private AI comp;
  public Connect4AI(Color p1,Color p2,ConnectBoard d)
  {
    super(p1,p2,d);
    comp = new AI(d,p1,p2,d.getBackground());
  }
View Full Code Here


  }
 
  public Connect4AI(Color p1,Color p2,String a,String b,ConnectBoard d)
  {
    super(p1,p2,a,b,d);
    comp = new AI(d,p1,p2,d.getBackground());
  }
View Full Code Here

          ?C4Protocol.parseName(read[1].readLine()):"Player 2";
        System.out.println(names[1]);
        write[1].println(C4Protocol.sendSettings(rows,cols,back,bord));
        write[1].flush();
       
        game = new Connect4(pl1,pl2,names[0],names[1],display);
        temp = new GameHandler(cl1,cl2,names[0],names[1],game);
        call.setServer(temp);
        Thread nextcon = new Thread(new runner(temp,gCounter));
        System.out.println(
          "Game "+gCounter+" start: "+cl1.getRemoteSocketAddress()
View Full Code Here

  private static ChatInput chat = new ChatInput(4,30,30);
 
  public static void main(String[] args)
  {
    Client service;
    ConnectBoard theBoard;
    String a,b,d;
    int c;
    a=input("127.0.0.1","Enter the IP of the server you will connect to");
    b=input("8080","Enter the port number that you will connect to");
    c=Integer.parseInt(b);
    d=input("Player","Enter the name you want to go by on the server");
   
    while(true)
    {
      try
      {
        service = new Client(d,a,c,chat);
      } catch(UnknownHostException ex) {
        alert("Bad host","Trying to connect to unknown host.");
        return;
      } catch(IOException ex) {
        alert("Error","There has been an error");
        return;
      } catch(Exception ex) {
        alert("Error","Unknown error");
        return;
      }
     
      theBoard = service.getBoard();
      if(theBoard==null)
      {
        alert("Error","Server connection error");
        return;
      }
     
      chat.addClickListener(new ChatListener(service,chat));
      for(int i=0;i<theBoard.getRows();i++)
      {
        for(int j=0;j<theBoard.getCols();j++)
        {
          JButton temp =theBoard.getCellButton(i,j);
          temp.addActionListener(new GridFunction(i,j,service));
        }
      }
     
      setUp(theBoard,theBoard.getRows(),theBoard.getCols());
     
      service.notifyEnd();
     
      if(ask("Again?","Play again?")==1) break;
    }
View Full Code Here

    String[] names;
    int[] encoded;
    int gCounter=0;
    GameHandler temp;
    Caller call;
    ConnectBoard display;
    GridAct game;
   
    while(true)
    {
      write = new PrintWriter[2];
View Full Code Here

    int[] encoded;
    int gCounter=0;
    GameHandler temp;
    Caller call;
    ConnectBoard display;
    GridAct game;
   
    while(true)
    {
      write = new PrintWriter[2];
      reader = new InputStreamReader[2];
View Full Code Here

      for(int i=0;i<theBoard.getRows();i++)
      {
        for(int j=0;j<theBoard.getCols();j++)
        {
          JButton temp =theBoard.getCellButton(i,j);
          temp.addActionListener(new GridFunction(i,j,service));
        }
      }
     
      setUp(theBoard,theBoard.getRows(),theBoard.getCols());
     
View Full Code Here

    for(int i=0;i<theBoard.getRows();i++)
    {
      for(int j=0;j<theBoard.getCols();j++)
      {
        JButton temp =theBoard.getCellButton(i,j);
        temp.addActionListener(new GridFunction(i,j,game));
      }
    }
  }
View Full Code Here

    for(int i=0;i<theBoard.getRows();i++)
    {
      for(int j=0;j<theBoard.getCols();j++)
      {
        JButton temp =theBoard.getCellButton(i,j);
        temp.addActionListener(new GridFunction(i,j,game));
      }
    }
  }
View Full Code Here

    for(int i=0;i<theBoard.getRows();i++)
    {
      for(int j=0;j<theBoard.getCols();j++)
      {
        JButton temp =theBoard.getCellButton(i,j);
        temp.addActionListener(new GridFunction(i,j,game));
      }
    }
  }
View Full Code Here

TOP

Related Classes of Stutsman.C4.net.Server

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.