Navigation Bar

Simulation of KYTRONs

There is a simulation program for KYTRONs. It is written in ClIM 2 and Common Lisp. It is available from the Macintosh Common Lisp and CLIM ftp-site on ftp.digitool.com:

ftp://ftp.digitool.com/pub/mcl/contrib/clim/clim-2/kytron2.lisp

or locally here: kytron2.lisp

(There exists an older version named KYTRON.lisp running on CLIM 1.1 too.)

New: A simpler Java applet KYTRON simulator can be found here.


The program is also useful as a CLIM primer, a simple tutorial how to write portable Common Lisp programs with a graphical user interface.

Here is an MPEG movie showing a running CLIM-simulation.

The following is the main comment in the Lisp source file:

;;; Simulation of KYTRONs on the Moon.            *** CLIM 2 version ***  
;;; ABSTRACT:  
;; KYTRONs are small autonomous vehicles which try to find a bright light source (e.g. the sun)  
;; to be able to recharge their batteries from their solar panels.  
;; They live on a moon-like surface with obstacles. The (randomly computed) landscape  
;; consists of craters and mountains which the KYTRONs cannot climb.  
;; KYTRONs are real - they were built by rm from 1974 to 1980 (KYTRON 1, KYTRON 2,  
;; m-KYTRON 3, c-KYTRON 4, and KYTRON 5). c-KYTRON 4 has a MC14500B micro-controller and  
;; 256 words of program memory. The other KYTRONs are controlled by pure digital hardware  
;;  - no software, only SSI CMOS circuits.  
;; This CLIM program is a toy simulation application written to be  
;; portable under CLIM 2 (currently developed in  
;; Lucid Common Lisp 4.1.1 and CLIM 2.0 beta)  
;; If you note problems with other platforms, please let me know -  
;; currently I do not have access to other platforms.  
;;; GOAL:  
;; The primary goal was to learn the most important CLIM concepts:  
;;         - application-frame  
;;         - pane  
;;         - command  
;;         - presentation-translator  
;;         - drawing  
;;         - incremental redisplay  
;; Only the upper-layer functions of CLIM are used as far as it was possible. No low-level  
;; programming. The powerful CLIM default-mechanisms for presentation-types,  
;; presentation-translators, command-tables etc. are used extensively, which keeps the  
;; GUI-part rather short. See the comments for exceptions.  
;;; HOW TO USE:  
;;  After compiling and loading the file, start the simulation application by evaluating  
;;  (common-lisp-user:open-kytron).  
;;  Then you may add some KYTRONs with "Add KYTRON ..." and modify the  
;;  landscape by adding new (randomly placed) elements or deleting some of the existing. If  
;;  some KYTRON is placed accidently on an obstacle, please move it to some free place using  
;;  "Move Object".  
;;  Then you start the simulation with "Run Simulation". Stop it anytime with a mouse-click  
;;  in the main pane. After quitting, you may resume with the last state  
;;  of the environment by evaluating (common-lisp-user:open-kytron). Use a "KYTRON 2" for  
;;  best results. It handles rather complex situations.  
;;;====================================================================  
;;; CONTENTS OF THIS FILE:  
;;; (1)----- basic classes --------------------------------------------  
;;; (2)----- misc. ----------------------------------------------------  
;;; (3)----- discrete simulation of an analogue Monoflop --------------  
;;; (4)----- the MOON surface -----------------------------------------  
;;; (5)----- basic KYTRON functionality -------------------------------  
;;; (6)----- KYTRON simulation  ---------------------------------------  
;;; (7)----- light searching ------------------------------------------  
;;; (8)----- geometry -------------------------------------------------  
;;; -------------------------------------------------------------------  
;;; (9)----- the CLIM GUI ---------------------------------------------  
;;;(10)----- presentation by drawing ----------------------------------  
;;;(11)----- basic geometric drawing ----------------------------------  
;;;(12)----- CLIM commands --------------------------------------------  
;;;(13)----- hacks for obstacle detection -----------------------------  
;;;(14)----- initialization -------------------------------------------  
;;;==================================================================== 

Page created Sept 20, 1995

Go back to KYTRON home page
Go back to rm private home page

- this WWW page created on Apple Macintosh -

Navigation Bar Bottom