CSCE-315: Programming Studio (Summer 2014)

Project 2: Reversi Online

Updates

  1. 6/17 Tuesday: Design docs due
  2. 6/23 Monday: Game mechanics due
  3. 6/27 Friday: AI-engine due
  4. 6/30 Monday: Final version including client-server code due
  5. You may use Java.
  6. Changes:
    • Server sends back moves as well as other acknowledgments.
    • alpha-beta pruning is mandatory.

Team configuration

The team will be the same as project 1.

In a nutshell

The game you will implement is Reversi. See Wikipedia entry on Reversi for game rules.

There are two main parts of the project:

  1. Design and implement the basic game playing mechanism and an AI algorithm to play against humans.
  2. Design and implement a client-server protocol so that
    1. humans can connect to the game server and play the game online. Implement the server and use telent as the client.
    2. game server can connecto to another game server and play AI to AI.

Here are some additional requirements:

  • For this project, using the unix environment for programming will be more convenient, in terms of socket programming, etc. However, developing in the unix environment is optional.
  • We will use the SCRUM method and each of your submissions should be accompanied by SCRUM backlogs and the burndown chart, as well as the code and other documentation.

Reversi Online Client-Server Protocol

Each row will be named 1, 2, 3, ..., 8. Each column will be named a, b, c, ... , h. Initial configuration of the board is:
  • d4 white
  • e4 black
  • d5 black
  • e5 white
'O' indicates white and '@' indicates black.
  _ _ _ _ _ _ _ _
1|_|_|_|_|_|_|_|_|
2|_|_|_|_|_|_|_|_|
3|_|_|_|_|_|_|_|_|
4|_|_|_|O|@|_|_|_|
5|_|_|_|@|O|_|_|_|
6|_|_|_|_|_|_|_|_|
7|_|_|_|_|_|_|_|_|
8|_|_|_|_|_|_|_|_|
  a b c d e f g h

User always plays BLACK and will always make the first move.
The communication will be through simple ASCII text. The commands are pretty simple.

expr ::= command | move | comment | EXIT | DISPLAY
command
 
::= UNDO
| LOCAL difficulty
| REMOTE <server> <port> client_difficulty server_difficulty
difficulty ::= EASY|MEDIUM|HARD
client_difficulty ::= difficulty
server_difficulty ::= difficulty
move ::= column row
row ::= 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
column ::= a | b | c | d | e | f | g | h

comment ::= ; * The commands should function as follows:
  • EXIT: exit and disconnect from the server
  • DISPLAY: toggles board display
  • UNDO: undo AI's move and your last move. Up to 10 UNDO's should be supported.
  • LOCAL: tells server that a local game will be played
  • EASY | MEDIUM | HARD : sets the AI skill level (difficulty).
  • REMOTE <server> <port> client_difficulty server_difficulty: this server's AI against another server's AI (difficulty of both specified, respectively)
    • This server connects as a client.
    • This server will take the place of a human, so it will enter LOCAL HARD, etc. to establish the initial game.
    • NOTE: This server will play black and it will go first. The remote server will play white.

The server will show these messages to the user:

ack ::= WELCOME | OK | ILLEGAL | move | comment
comment ::= ; *

An unused port should be used for the server. The entire interface should be accessable using telnet, using plain ASCII text. You have to be extra cautious with your code since your server can easily become a security hole. Before you print anything that came from the client or the server, you have to first check if these are printable characters, and make sure the length of the input is within your input buffer size.

An example is shown below. Bold is server, italic is client). Text following ";" are comments and they are simply displayed as they are received and no further action is taken (comments on the far right column are mine, just to explain it a bit). "_" at the end is the cursor waiting for the user input.


WELCOME
LOCAL EASY			; set up AI difficulty
OK
DISPLAY_ON			; toggle board display
OK

;  _ _ _ _ _ _ _ _
;1|_|_|_|_|_|_|_|_|
;2|_|_|_|_|_|_|_|_|
;3|_|_|_|_|_|_|_|_|
;4|_|_|_|O|@|_|_|_|
;5|_|_|_|@|O|_|_|_|
;6|_|_|_|_|_|_|_|_|
;7|_|_|_|_|_|_|_|_|
;8|_|_|_|_|_|_|_|_|
;  a b c d e f g h
f5 				; enter move
OK
;  _ _ _ _ _ _ _ _
;1|_|_|_|_|_|_|_|_|
;2|_|_|_|_|_|_|_|_|
;3|_|_|_|_|_|_|_|_|
;4|_|_|_|O|O|O|_|_|
;5|_|_|_|@|O|@|_|_|
;6|_|_|_|_|_|_|_|_|
;7|_|_|_|_|_|_|_|_|
;8|_|_|_|_|_|_|_|_|
;  a b c d e f g h 
f4				; server tells you which move it made 
g1 				; enter move
ILLEGAL
;  _ _ _ _ _ _ _ _
;1|_|_|_|_|_|_|_|_|
;2|_|_|_|_|_|_|_|_|
;3|_|_|_|_|_|_|_|_|
;4|_|_|_|O|O|O|_|_|
;5|_|_|_|@|O|@|_|_|
;6|_|_|_|_|_|_|_|_|
;7|_|_|_|_|_|_|_|_|
;8|_|_|_|_|_|_|_|_|
;  a b c d e f g h

