/ Superply Web Edition
/ Code author: Dennis Shasha, 2002
/ Here is the activity we want. Display a choice of boards.
/ Once a board is chosen, display it with blanks and with the
/ row and column headers showing.
/ Then put up the header that says: Red (horizontal) moves first.
/ Show a hint card.
/ When a player clicks the first one, see whether the hint matches.
/ If so, then fill that space with color (showing the answer)
/ and see whether that player wins. If correct but player doesn't win
/ then the player goes into addmove mode where there is a contiguity
/ requirement.
/ When a player's move does not satisfy the requirement, then play
/ continues with the other player.
/ Must have the ability to match a hint to a choice.
/
/ New interface: go to attbroker at port 2000 and attman at port 2120 etc.
/ attbroker gives a session id and a port as before, but there can
/ be many sessions on a given port. The session id should be part
/ of the command:
/ each command should have the intended command then colon then a session id,
/ e.g. sendtables:31
/ Guangwei: set the m h to 2120, 2121 etc.
/ Set the m i 1000 higher.
\m h 2223
/ STRING PROCESSING
/ parses a field based on vertical bars
getfields:{[line]
i: line = "|"
j1: &i
j2: &~i
line @:j2
size: #j1
:(0,(j1 - !size)) _ line
}
/ get rid of blanks at either end of the string
delendblanks:{[string]
if[0 = #string; :""]
if[string ~ ,"" ; :""]
i: & ~ string = " "
if[(#string) = (#i); :string]
if[0 = (#i); :""]
string: (- ((#string) - (1 + *|i))) _ string
:(*i) _ string
}
/ HTMLIZE
printheader:{[atts]
out: "
"
j: 0
while[j < #atts
out,: "
"
out,: ($atts[j]), ("
")
j+: 1
]
out,: "
"
:out
}
/ spit out a table of tables and attributes
tabatttable:{[timestamp; val]
j: 0
out: "