Special Topics in Problem Solving Fall 2001 - PowerPoint PPT Presentation

About This Presentation
Title:

Special Topics in Problem Solving Fall 2001

Description:

Supporting several games. There is a get state, compute move and ... read board state from stdin. compute move. send move to stdout. Developing a player means ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 14
Provided by: alberto62
Category:

less

Transcript and Presenter's Notes

Title: Special Topics in Problem Solving Fall 2001


1
A Game Framework
  • Special Topics in Problem SolvingFall 2001
  • Document author Alberto Lerner
    (lerner_at_cs.nyu.edu)

2
Goal
  • Create a proper infra-structure for the
    development and the deployment of
  • 2-player games
  • software-based players

3
2-player games
1. looks at the boardstate (get state)
2. considers possiblemoves (compute move)
PLAYER 1
PLAYER 2
The Board
4
2-player games
Is the game over?
Is there a winner?
X
PLAYER 1
PLAYER 2
The Board
5
Supporting several games
  • There is a get state, compute move and send move
    tasks in most 2-player games
  • But for each game, the way each one is done
    changes
  • How can one infra-structure support several
    games?

6
Mixing HTML with code
getstate.php
tictactoe.php
lthtmlgt ... lt?php include(game) ?gt lt?php
board2html(...) ?gt
Function board2html() echo(lttablegt)
for(i0 ilt3 i) echo (lttdgt) ...
Independent of the game(getstate.php,
sendmove.php,etc)
One implementation pergame
7
How does PHP work?
HTTP Server
Page response
(4)
Page with HTMLonly
Page request
PHPinterpreter
(3)
(1)
(2)
Page with HTML PHP
8
Developing a game
tictactoe.php
  • Developing a game means implementing the
    necessaryfunctions for that game in PHP
  • The framework accepts newgames files via an
    option on itsmain page
  • The file is parsed and saved under the name of
    the game
  • Interactive play can then be arranged among
    interested players

function newgame() function loadgame()function
savegame()function board2html() function
board2xml() function mov2html() function
mov2xml() function getplayer() function
getemail() function getmsg() function
whoseturn()function sendmove()
9
Interactive Human Players
HTTP Server
PLAYER 1
PLAYER 2
10
Players can be software
(1) PHP spawns an interpreteror an executable
program
HTTP Server
(2) The board state is sent thrustdin
(3) Thinkingtime
PHPinterpreter
(4) The move issent thru stdout
PLAYER 1
PLAYER 2
11
Developing a player
player.???
  • Developing a player means implementing the move
    choicein any tool that can communicatevia pipes
  • The framework accepts newplayers files via an
    option on itsmain page
  • The player file is saved undera player name
  • Software players can be chosen as adversaries
    in human-softwareor software-software plays

read board state from stdin compute move send
move to stdout
12
Summary
  • The architecture team implements the necessary
    back-end php functions for a game and stores it
    in the framework
  • The other teams build the software based players
    and stores them in the framework
  • The framework provides the necessary htmlphp
    front-end pages for interactive human or
    interactive program plays using the games and
    players created by the teams

13
References
  • PHP www.php.net
  • The Game Frameworkwww.cs.nyu.edu/lerner/GameFram
    eworkIndex.html
Write a Comment
User Comments (0)
About PowerShow.com