A simple version of the popular game "connect four" written in Java.
This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2020-02-25 02:09:24 +01:00
src/de/itsblue/ConnectFour added build script for linux 2020-02-25 02:09:24 +01:00
connect-four.code-workspace add workspace 2020-02-05 15:07:34 +01:00
LICENSE added LICENSE 2020-02-13 19:46:00 +01:00
README.md added some basic network protocol definitions 2020-02-22 08:48:20 +01:00

Connect Four

A simple version of the popular game "connect four" written in Java.

API docs

SOCKET API

Basic structure

A command consists of a json encoded string of type object which starts with <message> and ends with </message>. It contains:

  • id (int): some number, the response will contain the same number
  • header (int): the actual command to execute
  • data (mixed): data that has to be passed with the command

A response consists of a json encoded string of type object which starts with <message> and ends with </message>. It contains:

  • id (int): id of the command
  • header (int): return code of the command (see later)
  • data (midex): returned data of the command

Return codes

The return codes are mostly identical with the HTTP standard codes. However there are some additional ones as well:

Enums

Some enumeration types

  • PlateType
    • 0: X
    • 1: O

Commands

  • Confirm game start
    • command: 1
    • requestdata:
      • type: null
    • responsedata:
      • type: object
      • def:
        • 'player'
          • type: PlateType
          • desc: the plate type the client will use
  • Insert a plate
    • command: 100
    • requestdata:
      • type: int
      • decs: index of column to insert plate
    • replydata:
      • type: string
      • def:
        • 'ok': plate was inserted
        • 'err': plate was not inserted (either index out of range or clumn full)
        • 'X': insertion resulted in the winning of PlateType X
        • 'O': insertion resulted in the winning of PlateType O