[Cuis-dev] Smalltalk scripts AI generated
Hilaire Fernandes
hfern at free.fr
Sat May 31 12:35:59 PDT 2025
Just for the fun, this valid Smalltalk script for DrGeo was AI generated
after a few iterations to help it producing the right code.
I asked to refactor the code with less variable.
This one with Mistal AI:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|canvas pointA pointB pointC center |
"Créer un nouveau canevas"
canvas := DrGeoSketch new.
"Créer trois points pour former un triangle"
pointA := canvas point: 0 at 0.
pointB := canvas point: 4 at 0.
pointC := canvas point: 2 at 3.
"Créer des segments entre les points pour former un triangle"
(canvas segment: pointA to: pointB)color: Color blue.
(canvas segment: pointB to: pointC)color: Color blue.
(canvas segment: pointC to: pointA)color: Color blue.
"Afficher les points"
pointA name: 'A'.
pointB name: 'B'.
pointC name: 'C'.
"Trouver le centre du cercle circonscrit"
center := canvas intersectionOf:
(canvas perpendicularBisector: (canvas segment: pointA to: pointB))
and: (canvas perpendicularBisector: (canvas segment: pointB to: pointC)).
"Créer le cercle circonscrit passant par les trois points A, B et C"
(canvas circleCenter: center to: pointA)color: Color red.
And this one with ChatGPT:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|canvas a b c centre cercle |
canvas := DrGeoSketch new.
a := canvas point: 2 at 2.a name: 'A'.
b := canvas point: 8 at 2.b name: 'B'.
c := canvas point: 5 at 6.c name: 'C'.
canvas segment: a to: b.
canvas segment: b to: c.
canvas segment: c to: a.
centre := canvas intersectionOf:
(canvas perpendicularBisector: (canvas segment: a to: b))
and:
(canvas perpendicularBisector: (canvas segment: b to: c)).
centre name: 'O'.
cercle := canvas circleCenter: centre to: a.
cercle color: Color red.
--
http://mamot.fr/@drgeo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250531/66762a6f/attachment.htm>
More information about the Cuis-dev
mailing list