Home > MicroWorlds Logo Links & Examples > MicroWorlds Code Pages > MindReader Code

MindReader Code

mindreader.txt 6 KB


; Author: Rupert Russell
; e-mail: rupert.russell1@gmail.com
; URL: http://www.rupert.id.au/gamemaker5/
; Purpose: To play with "mind reading"
; Copyright © 2005 by Rupert Russell
; Created: April 8, 2005
;
; Based on psychic.swf, a Flash program by Andy Naughton
; http://www.cyberglass.co.uk
;
; This program is free software; you can redistribute it and/or ; modify it under
; the terms of the GNU General Public License
; as published by the Free Software Foundation; either version
; 2 of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; -------------------------------------------------------------

to startup
   instructions
   everyone [clickon]
end


to go
   page1
   everyone[ht clickon]
   Become_Answer
   everyone [st]
end

to Become_a_Random_Shape
   ; each turtle becomes a random shape
   setsh 1 + random 25
end

to Become_Answer
   ; each Answer turtle becomes the same random shape
   ; t9, t18. t27, t36, t45, t54, t63, t72, t81, t90

   ; choose which random shape to become
   make "random_number 1 + random 25

   ; change each turtle in turn to the same random shape
   make "t_counter 91
   repeat 10[
      talkto word "t :t_counter
      setsh :random_number
      make "t_counter :t_counter - 9
   ]
end


to psychic

   ; show the answer on page 2
   page2
   setsh :random_number + 26
end


to Align_Turtles

   ; align all the turtles t1 - t99
   make "x_gap 74
   make "y_gap 38.5

   make "x_offset -325
   make "y_offset 193

   make "t_counter 1
   make "loop_counter 0

   repeat 10 [
      ; setx
      repeat 10 [
         talkto word "t :t_counter
         setx :x_offset + (:x_gap * :loop_counter)
         make "t_counter :t_counter + 1
      ]

      make "t_counter :t_counter - 10
      make "y_gap_counter 0
      ; sety

      repeat 10 [
         talkto word "t :t_counter
         sety :y_offset - (:y_gap_counter * :y_gap)
         make "t_counter :t_counter + 1
         make "y_gap_counter :y_gap_counter + 1
      ]

      make "loop_counter :loop_counter + 1
   ]
end

to cycle
   ; cycle the turtle on the instructions page through all 26 large windings
   setsh (random 26) + 27
   wait 10
   cycle
end


APA citation:
Russell, R. (2016, July 04, 04:17 pm). mindreader code.
     Retrieved November 23, 2024, from http://www.rupert.id.au/microworlds/code/mindreader/index.php



450 Visits since April 8, 2005