Version 37 of Random Poetry Chalkboard

Updated 2009-01-25 15:17:39 by gold

Random_Poetry_Chalkboard


       This page is under development. Comments are
       welcome, but please load any comments
       at the bottom of the page. Thanks,[gold]

This page uses Tcl8/Expect 5.2 for windows to develop random Poetry. (note: file is working in Expect5.2, but i did not put in statement "require Expect5.2" since lock with report error on some ports.) For example, we are laying out tiles in random colors imprinted with text and symbols applied randomly.

Would also like to develop a crude Mahjong program using some of these subroutines.

In developing a computer program or application, it is helpful to develop analogs for the individual tasks of the application.

horizontal bar code of 6 lines.

In the process of designing the basic subroutine tasks, we could throw in some canned errors ( stored in subroutines). Such rule breaking helps keep the finished program more flexible.


Program Listing

       


     #!/usr/bin/env wish
        #start of deck
        #Random Poetry Chalkboard
        # 5Jan2009, [gold]
        set goblins { gray60 gray70 gray80 gray85 gray90 gray95 \
    snow1 snow2 snow3 snow4 seashell1 seashell2 \
    seashell3 seashell4 AntiqueWhite1 AntiqueWhite2 AntiqueWhite3 \
    DarkSlateGray1 DarkSlateGray2 DarkSlateGray3 \
    aquamarine4 DarkSeaGreen1 DarkSeaGreen2 DarkSeaGreen3 \
    PaleGreen1 PaleGreen2 PaleGreen3 PaleGreen4 SpringGreen1 \
    green3 green4 chartreuse1 chartreuse2 chartreuse3 \
    chartreuse4 OliveDrab1 OliveDrab2 OliveDrab3 OliveDrab4 \
    coral2 coral3 coral4 tomato1 tomato2 tomato3 tomato4 \
    red4 DeepPink1 DeepPink2 DeepPink3 DeepPink4 HotPink1 \
    HotPink2 HotPink3 HotPink4 pink1 pink2 pink3 pink4 \
    PaleVioletRed2 PaleVioletRed3 PaleVioletRed4 maroon1 \
    VioletRed4 magenta1 magenta2 magenta3 magenta4 orchid1 \
    orchid2 orchid3 orchid4 plum1 plum2 plum3 plum4 \
    DarkOrchid1 DarkOrchid2 DarkOrchid3 DarkOrchid4 purple1 \
    MediumPurple3 MediumPurple4 thistle1 thistle2 thistle3 \

}
#    set testlist2 [split $goblins ]
#
# Example 30-1
# A text widget and two scrollbars.
#

        proc Scrolled_Text { f args } {
        frame $f
        eval {text $f.text -wrap word \
                -xscrollcommand [list $f.xscroll set] \
                -yscrollcommand [list $f.yscroll set]} $args
        scrollbar $f.xscroll -orient horizontal  \
                -command [list $f.text xview]
        scrollbar $f.yscroll -orient vertical  \
                -command [list $f.text yview]
        grid $f.text $f.yscroll -sticky news
        grid $f.xscroll -sticky news
        grid rowconfigure $f 0 -weight 1
        grid columnconfigure $f 0 -weight 1
        return $f.text
}


set t [Scrolled_Text .eval -width 5 -height 3 -bg bisque]
set x [Scrolled_Text .eval2 -width 5 -height 3 -bg bisque]
pack .eval .eval2 -fill both -expand true -side bottom
$t insert end  " identified1 !!!"  ;

$x insert end  " identified2 !!!"  ;

# $t insert end  $testlist2  ;

# $x insert end  $testlist2  ;
 variable bg black  fg white  
      
   set dx 50
   set dy 50
   set size 30
   set colorground bisque
  

