CSC 3700 Team - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

CSC 3700 Team

Description:

public void sendMove(int oldX, int oldY, int newX, int newY) Launches a thread ... public refresh(int oldX, int oldY, int newX, int newY) - Allows the networking ... – PowerPoint PPT presentation

Number of Views:65
Avg rating:3.0/5.0
Slides: 19
Provided by: justinl3
Category:
Tags: csc | oldy | team

less

Transcript and Presenter's Notes

Title: CSC 3700 Team


1
CSC 3700 Team 4
  • SDS Requirements Documents
  • Christopher Curry
  • Jim Gregory
  • Justin Lampley
  • Bidit Mazumder

2
Rules Module
3
Rules Methods
  • protected boolean bitboard 8x8 bit
    representation of the possible legal moves for
    this piece. This is updated on every turn.
  • public abstarct void applyMotion(int
    chessBoard) This method applies the piece's
    motion on it's bitboard. This is called at the
    beginning of every turn.

4
Rules Methods
  • public GameObject(int row, into column, boolean
    white) Constructor that takes the row and
    column positions, and a variable that represents
    whether this piece is white or black.
  •  
  • public void setPosition(int row, int column)
    Sets this piece's position.

5
Rules Methods
  • public GameObject(int row, into column, boolean
    white) Constructor that takes the row and
    column positions, and a variable that represents
    whether this piece is white or black.
  • public void setPosition(int row, int column)
    Sets this piece's position.

6
Rules Methods
  • public ChessBoard() - Constructor that
    initializes chess board with pieces in starting
    locations. All variables are initialized, each
    GameObjects bitboard is created.
  • public int getBoard() - Returns the integer
    representation for the current state of the chess
    board.

7
Rules Methods
  • private boolean isLegal(int piece, int row, int
    column) Checks to see whether moving a piece to
    the specified position is legal.
  • private boolean isInCheck(int chessBoard,
    boolean white) Checks if the specified colors
    king is in check.

8
Rules Methods
  • public boolean move(int piece, int row, int
    column) This method is what the GUI will use to
    communicate with the rules module. This method
    will check whether the given move is legal, and
    return true if the move was successful.

9
Networking Module
10
Networking Variables
  • private Socket connection Object that handles
    application level communication over TCP
    connection.
  • private BufferedReader in Attached to the
    connections input stream and catches all incoming
    communications.
  •  
  • private PrintStream out Attached to the
    connections output stream and sends messages
    through the socket.

11
Networking Methods
  • public void connect(String host, int port)
    Launches a thread to establish a connection to
    the host specified on the port given.
  • public void host(int port) Launches a thread to
    listen on the supplied port for an incoming
    connection.

12
Networking Methods
  • public void listen(Socket s) Launches a thread
    on the socket supplied to listen for incoming
    communications, messages, moves, etc...
  • public void sendMove(int oldX, int oldY, int
    newX, int newY) Launches a thread to send the
    coordinates of a move, where it moved from and
    where it moved to.

13
Networking Methods
  • public void sendMsg(String msg) Launches a
    thread to send a String to the opponent.

14
Networking Inner-classes
  • public class ConnectThread extends Thread
    Thread that handles connection to a host.
  • public class hostThread extends Thread a thread
    that handles listening on a sockect for an
    incoming connection.
  • public class listenThread extends Thread - Thread
    that handles listening to a socket for incoming
    messages.

15
Networking Inner-classes
  • public class sendMsgThread extends Thread
    Thread that handles sending messages.
  • public class sendMoveThread extends Thread
    Thread that handles sending of a move to the
    opponent.

16
GUI Module
17
GUI Methods
  • public refresh(String message) - Allows the
    networking module to update the Gui as to when a
    new message is generated.

18
GUI Methods
  • public refresh(int oldX, int oldY, int newX, int
    newY) - Allows the networking module to update
    the Gui as to when a new move is generated.
Write a Comment
User Comments (0)
About PowerShow.com