December 6, 2014
A TicTacToe game,which could be played online with your friend,based on GUI and TCP libraries .
(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.)
We used lambda which is for defining the procedure and let $ let* which two are for binding expressions in this project many times,there is especially a loop-until in start-server and start-client.
External Technology and Libraries
We made this project based on GUI and TCP libraries in DrRacket, no external technology.
Favorite Lines of Code
Each partner should identify a favorite line of code, Scheme expression, or entire procedure written by himself / herself in the entire project, and explain what it does. E.g.:
- Partner One: (loop-until (read-byte ip) ; start
(lambda (c) ; done? (or (not running) (eof-object? c))) (lambda (x) ; next (read-byte ip)) (lambda (c) ; f (when (procedure? on-remote-pressed) (set! running (on-remote-pressed c)))))
this loop was applied in both of the procedures start-server and start-client,and this loop was embeded in a thread to make sure it can catch the massage from TCP listener port.Through the procedure on-remote -pressed ,it would also respond to the massage which is actually a remote comand for telling what the opponent just did in his computer.
- Partner Two:
(define (run-mode-chooser parent-window) (let* ([frame (new dialog% [label ""] [parent parent-window] ; [width 300] [style '(no-caption)])] [pane (new horizontal-pane% [parent frame] [alignment '(center center)])] [m1 (new message% [parent pane] [label "Runs this game as a..."])] [server-button (new button% [parent pane] [label "Server"] [callback (lambda (button event) (set! *game-mode* 'server) (send frame show #f) )])] [client-button (new button% [parent pane] [label "Client"] [callback (lambda (button event) (set! *game-mode* 'client) (send frame show #f) )])]) (send frame show #t)))
This block of code provides the graphic user interface of run mode chooser, choose to be a server or a client.
Technology Used Block Diagram
Create a simple block diagram of your software system that illustrates the major technical components and how they interact. Indicate which partner did which part of the work by putting an individual's initials inside the component(s) for which that person was primarily responsible. E.g.:
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).