dk.itu.smds.torusman
Class DistTorus

java.lang.Object
  extended by dk.itu.smds.torusman.LocalTorus
      extended by dk.itu.smds.torusman.DistTorus
All Implemented Interfaces:
Torus

public class DistTorus
extends LocalTorus
implements Torus

The Class DistTorus uses the methods of our implementation that lets the game run distributed.


Field Summary
 java.io.DataInputStream in
          The in.
 ClientListener listener
          The listener.
 LocalMan myMan
          The my man.
 java.io.DataOutputStream out
          The out.
 ClientSender sender
          The sender.
 java.net.Socket socket
          The socket.
 ClientTimeSender timeSender
          The time sender.
 
Constructor Summary
DistTorus(byte[][][][] grid, java.lang.String ip, LocalMan man)
          Instantiates a new dist torus.
 
Method Summary
 Scores addPoints(byte manId, byte teamId, int points)
          Adds the points to the local man and then sends it to the server.
 Board getBoard(Man man)
          Gets the board from the given man.
 void moveTo(ManData manData, byte X, byte Y)
          Moves the local mand and sends the move to the server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sender

public ClientSender sender
The sender.


timeSender

public ClientTimeSender timeSender
The time sender.


listener

public ClientListener listener
The listener.


in

public java.io.DataInputStream in
The in.


out

public java.io.DataOutputStream out
The out.


socket

public java.net.Socket socket
The socket.


myMan

public LocalMan myMan
The my man.

Constructor Detail

DistTorus

public DistTorus(byte[][][][] grid,
                 java.lang.String ip,
                 LocalMan man)
Instantiates a new dist torus.

Parameters:
grid - the grid
ip - the ip
man - the man
Method Detail

addPoints

public Scores addPoints(byte manId,
                        byte teamId,
                        int points)
Adds the points to the local man and then sends it to the server.

Specified by:
addPoints in interface Torus
Overrides:
addPoints in class LocalTorus
Parameters:
manId - the man id
teamId - the team id
points - the points
Returns:
A table mapping teamId's to points.
See Also:
LocalTorus.addPoints(byte, byte, int)

getBoard

public Board getBoard(Man man)
Gets the board from the given man.

Specified by:
getBoard in interface Torus
Overrides:
getBoard in class LocalTorus
Parameters:
man - the given man
Returns:
the board of the man
See Also:
LocalTorus.getBoard(dk.itu.smds.torusman.Man)

moveTo

public void moveTo(ManData manData,
                   byte X,
                   byte Y)
Moves the local mand and sends the move to the server.

Specified by:
moveTo in interface Torus
Overrides:
moveTo in class LocalTorus
Parameters:
manData - that man to move
X - the position
Y - the position
See Also:
LocalTorus.moveTo(dk.itu.smds.torusman.ManData, byte, byte)