ã¢ã©ã³ã»ã±ã¤ã®âã¡ãã»ã¼ã¸ã³ã°ã«ããããã°ã©ãã³ã°âã¨ããçæ³ã«åºã¥ãï¼éåæå¦çãªã©ããããè¶³ãã¦ããªããªãããââï¼æ¯è¼çå¿ å®ã«å®è£ ããã1970年代ã®é常ã«å¤ãSmalltalk-72ã«å®éã«è§¦ãã¦ã¿ãã·ãªã¼ãº 第2å¼¾ã§ãï¼ãªãææ°ã®Smalltalkã«ã¤ãã¦ã¯ Pharo ãªã©ã§ã楽ãã¿ãã ããï¼ï¼ã
ä»åã¯è¬è¨èªãSmalltalk-71ãã§æ¸ãããã¹ãã¼ã¹ã¦ã©ã¼ã»ã²ã¼ã ã Smalltalk-72ã«ç§»æ¤ãã¦åãããã¨ãç®æãã¾ããåå(2019å¹´)ãå«ãä»ã®è¨äºã¯ãã¡ãããâSmalltalk-72ã§éã¶OOPã®åç¹ | Advent Calendar 2023 - Qiita
crash? explore flash final ã®è¿½å 㨠spaceship ã®ä¿®æ£ï¼spacewar ãï¼
è¡çªå¤å®ã¨è¡çªæå¦çã®ããã·ã¼ã¸ã£ã¯ Smalltalk-71 çã§ã¯ã¯ã¨ã¹ãã§ã³ãã¼ã¯ãé ã«ä»ã ?crash ã¨ãã¦å®ç¾©ããã¦ãã¾ããSmalltalk-72 ã§ãããçµããã¨ãã§ãããã§ãï¼ ?ã¢ã¯ã·ã§ã³ãä½ããããã« crash ã¡ã½ããã»ã¯ã·ã§ã³ãä½ãâ¦ï¼ããSmalltalk-72 ã§ã¯ is? ã®ããã«ã¯ã¨ã¹ãã§ã³ãã¼ã¯ãå¾ã®æ¹ãèªç¶ãªã®ã§ crash? ã§æ¸ãã¾ãããã ãSmalltalk-72 ã¯ã¢ã«ãã¡ãããåã¨è¨å·ãã²ã¨ãã¨ãã«ããã¡ãã»ã¼ã¸ã·ã³ãã«çã¯ä½¿ããªãã®ã§ãcrash ã¢ã¯ã·ã§ã³ãå®ç¾©ãã¦ã? ã¯ã¡ãã»ã¼ã¸ãã¼ã¯ã³ã¨ãã¦æ¶è²»ï¼ á? ï¼ããã¨ãããã¿ã¼ã³ã§å¯¾å¦ãã¾ããï¼çµæã? ã¯ãã£ã¦ããªãã¦ããããã¨ã«ãªã£ã¦ãã¾ãã¾ãããããã¯æ°ã«ããªãæ¹åã§â¦^^; ï¼
ä½µã㦠explore flash finish ãå®ç¾©ãã¾ãã

îto crash object other (
%~. "object _ :#.
spacewar find all spaceship do (
"other _ each.
eq #object #other ? ()
CLOSE < abs (object locx - other locx) ? ()
CLOSE < abs (object locy - other locy)? ()
explore object. explore other))î
îto explore object (
:#object.
@ penup goto object locx object locy.
flash.
finish object
)î
îto flash (
do 10 (
@ penup turn 36 go SSIZE * 2.
@ pendn triangle SSIZE * rand between 2 5.
@ penup turn 180 go SSIZE * 2 turn 180))î
îto finish obj stk (
:#obj.
obj release.
spacewar delete obj)î
Smalltlak-71çã«ã³ã¼ãããã crash? 㨠explore 㯠Smalltalk-72 ã®è©ä¾¡é ãæèããå¼ã®é ã®å¤æ´çãããã®ã®ãããããå
ã³ã¼ãã¨åãå
容ã§ãã

