p412 draw-dod-page function

67 views
Skip to first unread message

reverland

unread,
Jul 2, 2012, 1:22:32 AM7/2/12
to land-o...@googlegroups.com
I tried to cancell the selected tile with double click.but I didn't find the selected tile was added in the legal-tiles.So that may be an error?
I just made the draw-dod-page function a little change to make it work:
(defun draw-dod-page (tree selected-tile)
  (svg *board-width* ;small change should be made to svg macro,reffred to the errata
       *board-height*
       (draw-board-svg (cadr tree)
                       selected-tile
                       (cons selected-tile ;what I added
                             (take-all (if selected-tile
                                   (lazy-mapcar
                                     (lambda (move)
                                       (when (eql (caar move)
                                                  selected-tile)
                                         (cadar move)))
                                     (caddr tree))
                                   (lazy-mapcar #'caar (caddr tree))))))))
Hope helpful.

Yuyang Liu

unread,
Jul 6, 2012, 11:04:21 AM7/6/12
to land-o...@googlegroups.com
Maybe I make some mistakes,with this change the game becomes strange……human player can occupy every tile whenever they have more than one dices in the source hex……Any one have an idea?

2012/7/2 reverland <lht...@gmail.com>



--
yours sincerely
Reverland
Lyy

Kazuya NUMATA

unread,
Sep 10, 2013, 7:58:56 PM9/10/13
to land-o...@googlegroups.com
draw-board-svg's third argument needs the selected-tile if a tile is selected.

I added (lazy-cons selected-tile in front of (lazy-mapcar...  and work expectedly.

(defun draw-dod-page (tree selected-tile)
  (svg *board-width*
       *board-height*
       (draw-board-svg (cadr tree)
      selected-tile
      (take-all (if selected-tile
    (lazy-cons selected-tile (lazy-mapcar
      (lambda (move)
(when (eql (caar move)
   selected-tile)
  (cadar move)))
      (caddr tree)))
    (lazy-mapcar #'caar (caddr tree)))))))



2012年7月7日土曜日 0時04分21秒 UTC+9 reverland:

Yuyang Liu

unread,
Sep 13, 2013, 2:21:08 AM9/13/13
to land-o...@googlegroups.com
Thank you, numata


2013/9/11 Kazuya NUMATA <num...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Land of Lisp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to land-of-lisp...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages