Author: hhubner
Date: 2007-11-25 00:37:30 -0500 (Sun, 25 Nov 2007)
New Revision: 2285
Added:
branches/trunk-reorg/projects/scrabble/website/images/de/A-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/B-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/C-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/D-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/E-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/F-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/G-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/H-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/I-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/J-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/K-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/L-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/M-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/N-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/O-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/P-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/Q-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/R-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/S-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/T-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/U-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/V-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/W-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/X-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/Y-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/Z-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/null-blank.png
branches/trunk-reorg/projects/scrabble/website/images/de/null.png
branches/trunk-reorg/projects/scrabble/website/images/de/start-field.png
branches/trunk-reorg/projects/scrabble/website/images/en/null.png
Removed:
branches/trunk-reorg/projects/scrabble/website/images/de/NIL.png
branches/trunk-reorg/projects/scrabble/website/images/en/NIL.png
Modified:
branches/trunk-reorg/projects/scrabble/src/game.lisp
branches/trunk-reorg/projects/scrabble/src/make-letters.lisp
branches/trunk-reorg/projects/scrabble/src/package.lisp
branches/trunk-reorg/projects/scrabble/src/rules.lisp
branches/trunk-reorg/projects/scrabble/src/web.lisp
branches/trunk-reorg/projects/scrabble/website/images/de/charmap.xml
branches/trunk-reorg/projects/scrabble/website/images/de/double-letter.png
branches/trunk-reorg/projects/scrabble/website/images/de/double-word.png
branches/trunk-reorg/projects/scrabble/website/images/de/triple-letter.png
branches/trunk-reorg/projects/scrabble/website/images/de/triple-word.png
branches/trunk-reorg/projects/scrabble/website/scrabble.css
branches/trunk-reorg/projects/scrabble/website/scrabble.html
branches/trunk-reorg/projects/scrabble/website/scrabble.js
Log:
Checkpoint: Various gameplay fixes, add start-field with star, add second
set of letter tiles with red lettering to signify placed blank tiles. Fix
json encoding for IE.
Modified: branches/trunk-reorg/projects/scrabble/src/game.lisp
===================================================================
--- branches/trunk-reorg/projects/scrabble/src/game.lisp 2007-11-17 10:28:57 UTC (rev 2284)
+++ branches/trunk-reorg/projects/scrabble/src/game.lisp 2007-11-25 05:37:30 UTC (rev 2285)
@@ -62,10 +62,11 @@
(defmethod print-object ((participant participant) stream)
(print-unreadable-object (participant stream :type t)
- (format stream "~A score: ~A, ~A tile~:P"
+ (format stream "~A score: ~A, ~A tile~:P: ~{~A~^, ~}"
(user-login (player-of participant))
(score-of participant)
- (length (tray-of participant)))))
+ (length (tray-of participant))
+ (mapcar #'letter-of (tray-of participant)))))
(defmethod tray-size ((participant participant))
(length (tray-of participant)))
@@ -133,7 +134,7 @@
(eq participant (next-participant-of game)))
(defun ensure-participants-turn (game participant)
- (unless (participants-turn-p game participant)
+ (unless (participants-turn-p game participant)
(error "It's not ~A's turn." (user-login (player-of participant)))))
(defun rotate-participants (game)
@@ -150,6 +151,12 @@
(defmethod letter-equal ((letter1 character) (letter2 (eql nil)))
nil)
+(defmethod letter-equal ((letter1 (eql nil)) (letter2 character))
+ nil)
+
+(defmethod letter-equal ((letter1 (eql nil)) (letter2 (eql nil)))
+ t)
+
(defmethod letter-equal ((tile1 tile) (tile2 tile))
(letter-equal (letter-of tile1) (letter-of tile2)))
@@ -157,9 +164,9 @@
(let ((tray-letters (mapcar #'letter-of (tray-of participant)))
(placed-letters (mapcar (compose #'letter-of #'tile-of) placed-tiles)))
(dolist (letter placed-letters)
- (let ((has-letter (find letter tray-letters :test #'letter-equal)))
+ (let ((has-letter (position letter tray-letters :test #'letter-equal)))
(unless (or has-letter (find nil tray-letters))
- (error "participant ~A does not have tile ~A" participant letter))
+ (error "participant ~A does not have tile ~A" participant letter))
(setf tray-letters
(if has-letter
(remove letter tray-letters :test #'letter-equal :count 1)
@@ -180,9 +187,12 @@
drawn))
(deftransaction make-move% (game participant placed-tiles)
+ (dolist (placed-tile placed-tiles)
+ (when (used-for placed-tile)
+ (setf (used-for (tile-of placed-tile)) (used-for placed-tile))))
(let ((words-formed (mapcar (lambda (word-result)
(cons (word-text word-result) (word-score word-result)))
- (words-formed (board-of game) placed-tiles))))
+ (words-formed (board-of game) placed-tiles))))
(dolist (placed-tile placed-tiles)
(put-letter (board-of game) (tile-of placed-tile) (x-of placed-tile) (y-of placed-tile)))
(let ((tiles-used (remove-letters-from-participant-tray participant (mapcar #'tile-of placed-tiles)))
@@ -206,7 +216,10 @@
(ensure-participant-has-tiles participant placed-tiles)
(check-move-legality (board-of game) placed-tiles)
(make-move% game participant (mapcar (lambda (placement)
- (list (x-of placement) (y-of placement) (tile-of placement)))
+ (list (x-of placement)
+ (y-of placement)
+ (tile-of placement)
+ (used-for placement)))
placed-tiles)))
(defclass move-withdrawal (store-object)
Modified: branches/trunk-reorg/projects/scrabble/src/make-letters.lisp
===================================================================
--- branches/trunk-reorg/projects/scrabble/src/make-letters.lisp 2007-11-17 10:28:57 UTC (rev 2284)
+++ branches/trunk-reorg/projects/scrabble/src/make-letters.lisp 2007-11-25 05:37:30 UTC (rev 2285)
@@ -39,23 +39,30 @@
(defparameter *tile-color* '(1.0 0.98 0.8))
-(defparameter *bold-font* #.(merge-pathnames #p"../fonts/DIN/DINMd___.ttf" *default-pathname-defaults*))
-(defparameter *regular-font* #.(merge-pathnames #p"../fonts/DIN/DINRg___.ttf" *default-pathname-defaults*))
+(defparameter *bold-font* #.(merge-pathnames #p"/home/hans/fonts/DIN/DINMd___.ttf" *default-pathname-defaults*))
+(defparameter *regular-font* #.(merge-pathnames #p"/home/hans/fonts/DIN/DINRg___.ttf" *default-pathname-defaults*))
-(defun make-letter-tile (char score)
+(defun make-letter-tile (char score blank-used)
(with-canvas (:width 34 :height 34)
(let* ((bold-font (get-font *bold-font*))
(regular-font (get-font *regular-font*))
(char-string (princ-to-string char))
- (pathname (make-pathname :name (if (and char (> (char-code char) 127))
- (char-name char)
- char-string)
+ (filename (format nil "~A~@[-blank~]"
+ (if char
+ (if (> (char-code char) 127)
+ (char-name char)
+ char-string)
+ "null")
+ blank-used))
+ (pathname (make-pathname :name filename
:type "png")))
(apply #'set-rgb-fill *tile-color*)
(rounded-rectangle 0 0 34 34 4 4)
(fill-path)
(when char
- (set-rgb-fill 0 0 0)
+ (if (and blank-used char)
+ (set-rgb-fill 0.9 0 0)
+ (set-rgb-fill 0 0 0))
(set-font bold-font 27)
(draw-centered-string 13 7 char-string)
(set-font regular-font 11)
@@ -77,11 +84,12 @@
:external-format :utf-8)
(cxml:with-xml-output (cxml:make-character-stream-sink letter-map-file)
(cxml:with-element "chars"
- (dolist (entry (gethash language *tile-sets*))
+ (dolist (entry (getf *tile-sets* language))
(destructuring-bind (letter score count) entry
(declare (ignore count))
(cxml:with-element "char"
- (cxml:attribute "filename" (namestring (make-letter-tile letter score)))
+ (cxml:attribute "filename" (namestring (make-letter-tile letter score nil)))
+ (cxml:attribute "blank-filename" (namestring (make-letter-tile letter score t)))
(cxml:text (princ-to-string letter)))))))))
(defun make-cursor ()
@@ -92,6 +100,21 @@
(stroke)
(save-png #P"cursor.png")))
+(defun draw-star (size border)
+ (with-graphics-state
+ (let ((half-size (/ size 2))
+ (angle 0)
+ (step (* 2 (/ (* pi 2) 5))))
+ (translate (+ border half-size) (+ border half-size))
+ (move-to 0 half-size)
+ (dotimes (i 5)
+ (setf angle (+ angle step))
+ (line-to (* (sin angle) half-size)
+ (* (cos angle) half-size)))
+ (close-subpath)
+ (set-rgb-fill 0 0 0)
+ (fill-path))))
+
(defun make-special-field (name color &key text star)
(with-canvas (:width 40 :height 40)
(let ((regular-font (get-font *regular-font*)))
@@ -108,7 +131,7 @@
(draw-centered-string 20 position line)
(decf position 6))))
(star
- ))
+ (draw-star 30 5)))
(save-png (make-pathname :name (string-downcase (symbol-name name)) :type "png")))))
(defun make-special-field-set (language)
@@ -117,7 +140,7 @@
(getf *special-field-colors* tile-name)
:text (getf (gethash language *special-field-texts*) tile-name)))
(make-special-field :standard (getf *special-field-colors* :standard) :star nil)
- (make-special-field :standard (getf *special-field-colors* :double-word) :star t))
+ (make-special-field :start-field (getf *special-field-colors* :double-word) :star t))
(defun make-tile-set (directory language)
(let ((*default-pathname-defaults*
@@ -128,3 +151,21 @@
(make-letter-tile-set language)
(make-special-field-set language)
(make-cursor)))
+
+
+
+(defun star-test (size border)
+ (with-canvas (:width size :height size)
+ (let ((star-size (/ (- size (* 2 border)) 2))
+ (angle 0)
+ (step (* 2 (/ (* pi 2) 5))))
+ (translate (+ border star-size) (+ border star-size))
+ (move-to 0 star-size)
+ (dotimes (i 5)
+ (setf angle (+ angle step))
+ (line-to (* (sin angle) star-size)
+ (* (cos angle) star-size)))
+ (close-subpath)
+ (set-rgb-fill 0 0 0)
+ (fill-path)
+ (save-png "/home/hans/bknr-svn/projects/scrabble/website/images/de/star.png"))))
Modified: branches/trunk-reorg/projects/scrabble/src/package.lisp
===================================================================
--- branches/trunk-reorg/projects/scrabble/src/package.lisp 2007-11-17 10:28:57 UTC (rev 2284)
+++ branches/trunk-reorg/projects/scrabble/src/package.lisp 2007-11-25 05:37:30 UTC (rev 2285)
@@ -12,7 +12,10 @@
"TILE"
"LETTER-OF"
+ "LETTER-NAME-OF"
"VALUE-OF"
+ "BLANK-TILE"
+ "USED-FOR"
"BOARD"
"AT-XY"
@@ -43,6 +46,9 @@
"MOVE-WITHDRAWAL"
"REASON-OF"
+ "TILE-SWAP"
+ "COUNT-OF"
+
"GAME"
"LANGUAGE-OF"
"PARTICIPANTS-OF"
Modified: branches/trunk-reorg/projects/scrabble/src/rules.lisp
===================================================================
--- branches/trunk-reorg/projects/scrabble/src/rules.lisp 2007-11-17 10:28:57 UTC (rev 2284)
+++ branches/trunk-reorg/projects/scrabble/src/rules.lisp 2007-11-25 05:37:30 UTC (rev 2285)
@@ -24,15 +24,20 @@
(defclass tile-placement ()
((x :reader x-of :initarg :x)
(y :reader y-of :initarg :y)
- (tile :reader tile-of :initarg :tile))
+ (tile :reader tile-of :initarg :tile)
+ (used-for :reader used-for :initarg :used-for))
(:documentation "Represents placement of a letter tile on the board"))
(defmethod print-object ((tile-placement tile-placement) stream)
(print-unreadable-object (tile-placement stream :type t)
- (format stream "~A ~A => ~A" (x-of tile-placement) (y-of tile-placement) (tile-of tile-placement))))
+ (format stream "~A ~A => ~A ~@[(~A)~]"
+ (x-of tile-placement)
+ (y-of tile-placement)
+ (tile-of tile-placement)
+ (used-for tile-placement))))
-(defun make-tile-placement (x y tile)
- (make-instance 'tile-placement :x x :y y :tile tile))
+(defun make-tile-placement (x y tile used-for)
+ (make-instance 'tile-placement :x x :y y :tile tile :used-for used-for))
(defun make-tile-placements (list-of-moves)
(mapcar (curry #'apply 'make-tile-placement) list-of-moves))
@@ -60,7 +65,7 @@
(terpri stream)
(dotimes (x 15)
(dotimes (y 15)
- (format stream "~C " (aif (at-xy board x y) (letter-of it) #\.)))
+ (format stream "~C " (aif (at-xy board x y) (used-for it) #\.)))
(terpri stream))))
(defmethod at-xy ((board board) x y)
@@ -77,14 +82,47 @@
(value :reader value-of :initarg :value))
(:metaclass persistent-class))
+(defmethod used-for ((tile tile))
+ (letter-of tile))
+
+(defclass blank-tile (tile)
+ ((used-for :accessor used-for :initform nil))
+ (:default-initargs :letter nil :value 0)
+ (:metaclass persistent-class))
+
+(defmethod letter-name-of ((character character))
+ (if (and (char-name character)
+ (< 127 (char-code character)))
+ (string-upcase (char-name character))
+ (make-string 1 :initial-element character)))
+
+(defmethod letter-name-of ((tile tile))
+ (letter-name-of (letter-of tile)))
+
+(defmethod letter-name-of ((tile blank-tile))
+ (awhen (used-for tile)
+ (letter-name-of it)))
+
(defmethod print-object ((tile tile) stream)
(print-unreadable-object (tile stream :type t :identity nil)
(with-slots (letter value) tile
- (format stream "~A (~A) ID:~A" (when letter (char-name letter)) value (store-object-id tile)))))
+ (format stream "~A (~A) ID:~A" (when letter (letter-name-of letter)) value (store-object-id tile)))))
-(defun make-tile (letter value)
+(defmethod print-object ((tile blank-tile) stream)
+ (print-unreadable-object (tile stream :type t :identity nil)
+ (with-slots (letter value) tile
+ (format stream "~@[used for ~A ~]ID:~A"
+ (when (used-for tile)
+ (letter-name-of (used-for tile)))
+ (store-object-id tile)))))
+
+(defmethod make-tile ((letter character) value)
(make-object 'tile :letter letter :value value))
+(defmethod make-tile ((letter (eql nil)) value)
+ (declare (ignore value))
+ (make-object 'blank-tile))
+
(defmethod placed-tile-adjacent ((board board) (tile-placement tile-placement))
"Check whether the given TILE-PLACEMENT on the board is adjacent to
another tile or if it is the start position."
@@ -125,7 +163,7 @@
(error 'not-in-a-row))
(when (some (curry #'at-placement board) placed-tiles)
- (error 'tile-placed-on-occupied-field))
+ (error 'placed-on-occupied-field))
(unless (equal placed-tiles
(remove-duplicates placed-tiles :test #'equal-position))
@@ -142,7 +180,7 @@
(unless (or (find '(7 7) placed-tiles :test #'position-equal)
(some (curry #'placed-tile-adjacent board) placed-tiles))
(error 'not-touching-other-tile))
-
+
t)
(defmethod x-of ((placement list))
@@ -154,6 +192,9 @@
(defmethod tile-of ((placement list))
(third placement))
+(defmethod used-for ((placement list))
+ (fourth placement))
+
(defun words-formed% (board placed-tiles verticalp)
"Scan for words that would be formed by placing PLACED-TILES on
BOARD. VERTICALP determines the scan order, if nil, the board is
@@ -164,11 +205,13 @@
(when (find x placed-tiles :key (if verticalp #'y-of #'x-of) :test #'=)
(let (word is-new-word)
(dotimes (y 15)
- (multiple-value-bind (placed-tile being-placed) (placed-or-being-placed board placed-tiles (if verticalp (list y x) (list x y)))
+ (multiple-value-bind (placed-tile being-placed)
+ (placed-or-being-placed board placed-tiles (if verticalp (list y x) (list x y)))
(when (and word (null placed-tile))
(when (and (cdr word) is-new-word)
(push (nreverse word) words))
- (setf word nil is-new-word nil))
+ (setf word nil
+ is-new-word nil))
(when placed-tile
(push (list placed-tile (and being-placed (field-type x y))) word)
(when being-placed
@@ -205,5 +248,4 @@
(defun word-text (word-result)
"Convert the letter in a word result returned by WORDS-FORMED to a
string."
- (coerce (mapcar (compose #'letter-of #'car) word-result) 'string))
-
+ (coerce (mapcar (compose #'used-for #'car) word-result) 'string))
Modified: branches/trunk-reorg/projects/scrabble/src/web.lisp
===================================================================
--- branches/trunk-reorg/projects/scrabble/src/web.lisp 2007-11-17 10:28:57 UTC (rev 2284)
+++ branches/trunk-reorg/projects/scrabble/src/web.lisp 2007-11-25 05:37:30 UTC (rev 2285)
@@ -6,27 +6,43 @@
(defun encode-json-plist (plist stream)
(princ #\{ stream)
- (loop for (key value) on plist by #'cddr
+ (loop for (key value &rest rest) on plist by #'cddr
do (encode-json key stream)
do (princ #\: stream)
do (encode-json value stream)
+ when rest
do (princ #\, stream))
(princ #\} stream))
(defmethod encode-json ((object store-object) stream)
- (princ #\{ stream)
- (dolist (slotdef (closer-mop:class-slots (class-of object)))
- (when (and (slot-boundp object (closer-mop:slot-definition-name slotdef))
- (not (find (closer-mop:slot-definition-name slotdef) *ignore-slots*)))
- (encode-json (closer-mop:slot-definition-name slotdef) stream)
- (princ #\: stream)
- (encode-json (slot-value object (closer-mop:slot-definition-name slotdef)) stream)
- (princ #\, stream)))
- (princ #\} stream))
+ (let (printed)
+ (princ #\{ stream)
+ (dolist (slotdef (closer-mop:class-slots (class-of object)))
+ (when (and (slot-boundp object (closer-mop:slot-definition-name slotdef))
+ (not (find (closer-mop:slot-definition-name slotdef) *ignore-slots*)))
+ (if printed
+ (princ #\, stream)
+ (setf printed t))
+ (encode-json (closer-mop:slot-definition-name slotdef) stream)
+ (princ #\: stream)
+ (encode-json (slot-value object (closer-mop:slot-definition-name slotdef)) stream)))
+ (princ #\} stream)))
(defmethod encode-json ((tile-bag tile-bag) stream)
(encode-json-plist (list :remaining-tiles (remaining-tile-count tile-bag)) stream))
+(defmethod encode-json ((tile tile) stream)
+ (encode-json-plist (list :letter (letter-name-of tile)
+ :value (value-of tile))
+ stream))
+
+(defmethod encode-json ((tile blank-tile) stream)
+ (encode-json-plist (append (list :letter nil
+ :value 0)
+ (awhen (used-for tile)
+ (list :used-for it)))
+ stream))
+
(defmethod encode-json ((move move) stream)
(encode-json-plist (list :type "move"
:participant-login (user-login (player-of (participant-of move)))
@@ -44,17 +60,30 @@
:reason (or (reason-of move) ""))
stream))
+(defmethod encode-json ((move tile-swap) stream)
+ (encode-json-plist (list :type "tile-swap"
+ :participant-login (user-login (player-of (participant-of move)))
+ :reason (count-of move))
+ stream))
+
(defmethod encode-json ((board board) stream)
- (princ #\[ stream)
- (dotimes (x 15)
- (dotimes (y 15)
- (awhen (at-xy board x y)
- (encode-json (list x y (letter-of it) (value-of it)) stream)
- (princ #\, stream))))
- (princ #\] stream))
+ (let (printed)
+ (princ #\[ stream)
+ (dotimes (x 15)
+ (dotimes (y 15)
+ (awhen (at-xy board x y)
+ (if printed
+ (princ #\, stream)
+ (setf printed t))
+ (encode-json (append (list x y (letter-name-of it))
+ (when (typep it 'scrabble::blank-tile)
+ (list 1)))
+ stream))))
+ (princ #\] stream)))
(defmethod encode-json ((participant participant) stream)
(start-session)
+ (format t "user: ~A~%" (session-value :user))
(encode-json-plist (append (list :login (user-login (player-of participant))
:name (user-full-name (player-of participant))
:remaining-tiles)
@@ -84,27 +113,31 @@
(:tr (:td) (:td (:input :type "SUBMIT")))))))))
(defun parse-move (participant string)
- "Given a string X1,Y1,LETTER1,X2,Y2,LETTER2..., return a list of
-moves ((X1 Y1 LETTER-TILE2) (X2 Y2 LETTER-TILE2) ...). LETTERx may
-either be a single-character letter which will be used directly or a
-character name (like LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS) which will
-be converted into a character using NAME-CHAR."
+ "Given a string X1,Y1,LETTER1,FLAG1,X2,Y2,LETTER2,FLAG2..., return a
+list of moves ((X1 Y1 LETTER-TILE1 FLAG1) (X2 Y2 LETTER-TILE2 FLAG2)
+...). LETTERx may either be a single-character letter which will be
+used directly or a character name (like
+LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS) which will be converted into a
+character using NAME-CHAR."
(let ((tray (tray-of participant))
list-of-moves)
(labels
- ((use-letter (letter)
- (awhen (or (find letter tray :key #'letter-of)
- (find nil tray :key #'letter-of))
+ ((use-letter (letter is-blank)
+ (format t "use-letter ~A ~A~%" letter is-blank)
+ (awhen (find (if is-blank nil letter) tray :key #'letter-of)
(setf tray (remove it tray))
(return-from use-letter it))
(error "tray of ~A does not contain letter ~A" participant letter))
- (recurse (x-string y-string letter &rest more)
- (push (list (parse-integer x-string)
- (parse-integer y-string)
- (use-letter (if (= 1 (length letter))
- (aref letter 0)
- (name-char letter))))
- list-of-moves)
+ (recurse (x-string y-string letter is-blank &rest more)
+ (let ((letter (if (= 1 (length letter))
+ (aref letter 0)
+ (name-char letter)))
+ (is-blank (string-equal "true" is-blank)))
+ (push (list (parse-integer x-string)
+ (parse-integer y-string)
+ (use-letter letter is-blank)
+ (when is-blank letter))
+ list-of-moves))
(when more
(apply #'recurse more))))
(apply #'recurse (split "," string)))
Added: branches/trunk-reorg/projects/scrabble/website/images/de/A-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/A-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/B-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/B-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/C-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/C-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/D-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/D-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/E-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/E-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/F-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/F-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/G-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/G-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/H-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/H-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/I-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/I-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/J-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/J-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/K-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/K-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/L-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/L-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/M-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/M-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/N-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/N-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: branches/trunk-reorg/projects/scrabble/website/images/de/NIL.png
===================================================================
(Binary files differ)
Added: branches/trunk-reorg/projects/scrabble/website/images/de/O-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/O-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/P-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/P-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/Q-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/Q-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/R-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/R-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/S-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/S-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/T-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/T-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/U-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/U-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/V-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/V-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/W-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/W-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/X-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/X-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/Y-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/Y-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/trunk-reorg/projects/scrabble/website/images/de/Z-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/Z-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/trunk-reorg/projects/scrabble/website/images/de/charmap.xml
===================================================================
--- branches/trunk-reorg/projects/scrabble/website/images/de/charmap.xml 2007-11-17 10:28:57 UTC (rev 2284)
+++ branches/trunk-reorg/projects/scrabble/website/images/de/charmap.xml 2007-11-25 05:37:30 UTC (rev 2285)
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
-<chars><char filename="A.png">A</char><char filename="B.png">B</char><char filename="C.png">C</char><char filename="D.png">D</char><char filename="E.png">E</char><char filename="F.png">F</char><char filename="G.png">G</char><char filename="H.png">H</char><char filename="I.png">I</char><char filename="J.png">J</char><char filename="K.png">K</char><char filename="L.png">L</char><char filename="M.png">M</char><char filename="N.png">N</char><char filename="O.png">O</char><char filename="P.png">P</char><char filename="Q.png">Q</char><char filename="R.png">R</char><char filename="S.png">S</char><char filename="T.png">T</char><char filename="U.png">U</char><char filename="V.png">V</char><char filename="W.png">W</char><char filename="X.png">X</char><char filename="Y.png">Y</char><char filename="Z.png">Z</char><char filename="LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS.png">Ä</char><char filename="LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS.png">Ö</char><char filename="LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS.png">Ü</char><char filename="NIL.png">NIL</char></chars>
\ No newline at end of file
+<chars><char filename="A.png" blank-filename="A-blank.png">A</char><char filename="B.png" blank-filename="B-blank.png">B</char><char filename="C.png" blank-filename="C-blank.png">C</char><char filename="D.png" blank-filename="D-blank.png">D</char><char filename="E.png" blank-filename="E-blank.png">E</char><char filename="F.png" blank-filename="F-blank.png">F</char><char filename="G.png" blank-filename="G-blank.png">G</char><char filename="H.png" blank-filename="H-blank.png">H</char><char filename="I.png" blank-filename="I-blank.png">I</char><char filename="J.png" blank-filename="J-blank.png">J</char><char filename="K.png" blank-filename="K-blank.png">K</char><char filename="L.png" blank-filename="L-blank.png">L</char><char filename="M.png" blank-filename="M-blank.png">M</char><char filename="N.png" blank-filename="N-blank.png">N</char><char filename="O.png" blank-filename="O-blank.png">O</char><char filename="P.png" blank-filename="P-blank.png">P</char><char filename="Q.png" blank-filename="Q-blank.png">Q</char><char filename="R.png" blank-filename="R-blank.png">R</char><char filename="S.png" blank-filename="S-blank.png">S</char><char filename="T.png" blank-filename="T-blank.png">T</char><char filename="U.png" blank-filename="U-blank.png">U</char><char filename="V.png" blank-filename="V-blank.png">V</char><char filename="W.png" blank-filename="W-blank.png">W</char><char filename="X.png" blank-filename="X-blank.png">X</char><char filename="Y.png" blank-filename="Y-blank.png">Y</char><char filename="Z.png" blank-filename="Z-blank.png">Z</char><char filename="LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS.png" blank-filename="LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS-blank.png">Ä</char><char filename="LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS.png" blank-filename="LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS-blank.png">Ö</char><char filename="LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS.png" blank-filename="LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS-blank.png">Ü</char><char filename="null.png" blank-filename="null-blank.png">NIL</char></chars>
\ No newline at end of file
Modified: branches/trunk-reorg/projects/scrabble/website/images/de/double-letter.png
===================================================================
(Binary files differ)
Modified: branches/trunk-reorg/projects/scrabble/website/images/de/double-word.png
===================================================================
(Binary files differ)
Added: branches/trunk-reorg/projects/scrabble/website/images/de/null-blank.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/null-blank.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: branches/trunk-reorg/projects/scrabble/website/images/de/null.png (from rev 2277, branches/trunk-reorg/projects/scrabble/website/images/de/NIL.png)
Added: branches/trunk-reorg/projects/scrabble/website/images/de/start-field.png
===================================================================
(Binary files differ)
Property changes on: branches/trunk-reorg/projects/scrabble/website/images/de/start-field.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/trunk-reorg/projects/scrabble/website/images/de/triple-letter.png
===================================================================
(Binary files differ)
Modified: branches/trunk-reorg/projects/scrabble/website/images/de/triple-word.png
===================================================================
(Binary files differ)
Deleted: branches/trunk-reorg/projects/scrabble/website/images/en/NIL.png
===================================================================
(Binary files differ)
Copied: branches/trunk-reorg/projects/scrabble/website/images/en/null.png (from rev 2277, branches/trunk-reorg/projects/scrabble/website/images/en/NIL.png)
Modified: branches/trunk-reorg/projects/scrabble/website/scrabble.css
===================================================================
--- branches/trunk-reorg/projects/scrabble/website/scrabble.css 2007-11-17 10:28:57 UTC (rev 2284)
+++ branches/trunk-reorg/projects/scrabble/website/scrabble.css 2007-11-25 05:37:30 UTC (rev 2285)
@@ -1,2 +1,2 @@
body { background-color: #004B36; color: #ffffff; font-family: sans-serif }
-#playfield { position: absolute }
+#playfield { position: absolute; top: 0px; left: 0px }
Modified: branches/trunk-reorg/projects/scrabble/website/scrabble.html
===================================================================
--- branches/trunk-reorg/projects/scrabble/website/scrabble.html 2007-11-17 10:28:57 UTC (rev 2284)
+++ branches/trunk-reorg/projects/scrabble/website/scrabble.html 2007-11-25 05:37:30 UTC (rev 2285)
@@ -10,7 +10,7 @@
<script type="text/javascript" src="scrabble.js"> </script>
</head>
<body onload="init()">
- <div id='playfield'>
+ <div id="playfield">
</div>
<div style="position: absolute; right: 20px; top: 20px;"><a style="color: white;" href="/login?login=user1">user1</a></div>
<div style="position: absolute; right: 20px; top: 40px;"><a style="color: white;" href="/login?login=user2">user2</a></div>
Modified: branches/trunk-reorg/projects/scrabble/website/scrabble.js
===================================================================
--- branches/trunk-reorg/projects/scrabble/website/scrabble.js 2007-11-17 10:28:57 UTC (rev 2284)
+++ branches/trunk-reorg/projects/scrabble/website/scrabble.js 2007-11-25 05:37:30 UTC (rev 2285)
@@ -39,7 +39,7 @@
// return if the move is legal.
var positions = map(function (placement) { return [ placement[0], placement[1] ] }, placedTiles)
- .sort(function (a, b) { (a[0] > b[0]) || (a[1] > b[1])});
+ .sort(function (a, b) { return (a[0] - b[0]) || (a[1] - b[1])});
if (filter(partial(operator.ne, positions[0][0]), map(function (position) { return position[0] }, positions)).length
&& filter(partial(operator.ne, positions[0][1]), map(function (position) { return position[1] }, positions)).length) {
@@ -59,8 +59,8 @@
if (findValue(positions, [ 7, 7 ]) == -1) {
var found = false;
- for (var x = startOfPlacement[0]; !found && x <= endOfPlacement[0]; x++) {
- for (var y = startOfPlacement[1]; !found && y <= endOfPlacement[1]; y++) {
+ for (var x = startOfPlacement[0]; !found && (x <= endOfPlacement[0]); x++) {
+ for (var y = startOfPlacement[1]; !found && (y <= endOfPlacement[1]); y++) {
if (((x > 0) && letterAt(x - 1, y))
|| ((x < 14) && letterAt(x + 1, y))
|| ((y > 0) && letterAt(x, y - 1))
@@ -83,6 +83,7 @@
}
var theirTrays;
+var tray = [];
var gameID = 108;
var board;
@@ -99,7 +100,8 @@
element.style.position = 'absolute';
element.style.width = '40px';
element.style.height = '40px';
- element.style.backgroundImage = 'url(images/' + getFieldScore(x, y) + '.png)';
+ var imageName = (x == 7 && y == 7) ? "start-field" : getFieldScore(x, y);
+ element.style.backgroundImage = 'url(images/' + imageName + '.png)';
element.x = x;
element.y = y;
setElementPosition(element, { x: border + x * 44, y: border + y * 44 });
@@ -109,13 +111,6 @@
appendChildNodes(container, board[x]);
}
- myTrayContainer = DIV();
- myTrayContainer.style.position = 'absolute';
- myTrayContainer.style.width = 7 * 44 + 'px';
- myTrayContainer.style.height = '44px';
- setElementPosition(myTrayContainer, { x: border + 194, y: border + 665 });
- appendChildNodes(container, myTrayContainer);
-
theirTrays = DIV();
theirTrays.style.position = 'absolute';
theirTrays.style.width = 7 * 44 + 'px';
@@ -138,25 +133,34 @@
// appendChildNodes(container, clearButton);
}
-function setLetter(x, y, letter, justPlaced) {
- var image = IMG({ src: 'images/' + letter + '.png'});
+function setLetter(x, y, letter, isBlank) {
+ var image = IMG({ src: 'images/' + letter + (isBlank ? "-blank" : "") + '.png'});
image.style.position = 'absolute';
image.style.top = '3px';
image.style.left = '3px';
- replaceChildNodes(board[x][y], image);
- if (justPlaced) {
- var mask = IMG({ src: 'images/mask.png'});
- mask.style.position = 'absolute';
- mask.style.top = '3px';
- mask.style.left = '3px';
- appendChildNodes(board[x][y], mask);
- }
+ setElementPosition(image, { x: border + x * 44 + 3, y: border + y * 44 + 3 });
+ appendChildNodes($('playfield'), image);
board[x][y].letterNode = image;
board[x][y].letter = letter;
- board[x][y].justPlaced = justPlaced;
- YAHOO.util.Event.purgeElement(board[x][y], false, 'click');
}
+function placeLetter(x, y, tile) {
+ var mask = IMG({ src: 'images/mask.png'});
+ mask.style.position = 'absolute';
+ mask.style.top = '3px';
+ mask.style.left = '3px';
+ mask.style.zIndex = '20';
+ appendChildNodes(board[x][y], mask);
+ board[x][y].letterNode = tile;
+ board[x][y].letter = tile.letter;
+ board[x][y].justPlaced = true;
+ tile.anim = new YAHOO.util.Motion(tile, { points: { to: [ border + x * 44 + 3,
+ border + y * 44 + 3 ]}},
+ 0.15,
+ YAHOO.util.Easing.easeBoth);
+ tile.anim.animate();
+}
+
function letterAt(x, y) {
return board[x][y].letter && !board[x][y].justPlaced;
}
@@ -176,12 +180,14 @@
this.set = function(x, y) {
this.x = x;
this.y = y;
- replaceChildNodes(board[x][y], this.image);
+ appendChildNodes(board[x][y], this.image);
+ board[x][y].cursor = this.image;
};
this.clear = function() {
if (this.x != -1) {
- replaceChildNodes(board[this.x][this.y]);
+ removeElement(board[this.x][this.y].cursor);
+ board[this.x][this.y].cursor = undefined;
this.x = this.y = -1;
this.direction = 0;
}
@@ -211,18 +217,8 @@
this.direction = direction;
if (this.direction == horizontal) {
x++;
- for (; x < 15; x++) {
- if (board[x][y].childNodes.length == 0) {
- break;
- }
- }
} else {
y++;
- for (; y < 15; y++) {
- if (board[x][y].childNodes.length == 0) {
- break;
- }
- }
}
if ((x != 15) && (y != 15)) {
this.set(x, y);
@@ -239,8 +235,8 @@
var move = [];
-function makeMove(x, y, letter) {
- move[move.length] = [x, y, letter];
+function makeMove(x, y, letter, isBlank) {
+ move[move.length] = [x, y, letter, isBlank];
try {
checkMoveLegality(move);
$('move').onclick = submitMove;
@@ -299,9 +295,30 @@
var letter = specialKeyCodes[args[0]] || String.fromCharCode(args[0]);
var x = cursor.x;
var y = cursor.y;
- cursor.advance();
- setLetter(x, y, letter, true);
- makeMove(x, y, letter);
+ var tilePosition = -1;
+ for (var i = 0; (tilePosition == -1) && (i < tray.length); i++) {
+ if (tray[i].letter == letter) {
+ tilePosition = i;
+ }
+ }
+ if (tilePosition == -1) {
+ for (var i = 0; (tilePosition == -1) && (i < tray.length); i++) {
+ if (tray[i].letter == undefined) {
+ tilePosition = i;
+ }
+ }
+ }
+ if (tilePosition == -1) {
+ alert("You don't have that letter!");
+ } else {
+ cursor.advance();
+ if (!letterAt(x, y)) {
+ var tile = tray[tilePosition];
+ tray.splice(tilePosition, 1);
+ placeLetter(x, y, tile);
+ makeMove(x, y, letter, tile.letter == undefined);
+ }
+ }
}
var leftKey = 37;
@@ -358,8 +375,6 @@
}
}
-var tray;
-
function trayClick(letter) {
this.clicked = !this.clicked;
this.anim = new YAHOO.util.Motion(this, { points: { by: [ 0, (this.clicked ? 15 : -15 ) ]}}, 0.15);
@@ -367,6 +382,7 @@
}
function makeMyTray(letters) {
+ map(removeElement, tray);
tray = [];
for (var i = 0; i < letters.length; i++) {
var element = IMG({src: 'images/' + letters[i] + '.png'});
@@ -374,11 +390,13 @@
element.style.position = 'absolute';
element.style.width = '34px';
element.style.height = '34px';
+ element.style.zIndex = '10';
element.onclick = trayClick;
- setElementPosition(element, { x: i * 40 });
+ // setElementPosition(element, { x: border + 194 + i * 40, y: border + 665 });
+ YAHOO.util.Dom.setXY(element, [ border + 194 + i * 40, border + 665 ]);
tray[i] = element;
}
- replaceChildNodes(myTrayContainer, tray);
+ appendChildNodes($('playfield'), tray);
}
function shuffleMyTray() {
@@ -401,7 +419,7 @@
function addTheirTray (participant) {
appendChildNodes(theirTrays, DIV(null,
DIV(null, participant.name),
- DIV(null, map(function () { return IMG({ src: 'images/NIL.png' }) },
+ DIV(null, map(function () { return IMG({ src: 'images/null.png' }) },
new Array(participant.remainingTiles)))));
}
@@ -410,7 +428,7 @@
var x = gameState.board[i][0];
var y = gameState.board[i][1];
var char = gameState.board[i][2];
- setLetter(x, y, char);
+ setLetter(x, y, char, gameState.board[i].length > 3);
}
for (var i = 0; i < gameState.participants.length; i++) {
var participant = gameState.participants[i];
@@ -451,5 +469,5 @@
setElementPosition(moveDisplay, { x: border + 550, y: border + 665 });
appendChildNodes(document.body, moveDisplay);
var d = loadJSONDoc("/game/" + gameID);
- d.addCallbacks(drawGameState, alert);
+ d.addCallbacks(drawGameState, function (error) { alert("Request error: " + error.message); });
}