to ?crash :object
find all (create spaceship :s)
if :object â :s
and |:object:location:x - :s:location:x| < :close
and |:object:location:y - :s:location:y| < :close
then explode :s, explode :obj
end to
to explode :object
penup, moveto :object:location
flash
finish :object
end to
ä¾ã«ãã£ã¦ã³ã¼ããçç¥ããã¦ãã flash ã«ã¤ãã¦ã¯ãæ®åãæ¶ããã¨ã¯èããã«åç´ã«ã©ã³ãã ãªå¤§ããã®ä¸è§å½¢ã triangle ã§åå½¢ã«æãå¦çã ãã§æ¸ã¾ãã¦ãã¾ãã
finish 㯠create åæ§ã« Smalltalk-71 ã§ã¯çµã¿è¾¼ã¿ãæ³å®ãã¦ããã®ããããã¾ããããããã§ã¯ stick ã®ãªãªã¼ã¹ã¨ spacewar ããã®åé¤ã®å¦çãããã¢ã¯ã·ã§ã³ã«ãã¾ããã
ãã¨ã¯ spaceship ã« crash? ãã³ã¼ã«ããããlocx ã locy ã®ã¢ã¯ã»ããµã¼ã追å ããä¿®æ£ãå ããã°å®äºã§ãã

îto spaceship : pilot thrust steer trigger numtorps locx locy speed direction time ftime llocx llocy ldir lthr (
isnew ? (:pilot. "lthr _ :#thrust. :#steer :#trigger.
"numtorps _ "speed _ 0.
"direction _ "ldir _ 0 + rand * 360.
"locx _ "llocx _ rand between 50 462.
"locy _ "llocy _ rand between 50 462.
"time _ "ftime _ clock)
%release ? (
stick delete thrust.
stick delete steer.
stick delete trigger)
%locx ? (!locx)
%locy ? (!locy)
%step ? (
0 < clock - time + MOVELAG ? (
"time _ clock.
moveship.
crash~ SELF.
display ship))
%is ? (ISIT eval)
)î
æ¬è³ªã§ã¯ãªãï¼ãªããéããªãã ãâ¦ã®ãããªæ°ããã¾ãããspaceship ããã¹ã¦ finish ããå ´åã«ã«ã¼ããæããããã« spacewar ã«ãå°ãæãå
¥ãã¾ããã

îto spacewar x y : : objects (
(null objects ? ("objects _ obset))
%schedule ? (objects _ :#)
%delete ? (%all ? ("objects _ nil) objects delete :#)
%run ? (
repeat (
objects do (null each ? () each step).
1 = objects vec length ? (done)))
%find ? (%all. :"x. "y _ obset.
objects do (each is~ = x ? (y _ each)).
!y))î
ãã¾ãè¡çªããã試ãã¦ã¿ã¾ããããèªè·¡ãæ®ãããã« display ã®æ®åãæ¶ãå¦çã¯ã³ã¡ã³ãã¢ã¦ããã¦ããã¾ããï¼åå^^;ï¼

î"SSIZE _ 6. "MOVELAG _ "FRAMELAG _ 0. "SPSCALE _ 1.0. "DIRSCALE _ 1.0. "LSCALE _ 1.0. "CLOSE _ SSIZE * 3.î
î@ erase. disp display. disp clearî
î"s1x _ stick 'jl'. "s1y _ stick 'ki'. "s1but _ stick ','.î
î"s1 _ spaceship 'Jimmy' s1y s1x s1but.î
î"s2x _ stick 'ad'. "s2y _ stick 'sw'. "s2but _ stick 'x'.î
î"s2 _ spaceship 'Beth' s2y s2x s2but.î
îspacewar delete all.î
îspacewar schedule keysensî
îspacewar schedule s1. spacewar schedule s2.î
îspacewar runî
ãã·ã£ãï¼
ï¼ éé·ãå®è£ ãã ã¸ç¶ã ï¼