_				; cursor waiting

Reversi Client

The telnet command will be used as the client, so there's no need to write the client. However, for AI to AI game, you will need to implement simple clinet-side code.
telnet <hostname> <port>

Games

The client side will always play BLACK and will always make the first move.

Project Organization

This project will be approached by trying to follow an approach similar to one that would be used in an agile development environment. Due to team size, and even more significant, due to time constraints, we will not be able to follow a "real" agile approach, but we will try to capture some of the themes.

We will use an iterative approach to this assignment. Your team will be asked to implement the program over three "sprint" iterations, each just over a few days in length. At the end of each iteration, your team should have a complete, working program feature set. More features and functionality should be added at each iteration. In addition, you are to keep a backlog, a burndown chart, and hold SCRUM meetings (almost everyday). Each of these will be discussed below.

The following will be the project schedule:

  1. Project Assigned
  2. Product backlog and initial burndown chart created
  3. Sprint 1 backlog created (game mechanics)
  4. Iteration 1 completed
  5. Sprint 2 backlog created (AI engine)
  6. Iteration 2 completed
  7. Sprint 3 backlog created (client-server)
  8. Final Iteration completed

SCRUM tips

Here's an example template of the product backlog:

        Backlog example

And, here's the burndown chart:

        Burndown chart example

Some tips:

        For the project, you should focus on the tasks in the following
        order (near the top is most important). Set up your backlog
        accordingly. Your backlog will be much more detailed than this.

        1. Game mechanics
                - board and game state representation
                - operators
                - operator legality (is a certain move allowed?)
                - move: once a move is made, update the board (flip the
                        intervening tiles)
                - termination condition detection (can any more
                  pieces be placed?)
		- undo
                - game result report (win/lose/draw).

        2. Game Server
                - allows clients to connect
                - can use telnet (e.g., putty, with telnet option) to
                  connect

        3. Game AI
                - initially random player (randomly pick from available
                  moves).
                - min-max with limited depth
                - alpha-beta-pruning-based
                - customized heuristics

        As for the burndown chart, you will initially not have
        any data. Use your estimated time for each task and
        during which sprint you will get those done to come up
        with a mock burndown chart.

Overall Grading

There will be a team grade assigned for the project, and like the first project, the team grade will be apportioned out to the individuals. The rough breakdown of team grade is:

10% Agile computing methodology - setting, using, adjusting backlogs and burndown charts

20% Completeness and quality of the game mechanics

30% Completeness and quality of the AI

10% Completeness and quality of the client-server interface.

5% Code style (naming, layout, etc.)

25% Weighted grade from earlier submissions (design doc, game mechanics, AI).

Deliverables

The deliverables for each submission will be as follows:
  1. Design documents, SCRUM product log (with initial burndown chart)
    • The design document requirements are the same as Project 1.
    • See the SCRUM tips above for product log format.
    • Grading:
      • 20%: All four sections
      • 60%: Game mechanics, AI, client-server
      • 20%: SCRUM product log and burndown shart
  2. Game mechanics code (plus sprint 1 backlog and burndown chart).
    • Game mechanics code should include fully playable board display undo, etc. Assume random AI.
    • Pay attention to boundary conditions and unplayable states (pass turn).
    • No client-server code -- take input directly from the console.
    • Grading:
      • 10%: layout, style, comments
      • 30%: all functions implemented
      • 40%: all functions working properly
      • 10%: sprint backlog and burndown chart.
      • 10%: development log
  3. AI engine code, sprint 2 backlog and burndown chart.
    • AI engine should at the minumum implement the MIN-MAX algorithm.
    • You should also design and implement an evaluation function to use at the cut-off state (depth limit).
    • AI engine should also have alpha-beta pruning.
    • Grading:
      • 10%: layout, style, comments
      • 30%: all functions implemented
      • 20%: min-max working
      • 10%: quality of heuristics
      • 10%: alpha-beta pruning working
      • 10%: sprint backlog and burndown chart.
      • 10%: development log
  4. Final version. Fully integrated system.
    • Client-server code, sprint 3 backlog and burndown chart.
      • Server should be startable with a command line argument that takes the port number.
      • Human play should be able to use telnet to connect to the game server and play the game.
      • AI-AI sessions should be possible.
    • post production notes (changes you had to make to your design and why, difficulties, solutions, lessons learned)
    • individual work load distribution (percentage)
    • Development log.
Original concept/design/most of the text by John Keyser. Modifications by Yoonsuck Choe.