TIC-TAC-TOE

Yutthana Srisakunkhunakorn
May 2, 2014

Overview

This project is the two players TIC-TAC-TOE game, but using the gui library to make the graphic.

Screenshot

(You may attach a PNG, GIF, or JPG file. Please note the Attach: syntax for doing this. After you save the wiki page, you will see the Attach: link with a blue triangle. Click on the link, and then you will be brought to a page where you can upload the attachment. After you upload the attachment, the link goes away and you see the image instead.)

Concepts Demonstrated

1/6 of the project grade is based on which concepts from OPL are demonstrated in your project. Please identify them here. Be brief; a simple list and one-sentence explanation for each concept should be adequate; e.g.:

    Data abstraction  each button and frame are defined using data abstraction.
    (define fr (new frame% [label "TIC-TAC-TOE"]))
    (define panel1 (new horizontal-panel% [parent fr]
                    [alignment '(center center)]))
    (new button% [parent panel1] [label"1"] [min-width 150] [min-height 150] [font fz] [callback callback])
    Symbolic manipulate  used to transform x->X and o->O for use in the list.
    (define o 'O)
    (define x 'X)
    Cond  used to check whether the user is winning, the board is full, the users click the same button, or users click the available button.
    (cond [(winner? board) (begin (send winning-msg set-label winning-player)
                                (send wn show #t))]
          [(= count 9) (send dw show #t)]
    Lists - used to keep track of the game board and used to check for the winner.
    (define board
    '(1 2 3
      4 5 6
      7 8 9))
    Type Conversions  used to convert some data. For instance, string->symbol.
    (string->symbol (send btn get-label))
    Environment Variables  Use set! function to change the global variables
    (set! click (string->number (send btn get-label)))
    (set! board (newboard board click first-player))

External Technology

racket/gui/base to create the game board and the buttons for the users to click.

Innovation

This is the simple two players TIC-TAC-TOE game. I think there is not much innovation. But I learned a lot from this project. For example, I have to find the way to make the callback function of the button to work with my code.

How the program Works

Technology Used Block Diagram

Create a simple block diagram of your software system that illustrates the major technical components and how they interact; e.g.:

Additional Remarks

Please use this area to include any additional information you would like to include that did not fit into any of the previous categories.

The total write-up, including screen shot and block diagram, should be two to three pages in length (when printed).