Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

minesweeper

Name: 123 2009-04-22 6:13

hey /prog/ i need some help writing minesweeper with php. how do i do that?

Name: Anonymous 2009-04-22 6:17

Phrase your question more precisely, or fuck off.

Name: Anonymous 2009-04-22 6:23

i need simpliest minesweeper for php code.

Name: Anonymous 2009-04-22 6:37

If you find Google to difficult to use, you have no business writing any code.

Name: Anonymous 2009-04-22 6:53

Why do you say you need some help writing minesweeper with php?

Name: Anonymous 2009-04-22 7:01

Sorry, it' NP-complete, you can't do that.

Name: Anonymous 2009-04-22 7:08

[code]<?php
// Writes ``minesweeper''
echo 'minesweeper';

Name: Anonymous 2009-04-22 7:09

>>7
Should be:
<?php
// Writes ``minesweeper''
echo 'minesweeper';

Name: Anonymous 2009-04-22 7:18

Read SICPHP

Name: Anonymous 2009-04-22 7:29

why the hell would you write a game of minesweeper in php?

Name: Anonymous 2009-04-22 7:53

hah i somehow read that OP wants to make minesweeper in php

Name: Anonymous 2009-04-22 10:09

Well, I recommend you have a single utility class action.php. index.html[code] will have the main interface page with a n*m size minesweeper board where each "cell" of the minesweeper board corresponds to one table cell. The state of each minesweeper game, along with the users ip address should be stored in a file "state.txt" where each line has a format [code]"127.0.0.1 012021200200200012012000010012012" or something, the first token is the users ip address and the second token is the state of the board encoded with bit flags (i.e.: 0 is hidden square with mine underneath, 1 is flagged square with mine underneath, 2 is flagged square with no mine underneath etc..). When the user clicks a "cell" on the table, client side validation is performed, then an asynchronous get request is sent to action.php containing what square they clicked or flagged- this is then validated server side- the operation performed and the state file updated, after which the php page returns the result as an associative array through json_encode() to be parsed client side by the user again, rinse and repeat.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List