SunQuest
           Older Contests
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP ContestsOlder Contests

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old April 18th, 2003, 10:13 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[Trilite] newbie q :)

Prolly dumb questions but I have to ask :p

1. Is this suppose to be a form? Cos I don't see any other way how php could react to a click on a simple table. So my question is: Is user suppose to click on a radiobutton and hit submit? Or?

2. I'm guessing that sql is not allowed here?

Much thanks!!!

Reply With Quote
  #2  
Old April 18th, 2003, 10:53 AM
xs0 xs0 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Ljubljana, Slovenia
Posts: 760 xs0 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Trilite] newbie q :)

Actually, there is no HTML involved at all.. The scripts will be run automatically by another script. All you need to do is check the $_GET["lastmove"], and output a single number indicating your move, nothing else.

SQL is not allowed, I think.. Matt will have to confirm this.

Reply With Quote
  #3  
Old April 18th, 2003, 09:11 PM
marcel marcel is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Nieuw Vennep ,Netherlands
Posts: 108 marcel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Trilite] newbie q :)

Question 1:
Yes it looks like your script is called from a form using the get method. Your script is called from the judge script in an url like

http://localhost/trittle.php?lastmove=1

and in your script if you put

php Code:
Original - php Code
  1.  
  2. <?
  3. print $_GET['lastmove'];
  4. ?>


it would print '1'

Question 2:
I think using SQL would give Matt a lot more work on the judging. he would have to create databases and give access to scripts. Make sure scripts dont use the same tables enz.

so i think SQL will not be allowed

My guess is you want SQL for storing variables that you can access the next time you run the script. So i included a script that shows ho to do that using serailize. Nothing fancy, just enough to get you started.

Good luck in the game ;)

php Code:
Original - php Code
  1.  
  2. <?
  3. $boardfilename='board.txt';
  4.  
  5. /* see if we have a file with settings */
  6. if (file_exists($boardfilename))
  7. {
  8.   if (!$handle = fopen($boardfilename, 'r'))
  9.     die("Cannot open file ($boardfilename)");
  10.   /* here we read the board into $board */
  11.   if (!$board = unserialize(fgets($handle)))
  12.     die("Cannot read from file ($boardfilename)");
  13.   fclose($handle);
  14. } else {
  15.   /* if the file was not there initialize the board  */
  16.   $board=array(0,0,0,0,0,0,0,0,0,"turn" => 0);
  17. }
  18.  
  19. /* increase turn */
  20. $board['turn']++;
  21.  
  22. /* turn should be 1 the first time you run the script
  23.    and increase every run after that */
  24. print $board['turn'];
  25.  
  26. /* write our settings for next run */
  27. if (!$handle = fopen($boardfilename, 'w'))
  28.   die("Cannot open file ($boardfilename)");
  29. if (!fwrite($handle, serialize($board)))
  30.   die("Cannot write to file ($boardfilename)");
  31. fclose($handle);
  32. ?>

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsOlder Contests > [Trilite] newbie q :)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway