[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> Re: Buttons & controls in Mswlogo Screen



"Dreyfuss Pierre-André (DIP - BAL)" wrote:
> 
> Geneva, 11.30  1997
> 
>    Dear Mr Mills,
> 
>  I thank you for the buttons , and  let you  play Tic Tac Toe with
> them, as an example.
> 
> Here are the procedures. !
> 

Your mail message wrapped quite a bit and took a while to
sort things out. I modified the format of the code to be
more "wrap" proof. You might try taking TTT.LGO in
Examples\UCBLOGO and make it so you can play the computer.

See "wrap proof" version at the bottom of this post.

> ---------------------------------
> 
> To start call morpion (the french name of tictac toe)
> 
> Remarks.
> 
> The new windowdelete is dangerous, I sugest to delete the windows not
> on missing window but  with
> the name all :   windowdelete "all   only deletes all the windows.
>

I understand your issue and I squirmed in my seat when I added it
the way I did :-)

> 
> I have allready written tools for creating controls interactively
>  with the mouse. But they are working with
> the french tools (I made a new button called  "interface"  in my tool
> bar).
> 
> I will adapt them in English using pieces of mousecopy to builtd
> mouseselect that will outputs  the rectangle
> [ x y width eight ]  selected.
>

This is exactly what I love to see, building one thing upon another.
Sounds like great work.
 
>
> This rectangle is usefull too to  change activearea and to  give the
> size of the picture to be adjusted.
> 
> I suggest that bitpaste (or a new bitpasteup) draw pictures with the
> turtle in upper left corner (instead of
> lower left) The  definitions will be  the same for pictures , windows
>  and  labels.
> 
> The same for bitload and the new gifload.

Upper left is the "Standard" and I actually go out of my way to handle
lower left to make it easier for young programmers.

> 
> And a wish...
> 
> A  function that outputs the size of a picture stored in the
>  bitindex., and outputs the empty list in case of nobitmap .
>

I hear ya.

> 
>  Sincerly P-A Dreyfuss
> 

Here is the email wrap proof version.

to jeuen :ici
if not " = thing :ici ~
   [
   catch "error ~
      [
      messagebox [Don't cheat] [Allready something here !]
      stop
      ]
   ]
buttonupdate :ici :joueur
make :ici :joueur noyield  setcursorwait
if :ici = "c1 [verify "c1 "c2 "c3 
               verify "c1 "c4 "c7
               verify "c1 "c5 "c9]
if :ici = "c2 [verify "c1 "c2 "c3
               verify "c2 "c5 "c8]
if :ici = "c3 [verify "c1 "c2 "c3
               verify "c3 "c6 "c9
               verify "c3 "c5 "c7]
if :ici = "c4 [verify "c4 "c5 "c6
               verify "c1 "c4 "c7]
if :ici = "c5 [verify "c4 "c5 "c6
               verify "c2 "c5 "c8
               verify "c1 "c5 "c9
               verify "c7 "c5 "c3]
if :ici = "c6 [verify "c4 "c5 "c6
               verify "c3 "c6 "c9]
if :ici = "c7 [verify "c7 "c8 "c9
               verify "c1 "c4 "c7
               verify "c7 "c5 "c3]
if :ici = "c8 [verify "c7 "c8 "c9
               verify "c2 "c5 "c8]
if :ici = "c9 [verify "c7 "c8 "c9
               verify "c3 "c6 "c9
               verify "c1 "c5 "c9]
test :joueur = "X
iftrue  [make "joueur "O]
iffalse [make "joueur "X]
staticupdate  "stj   :joueur
yield
end

to morpion
buttoncreate "screen [rj] [Clear ] -148 76 105 45 [rejouer]
buttoncreate " "c1 "  24  87 42 54 [jeuen "c1]
buttoncreate " "c2 "  66  87 42 54 [jeuen "c2]
buttoncreate " "c3 " 108  87 42 54 [jeuen "c3]
buttoncreate " "c4 "  24  33 42 54 [jeuen "c4]
buttoncreate " "c5 "  66  33 42 54 [jeuen "c5]
buttoncreate " "c6 " 108  33 42 54 [jeuen "c6]
buttoncreate " "c7 "  24 -21 42 54 [jeuen "c7]
buttoncreate " "c8 "  66 -21 42 54 [jeuen "c8]
buttoncreate " "c9 " 108 -21 42 54 [jeuen "c9]
repeat 9 [make word "c repcount " ]
make "joueur "X
staticcreate "screen "stj :joueur -110 4 30 20
end

to rejouer
repeat 9 ~
   [
   buttonupdate word "c repcount " 
   make (word "c  repcount)  " 
   ]
make "joueur "X
staticupdate "stj :joueur
end

to verify :n1 :n2 :n3
if  (and "X = thing :n1 "X = thing :n2  "X = thing :n3) ~
  [
  messagebox "Win (se [X wins] :n1 :n2 :n3)
  buttonupdate :n1 "XX
  buttonupdate :n2 "XX
  buttonupdate :n3 "XX
  ]
if  (and "O = thing :n1 "O = thing :n2  "O = thing :n3) ~
  [
  messagebox "Win (se [O wins] :n1 :n2 :n3)
  buttonupdate :n1 "OO
  buttonupdate :n2 "OO
  buttonupdate :n3 "OO
  ]
end

Make "c1 "
Make "c2 "
Make "c3 "
Make "c4 "
Make "c5 "
Make "c6 "
Make "c7 "
Make "c8 "
Make "c9 "
Make "joueur "X
Make "n1 "c1
Make "n2 "c2
Make "n3 "c3
Make "startup [morpion]


-- 
===============================================================
George Mills (mills@softronix.com)
http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home