[bknr-cvs] r2288 - in branches/trunk-reorg/projects/scrabble: src website

Author: hhubner Date: 2007-11-26 06:54:55 -0500 (Mon, 26 Nov 2007) New Revision: 2288 Modified: branches/trunk-reorg/projects/scrabble/src/rules.lisp branches/trunk-reorg/projects/scrabble/src/start-webserver.lisp branches/trunk-reorg/projects/scrabble/src/web.lisp branches/trunk-reorg/projects/scrabble/website/scrabble.js Log: Prepare for first pre-alpha user test Modified: branches/trunk-reorg/projects/scrabble/src/rules.lisp =================================================================== --- branches/trunk-reorg/projects/scrabble/src/rules.lisp 2007-11-26 11:24:22 UTC (rev 2287) +++ branches/trunk-reorg/projects/scrabble/src/rules.lisp 2007-11-26 11:54:55 UTC (rev 2288) @@ -63,8 +63,8 @@ (defmethod print-object ((board board) stream) (print-unreadable-object (board stream :type t :identity t) (terpri stream) - (dotimes (x 15) - (dotimes (y 15) + (dotimes (y 15) + (dotimes (x 15) (format stream "~C " (aif (at-xy board x y) (used-for it) #\.))) (terpri stream)))) Modified: branches/trunk-reorg/projects/scrabble/src/start-webserver.lisp =================================================================== --- branches/trunk-reorg/projects/scrabble/src/start-webserver.lisp 2007-11-26 11:24:22 UTC (rev 2287) +++ branches/trunk-reorg/projects/scrabble/src/start-webserver.lisp 2007-11-26 11:54:55 UTC (rev 2288) @@ -8,8 +8,8 @@ :subsystems (list (make-instance 'store-object-subsystem))) (unless (class-instances 'user) (format t "creating test users and game~%") - (let ((user1 (make-user "user1" :class 'player :full-name "User Eins")) - (user2 (make-user "user2" :class 'player :full-name "User Zwei"))) + (let ((user1 (make-user "hans" :class 'player :full-name "Hans")) + (user2 (make-user "marna" :class 'player :full-name "Marna"))) (make-game :de (list user1 user2))))) (defparameter *website-directory* Modified: branches/trunk-reorg/projects/scrabble/src/web.lisp =================================================================== --- branches/trunk-reorg/projects/scrabble/src/web.lisp 2007-11-26 11:24:22 UTC (rev 2287) +++ branches/trunk-reorg/projects/scrabble/src/web.lisp 2007-11-26 11:54:55 UTC (rev 2288) @@ -56,8 +56,7 @@ :score (score-of move) :placed-tiles (placed-tiles-of move) :words (mapcar (lambda (word-cons) - (list :word (car word-cons) - :score (cdr word-cons))) + (list (car word-cons) (cdr word-cons))) (words-formed-of move))) stream)) Modified: branches/trunk-reorg/projects/scrabble/website/scrabble.js =================================================================== --- branches/trunk-reorg/projects/scrabble/website/scrabble.js 2007-11-26 11:24:22 UTC (rev 2287) +++ branches/trunk-reorg/projects/scrabble/website/scrabble.js 2007-11-26 11:54:55 UTC (rev 2288) @@ -118,12 +118,14 @@ setElementPosition(shuffleButton, { x: border + 480, y: border + 665 }); appendChildNodes(container, shuffleButton); -// var clearButton = DIV(null, "clear"); -// clearButton.style.color = 'white'; -// clearButton.style.position = 'absolute'; -// clearButton.onclick = clearBoard; -// setElementPosition(clearButton, { x: border + 480, y: border + 680 }); -// appendChildNodes(container, clearButton); + var gameLog = DIV({ id: 'gameLog' }, ""); + gameLog.style.position = 'absolute'; + gameLog.style.width = '280px'; + gameLog.style.height = '250px'; + gameLog.style.textAlign = 'left'; + gameLog.style.overflowY = 'scroll'; + setElementPosition(gameLog, { x: border + 680, y: border + 400 }); + appendChildNodes($('playfield'), gameLog); } function setLetter(x, y, letter, isBlank) { @@ -438,6 +440,21 @@ otherPlayerIndex++; } +function renderMoveAsText(move) +{ + var retval = move.participantLogin; + if (move.type == 'move') { + retval += " score: " + move.score; + for (var i = 0; i < move.words.length; i++) { + retval += " " + move.words[i][0] + "(" + move.words[i][1] + ")"; + } + } else { + retval += move.type; + } + + return retval; +} + function drawGameState (gameState) { for (var i = 0; i < gameState.board.length; i++) { var x = gameState.board[i][0]; @@ -453,6 +470,9 @@ makeMyTray(map(function (entry) { return entry.letter }, participant.remainingTiles)); } } + for (var i = 0; i < gameState.moves.length; i++) { + appendChildNodes($('gameLog'), DIV(null, renderMoveAsText(gameState.moves[i]))); + } } var legalLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
participants (1)
-
bknr@bknr.net