proc ? L {
 lindex $L [expr {int(rand()*[llength $L])}]
}

 proc lpick L {lindex $L [expr int(rand()*[llength $L])]; \
  #suchenwirth_subroutine;}
  proc poetry jill {
  set jill [lpick { tree happy grass love swan home  \
      power loss dance rose joy hate juice kick deer}]
 
  return $jill;
  }

     proc xpoetry {w x y val1 val2} {
    global jack
    global jill
     variable bg; variable fg; variable size
      set jack [lpick {red yellow blue purple \
      pink green brown black  gray}]
   set jill rose
     #remaining doctered_suchenwirth_subroutine;
     set tags [list mv d-$val1$val2];
     #remaining doctered_suchenwirth_subroutine;
     set x1 [expr {$x+$size-0.5}]
     set y1 [expr {$y+$size}]
     $w create rect $x $y [expr {$x+2*$size}] $y1 \
         -fill $jack -tags [linsert $tags 0 bd-$val1$val2]
     $w create text [expr {$x+1*$size}]   [expr {$y+0.5*$size }] \
        -text   [eval poetry $jill] -fill $fg -tags $tags

  }
  proc xxxpoetry {w x y val1 val2 rose5} {
    global jack
    global jill
     variable bg; variable fg; variable size
      set jack [lpick {red yellow blue purple \
      pink green brown black  gray}]
   set jill rose
     #remaining doctered_suchenwirth_subroutine;
     set tags [list mv d-$val1$val2];
     #remaining doctered_suchenwirth_subroutine;
     set x1 [expr {$x+$size-0.5}]
     set y1 [expr {$y+$size}]
     $w create rect $x $y [expr {$x+2*$size}] $y1 \
         -fill $jack -tags [linsert $tags 0 bd-$val1$val2]
     $w create text [expr {$x+1*$size}]   [expr {$y+0.5*$size }] \
        -text   $rose5 -fill $fg -tags $tags

  }

proc recipe {} {
  set a {
     {red} {sad} {blue} {blue}
        {glad} {glad} {deep} {black}
       {wild } { green } {pale } {bright}
       {rough } {gray } {brown } {long}
       {high } {thin} {brown } {lush}
       {dry } {poor} {lone } {far}
       {flat } {broad} {thick } {hard}
       {flat } {broad} {cool } {hard}

  }
  set b {
       {quince } { peach } {hare } {bird}
       { smoke } { rain} { ice} { snow}
        {cloud} { home} { flower } {sky}
        {rice} { pine} { mist} {door}
        {wind} { cricket} { year } {moon}
        {crane } {grass } {rose} { ink}
        {thaw} { bloom } {lake} { cedar }
        {dusk} { autumn } {stone} { dawn}
        {stream} { tree } {heart} { boat}
        {grief} { tree } {boat} { boat}
        {rock} {town} {tear} {pool}
        {silk} {deer} {song} {barge}
        {moss} {night} {gate} {fence}
        {dove} {dream} {frost} {peace}
       {shade} {ghost} {road } {path}
       {root} {horse} {eve } {sound}
       {sleep} {leaves} {sea } {sail}
       {peak} {stem} {field} {wave}
       {slope} {bark} {crest} {weed}
       {moth} {wasp} {pond} {soil}
       {snail} {worm} {ant} {kelp}
       {cave} {month} {head} {jade}
         {branch} {bone} {head} {smile}
        {pea} {bone} {head} {smile}
       {elm} { morn} {carp} {nest}
       {oak} { bone} {perch} {breeze}
    
  

  }
  set c {
  {snow} { burns} { flips} { flys }
      {lies} { walk } {flow } {fall} {fly}
       {know } {come} { meet } { drift}
     {shine } {soak} { cry } {dance}
      { lost} {cheer}  {float } {dance}
     {roost} { move} { fade} { loves}
      {sleeps} {move} {takes } {sail}
     {sits} {leaps} {sits } {sit}
     {sits} {leaps} {grows } {waits}
      {loses} {hears} {wants } {watch}
}
  set d {
         {for} {by} {towards} { to } {at} {bygone}
         {to} {in} {in } {to }
         {to} {in} {fore } {through}
     
  }

   set word1 rose
   set dy 20
   set dx 20
 for {set i 0; set y 0} {$i<8} {incr i; incr y $dy} {
for {set j 0; set x 0} {$j<8} {incr j; incr x $dx}   {
         xxxpoetry .c [expr $i*65+10] [expr $j*35+100] $i $j "[? $a]."
   
    incr j
xxxpoetry .c [expr $i*65+10] [expr $j*35+100] $i $j "[? $b]."
  
 

    incr j
xxxpoetry .c [expr $i*65+10] [expr $j*35+100] $i $j "[? $c]."
  incr j
xxxpoetry .c [expr $i*65+10] [expr $j*35+100] $i $j "[? $d]."
 incr j
xxxpoetry .c [expr $i*65+10] [expr $j*35+100] $i $j "[? $a]."
  incr j
xxxpoetry .c [expr $i*65+10] [expr $j*35+100] $i $j "[? $b]."
  } 

 }




  return " [? $a] [? $b] [? $c] [? $d] [? $a] [? $b]. "
   
}



if {[file tail [info script]]==[file tail $argv0]} {
  package require Tk
  
  pack [canvas .c -background darkgreen] -fill both -expand 1
  pack [label .ww -text "holding tank, version 2 "] 
   pack [text .t -width 40 -height 2]
   pack [label .wx -text "activate w/ mouse down "] 
   proc poetryrandom {w} {
   set dx 50
   set dy 50
   set size 30
   set word5 roset 
     for {set i 0; set y 0} {$i<8} {incr i; incr y $dy} {
     for {set j 0; set x 0} {$j<8} {incr j; incr x $dx}   {
         xpoetry .c [expr $i*65+10] [expr $j*35+100] $i $j
     }
  }
   }

   proc poetrypoetry {w} {
    set dx 50
   set dy 50
   set size 30
   set word5 roset
  recipe
   }
 bind .t <1> {showRecipe %W;$x insert end "$keeper" ;$t insert end "$keeper" ; break}
  proc showRecipe w {
    global keeper
    $w delete 1.0 end
    set keeper [recipe]
    $w insert end $keeper
    #set liner [split [$w get 1.0 end]]
    #lappend liner "/n"
    #lappend liner "rat"
    #$w insert end $liner 
    
    
    
  }
  showRecipe .t
}
  
   proc ClrCanvas {w} {

    $w delete "all"

  }




    
   #motion section
 if 0 {Clicking on a piece records \
  the click position, and its "catch-all"  tag, \
  in global variables:}
  proc mv'1 {w x y} {
     set ::_x $x; set ::_y $y;#suchenwirth subroutine;
     foreach tag [$w gettags current] {
         if [regexp ^(d-.+) $tag -> ::_tag] break
     }
  }
   if 0 {Moving the mouse with button 1 down \
  moves the items with the  "catch-all" tag \
  with the mouse pointer:}
   proc mv'motion {w x y} {
     $w raise $::_tag;#suchenwirth subroutine;
     $w move $::_tag [expr {$x-$::_x}] [expr {$y-$::_y}]

     set ::_x $x; set ::_y $y

  }
 
   
        global tile
        global xhistory firstnode curnode secondnode
        global ind movesit
      set tile [.c find withtag current]
        set number 2
         set numberx 2
         global tile1
         set firstnode [.c find withtag current]
      set number  [ .c gettags current]
   proc movetiles {} {
   bind . <1> {}
   bind . <3> {}
  .c bind mv <1>         {mv'1 %W %x %y} ;
  .c bind mv <B1-Motion> {mv'motion %W %x %y} ;
    }

    proc mahjongstyle {} {
    global x t
    bind . <1>         { set firstnode [ .c itemcget current -text ] ;
      .c itemconfigure  [.c find withtag current]  -tag previous; 

    }

   bind . <3>         {  set secondnode [.c itemcget current -text];
    if { $secondnode == $firstnode} { .c itemconfigure  [.c find withtag current]  -fill red;
    
     .c itemconfigure  [.c find withtag previous]  -fill red ;
    
     .c delete  [.c find withtag current];
     .c delete  [.c find withtag previous]; 





     } }
  




    $t delete 1.0 end 
    $x delete 1.0 end    
$t insert end " mahjong activated !!! tiles with same text should be filled/outlined in
    red"  ;

$x insert end  " mahjong activated !!! pick first tile with left mouse button!
   pick second tiles with right mouse button!! tiles with same text should be outlined in
in red border. picking third tile may (buggy) abandon choice of first tile"
  }

   #-- Little development helpers (optional):

   bind . <Escape> { exit}
   bind . <F1> {destroy .}  
   console hide 
  set maxX 320

  set maxY 240

  set y      0



  set x1 120

  set x2 150

  set y1  50

  set y2  80
  canvas  .cv -width $maxX -height $maxY  -bg white

  







  button  .b0 -text "clear" -command {  ClrCanvas .c }

  button  .b1 -text "poetry"  -command {ClrCanvas .c ;poetrypoetry .c }

  button  .b2 -text "move"  -command {movetiles }

  button  .b3 -text "ra. words"   -command {ClrCanvas .c ;poetryrandom .c }

  button  .b4 -text "exit"   -command {exit   }

  button  .b5 -text "mahjong"   -command { mahjongstyle }
  button  .b6 -text "exit"   -command { exit }
  
  button  .b7 -text "exit"   -command { exit }
  button  .b8 -text "exit"   -command { exit }
  button  .b9 -text "exit"   -command { exit }
  button  .b10 -text "exit"   -command { exit }

  pack .b0 .b1 .b2 .b3 .b4 .b5  .b6 .b7 .b8 .b9 .b10   -side left -padx 2



  

      #end of deck
      #end of deck      
      #end of deck
    #end of deck

Screenshots

WikiDbImage Random_Poetry_Chalkboard.PNG

Comments

Please place any comments here, Thanks.

gold Change:Redundant procedure ? deleted.


References

Random Divination (non-Iching)

Programming References ( TCL & C# )


Appendices

Tables

 if 0 { iching hexagrams and trigrams }
  The names of the trigrams
 I Ching Trigram Name Translations
     Pinyin   Wade-Giles (Wilhelm/Baynes) associations
 1.  Qian     Ch'ien   the creative, heaven, Father,northwest,head,lungs
 2.  Kun      K'un     the receptive, earth,Mother,southwest,abdomen,reproductive_organs
 3.  Zhen     Chên     the arousing, thunder,Eldest_Son,east,throat
 4.  Kan      K'an     the abysmal, water,Middle_Son,north,liver,kidneys,inner_ear
 5.  Gen      Kên      keeping still, mountain, Youngest_Son,northeast,hands,spine,bones
 6.  Xun      Sun      the gentle, wind, Eldest Daughter,southeast,hips,buttocks
 7.  Li       Li       the clinging, flame,Middle_Daughter,south,eyes,heart
 8.  Dui      Tui      the joyous, lake,Youngest_Daughter,west,mouth }

TCL program

AUX program*

   #!/usr/bin/env wish
        #start of deck
        #Random Poetry Chalkboard
        # 5Jan2009, [gold]
        set goblins { gray60 gray70 gray80 gray85 gray90 gray95 \
    snow1 snow2 snow3 snow4 seashell1 seashell2 \
    seashell3 seashell4 AntiqueWhite1 AntiqueWhite2 AntiqueWhite3 \
    DarkSlateGray1 DarkSlateGray2 DarkSlateGray3 \
    aquamarine4 DarkSeaGreen1 DarkSeaGreen2 DarkSeaGreen3 \
    PaleGreen1 PaleGreen2 PaleGreen3 PaleGreen4 SpringGreen1 \
    green3 green4 chartreuse1 chartreuse2 chartreuse3 \
    chartreuse4 OliveDrab1 OliveDrab2 OliveDrab3 OliveDrab4 \
    coral2 coral3 coral4 tomato1 tomato2 tomato3 tomato4 \
    red4 DeepPink1 DeepPink2 DeepPink3 DeepPink4 HotPink1 \
    HotPink2 HotPink3 HotPink4 pink1 pink2 pink3 pink4 \
    PaleVioletRed2 PaleVioletRed3 PaleVioletRed4 maroon1 \
    VioletRed4 magenta1 magenta2 magenta3 magenta4 orchid1 \
    orchid2 orchid3 orchid4 plum1 plum2 plum3 plum4 \
    DarkOrchid1 DarkOrchid2 DarkOrchid3 DarkOrchid4 purple1 \
    MediumPurple3 MediumPurple4 thistle1 thistle2 thistle3 \

} # set testlist2 split $goblins # # Example 30-1 # A text widget and two scrollbars. #

        proc Scrolled_Text { f args } {
        frame $f
        eval {text $f.text -wrap word \
                -xscrollcommand [list $f.xscroll set] \
                -yscrollcommand [list $f.yscroll set]} $args
        scrollbar $f.xscroll -orient horizontal  \
                -command [list $f.text xview]
        scrollbar $f.yscroll -orient vertical  \
                -command [list $f.text yview]
        grid $f.text $f.yscroll -sticky news
        grid $f.xscroll -sticky news
        grid rowconfigure $f 0 -weight 1
        grid columnconfigure $f 0 -weight 1
        return $f.text

}

set t Scrolled_Text .eval -width 5 -height 3 -bg bisque set x Scrolled_Text .eval2 -width 5 -height 3 -bg bisque pack .eval .eval2 -fill both -expand true -side bottom $t insert end " identified1 !!!" ;

$x insert end " identified2 !!!" ;

# $t insert end $testlist2 ;

# $x insert end $testlist2 ;

 variable bg black  fg white  

   set dx 50
   set dy 50
   set size 30
   set colorground bisque

proc ? L {

 lindex $L [expr {int(rand()*[llength $L])}]

}

 proc lpick L {lindex $L [expr int(rand()*[llength $L])]; \
  #suchenwirth_subroutine;}
  proc poetry jill {
  set jill [lpick { tree happy grass love swan home  \
      power loss dance rose joy hate juice kick deer}]

  return $jill;
  }

     proc xpoetry {w x y val1 val2} {
    global jack
    global jill
     variable bg; variable fg; variable size
      set jack [lpick {red yellow blue purple \
      pink green brown black  gray}]
   set jill rose
     #remaining doctered_suchenwirth_subroutine;
     set tags [list mv d-$val1$val2];
     #remaining doctered_suchenwirth_subroutine;
     set x1 [expr {$x+$size-0.5}]
     set y1 [expr {$y+$size}]
     $w create rect $x $y [expr {$x+2*$size}] $y1 \
         -fill $jack -tags [linsert $tags 0 bd-$val1$val2]
     $w create text [expr {$x+1*$size}]   [expr {$y+0.5*$size }] \
        -text   [eval poetry $jill] -fill $fg -tags $tags

  }
  proc xxxpoetry {w x y val1 val2 rose5} {
    global jack
    global jill
     variable bg; variable fg; variable size
      set jack [lpick {red yellow blue purple \
      pink green brown black  gray}]
   set jill rose
     #remaining doctered_suchenwirth_subroutine;
     set tags [list mv d-$val1$val2];
     #remaining doctered_suchenwirth_subroutine;
     set x1 [expr {$x+$size-0.5}]
     set y1 [expr {$y+$size}]
     $w create rect $x $y [expr {$x+2*$size}] $y1 \
         -fill $jack -tags [linsert $tags 0 bd-$val1$val2]
     $w create text [expr {$x+1*$size}]   [expr {$y+0.5*$size }] \
        -text   $rose5 -fill $fg -tags $tags

  }

proc recipe {} {

  set a {
     {red} {sad} {blue} {blue}
        {glad} {glad} {deep} {black}
       {wild } { green } {pale } {bright}
       {rough } {gray } {brown } {long}
       {high } {thin} {brown } {lush}
       {dry } {poor} {lone } {far}
       {flat } {broad} {thick } {hard}
       {flat } {broad} {cool } {hard}

  }
  set b {
       {quince } { peach } {hare } {bird}
       { smoke } { rain} { ice} { snow}
        {cloud} { home} { flower } {sky}
        {rice} { pine} { mist} {door}
        {wind} { cricket} { year } {moon}
        {crane } {grass } {rose} { ink}
        {thaw} { bloom } {lake} { cedar }
        {dusk} { autumn } {stone} { dawn}
        {stream} { tree } {heart} { boat}
        {grief} { tree } {boat} { boat}
        {rock} {town} {tear} {pool}
        {silk} {deer} {song} {barge}
        {moss} {night} {gate} {fence}
        {dove} {dream} {frost} {peace}
       {shade} {ghost} {road } {path}
       {root} {horse} {eve } {sound}
       {sleep} {leaves} {sea } {sail}
       {peak} {stem} {field} {wave}
       {slope} {bark} {crest} {weed}
       {moth} {wasp} {pond} {soil}
       {snail} {worm} {ant} {kelp}
       {cave} {month} {head} {jade}
         {branch} {bone} {head} {smile}
        {pea} {bone} {head} {smile}
       {elm} { morn} {carp} {nest}
       {oak} { bone} {perch} {breeze}



  }
  set c {
  {snow} { burns} { flips} { flys }
      {lies} { walk } {flow } {fall} {fly}
       {know } {come} { meet } { drift}
     {shine } {soak} { cry } {dance}
      { lost} {cheer}  {float } {dance}
     {roost} { move} { fade} { loves}
      {sleeps} {move} {takes } {sail}
     {sits} {leaps} {sits } {sit}
     {sits} {leaps} {grows } {waits}
      {loses} {hears} {wants } {watch}

}

  set d {
         {for} {by} {towards} { to } {at} {bygone}
         {to} {in} {in } {to }
         {to} {in} {fore } {through}

  }

   set word1 rose
   set dy 20
   set dx 20
 for {set i 0; set y 0} {$i<8} {incr i; incr y $dy} {

for {set j 0; set x 0} {$j<8} {incr j; incr x $dx} {

         xxxpoetry .c [expr $i*65+10] [expr $j*35+100] $i $j "[? $a]."

    incr j

xxxpoetry .c expr $i*65+10 expr $j*35+100 $i $j "? $b."

    incr j

xxxpoetry .c expr $i*65+10 expr $j*35+100 $i $j "? $c."

  incr j

xxxpoetry .c expr $i*65+10 expr $j*35+100 $i $j "? $d."

 incr j

xxxpoetry .c expr $i*65+10 expr $j*35+100 $i $j "? $a."

  incr j

xxxpoetry .c expr $i*65+10 expr $j*35+100 $i $j "? $b."

  } 

 }




  return " [? $a] [? $b] [? $c] [? $d] [? $a] [? $b]. "

}

if {file tail [info script]==[file tail $argv0} {

  package require Tk

  pack [canvas .c -background darkgreen] -fill both -expand 1
  pack [label .ww -text "holding tank, version 2 "] 
   pack [text .t -width 40 -height 2]
   pack [label .wx -text "activate w/ mouse down "] 
   proc poetryrandom {w} {
   set dx 50
   set dy 50
   set size 30
   set word5 roset 
     for {set i 0; set y 0} {$i<8} {incr i; incr y $dy} {
     for {set j 0; set x 0} {$j<8} {incr j; incr x $dx}   {
         xpoetry .c [expr $i*65+10] [expr $j*35+100] $i $j
     }
  }
   }

   proc poetrypoetry {w} {
    set dx 50
   set dy 50
   set size 30
   set word5 roset
  recipe
   }
 bind .t <1> {showRecipe %W;$x insert end "$keeper" ;$t insert end "$keeper" ; break}
  proc showRecipe w {
    global keeper
    $w delete 1.0 end
    set keeper [recipe]
    $w insert end $keeper
    #set liner [split [$w get 1.0 end]]
    #lappend liner "/n"
    #lappend liner "rat"
    #$w insert end $liner 



  }
  showRecipe .t

}

   proc ClrCanvas {w} {

    $w delete "all"

  }





   #motion section
 if 0 {Clicking on a piece records \
  the click position, and its "catch-all"  tag, \
  in global variables:}
  proc mv'1 {w x y} {
     set ::_x $x; set ::_y $y;#suchenwirth subroutine;
     foreach tag [$w gettags current] {
         if [regexp ^(d-.+) $tag -> ::_tag] break
     }
  }
   if 0 {Moving the mouse with button 1 down \
  moves the items with the  "catch-all" tag \
  with the mouse pointer:}
   proc mv'motion {w x y} {
     $w raise $::_tag;#suchenwirth subroutine;
     $w move $::_tag [expr {$x-$::_x}] [expr {$y-$::_y}]

     set ::_x $x; set ::_y $y

  }


        global tile
        global xhistory firstnode curnode secondnode
        global ind movesit
      set tile [.c find withtag current]
        set number 2
         set numberx 2
         global tile1
         set firstnode [.c find withtag current]
      set number  [ .c gettags current]
   proc movetiles {} {
   bind . <1> {}
   bind . <3> {}
  .c bind mv <1>         {mv'1 %W %x %y} ;
  .c bind mv <B1-Motion> {mv'motion %W %x %y} ;
    }

    proc mahjongstyle {} {
    global x t
    bind . <1>         { set firstnode [ .c itemcget current -text ] ;
      .c itemconfigure  [.c find withtag current]  -tag previous; 

    }

   bind . <3>         {  set secondnode [.c itemcget current -text];
    if { $secondnode == $firstnode} { .c itemconfigure  [.c find withtag current]  -fill red;

     .c itemconfigure  [.c find withtag previous]  -fill red ;

     .c delete  [.c find withtag current];
     .c delete  [.c find withtag previous]; 





     } }





    $t delete 1.0 end 
    $x delete 1.0 end    

$t insert end " mahjong activated !!! tiles with same text should be filled/outlined in

    red"  ;

$x insert end " mahjong activated !!! pick first tile with left mouse button!

   pick second tiles with right mouse button!! tiles with same text should be outlined in

in red border. picking third tile may (buggy) abandon choice of first tile"

  }

   #-- Little development helpers (optional):

   bind . <Escape> { exit}
   bind . <F1> {destroy .}  
   console hide 
  set maxX 320

  set maxY 240

  set y      0



  set x1 120

  set x2 150

  set y1  50

  set y2  80
  canvas  .cv -width $maxX -height $maxY  -bg white









  button  .b0 -text "clear" -command {  ClrCanvas .c }

  button  .b1 -text "poetry"  -command {ClrCanvas .c ;poetrypoetry .c }

  button  .b2 -text "move"  -command {movetiles }

  button  .b3 -text "ra. words"   -command {ClrCanvas .c ;poetryrandom .c }

  button  .b4 -text "exit"   -command {exit   }

  button  .b5 -text "mahjong"   -command { mahjongstyle }
  button  .b6 -text "exit"   -command { exit }

  button  .b7 -text "exit"   -command { exit }
  button  .b8 -text "exit"   -command { exit }
  button  .b9 -text "exit"   -command { exit }
  button  .b10 -text "exit"   -command { exit }

  pack .b0 .b1 .b2 .b3 .b4 .b5  .b6 .b7 .b8 .b9 .b10   -side left -padx 2





      #end of deck
      #end of deck      
      #end of deck
    #end of deck