Skip to content

Latest commit

 

History

History
72 lines (60 loc) · 2.5 KB

README.org

File metadata and controls

72 lines (60 loc) · 2.5 KB

Game phases

Waiting player

url: http://webdev.cse.msu.edu/~longziya/cse476/proj2/join.php?user=longziya&magic=NechAtHa6RuzeR8x&pw=&usr=yesss

<?xml version="1.0" encoding="UTF-8" ?><connect player="player2" />
database: | player1_username = null | player2_username = null|
player1 and player2 are pulling info from server.

if (SELECT player1 FROM players) == NULL:
   UPDATE players SET player1 = 'player1abc'
else:
   UPDATE players SET player2 = 'player2fff'

url: http://webdev.cse.msu.edu/~longziya/cse476/proj2/create-game.php?user=longziya&magic=NechAtHa6RuzeR8x&pw=&usr=222

<?xml version="1.0" encoding="UTF-8" ?><connect status='yes' msg='start' op="yesss"/>
if player1 != null and player2 != null
  Game_start = 1
server updates database:
1. Drop "gamelive" table
2. create "Gamelive" table
3. insert ID of player2 to userName of Gamelive, which means player1 should play first!!!

Gamestart

url: http://webdev.cse.msu.edu/~longziya/cse476/proj2/pull.php?user=longziya&magic=NechAtHa6RuzeR8x&pw=&pull=1

pulling info from server -> userName != device’s username => you can place your disc => need to wait and update grids

<?xml version="1.0" encoding="UTF-8" ?><connect status='yes' usr="player2" gridNum="43"/>

url: http://webdev.cse.msu.edu/~longziya/cse476/proj2/receiver.php?user=longziya&magic=NechAtHa6RuzeR8x&pw=&userName=yess&gridNum=1

Player playaction done -> send (userName + gridNum) -> Server: update database ->

Ending

url: http://webdev.cse.msu.edu/~longziya/cse476/proj2/end.php?user=longziya&magic=NechAtHa6RuzeR8x&pw=&end=1

game end according to local devices.

if game ends => send info to server

Drop “players” table

Other url

http://webdev.cse.msu.edu/~longziya/cse476/proj2/create-user.php?user=longziya&magic=NechAtHa6RuzeR8x&pw= &usr=yesss &psw=666

SQL note

create table players(player1 varchar(255),player2 varchar(255))
insert players (player1,player2) values(NULL,NULL)
UPDATE players SET player1= NULL,player2= NULL
DROP TABLE gamelive
CREATE TABLE Gamelive (
userName VARCHAR,
gridNum INT
)

insert new user (SQL):

Show all user(SQL):

  • select * from connect;