Langton's ant

54 views
Skip to first unread message

Guy1954

unread,
Oct 31, 2019, 7:03:17 PM10/31/19
to xblite
Hi Xbliters.

New Year 2020 is around the corner, and I made it a tradition to code in XBLite my yearly season greeting e-postcard.

This year, I innovate: not any meaningless animation but the so-called "Langton's ant" (see https://en.wikipedia.org/wiki/Langton%27s_ant).

Any many of you to join me in this challenge?

We could elect a winner as the King of XBLite (just for 2020, mind you!)

Bye! Guy

Guy1954

unread,
Dec 11, 2019, 9:18:44 AM12/11/19
to xblite
Hi Xbliters.

Please find attached LangtonAnt_v1_00.zip, which contains:
  • LangtonAnt.x
  • LangtonAnt_2019_12_11_15_11_42.x (a backup, just in case)
  • LangtonAnt.ico
  • LangtonAnt.rc
  • LangtonAnt.manifest
  • LangtonAnt_gen.vxn
  1. Download LangtonAnt_v1_00.zip
  2. Unzip LangtonAnt_v1_00.zip
  3. Open LangtonAnt.x in XSED
  4. Compile, link
  5. Close XSED and execute by double-clicking on LangtonAnt.exe
It works flowlessly in my home computer, but I really appreciate any kind of bug, or any of kind comment.

Bye!
Guy
LangtonAnt_v1_00.zip

Guy1954

unread,
Dec 11, 2019, 5:25:09 PM12/11/19
to xblite
LangtonAnt_v1_01.zip

Guy1954

unread,
Dec 12, 2019, 1:27:38 PM12/12/19
to xblite
Hi Xbliters.

Coding my version of "Langton's Ant" in Xblite has been a real pleasure.

My latest version uses a cute programming trick:

I REPLACED:
============
' 1.Pivot in current square.
IFZ startRGB THEN
' Black square: turn 90° left
IF #antDirection <= 0 THEN
#antDirection = 3 ' face left
ELSE
' turn 90° right
DEC #antDirection
ENDIF
ELSE
' turn 90° right
IF #antDirection >= 3 THEN
' facing left
#antDirection = 0 ' face up
ELSE
' turn 90° right
INC #antDirection
ENDIF
ENDIF

by:
====
' 1.Pivot in current square.
IFZ startRGB THEN
' Black square: turn 90° left
#antDirection = #antDirection + 3
ELSE
' turn 90° right
INC #antDirection
ENDIF
#antDirection = #antDirection MOD 4

The old C prog within was just delighted...

Bye!
Guy

Guy1954

unread,
Dec 22, 2019, 6:35:01 AM12/22/19
to xblite
Hi Xbliters.

Here in France, in spite of the general turmoil, Christmas has always been a kind time of reconciliation, and very much so since that old time when we (the Frenchies) were only starting to embrace the concept of our national identity.

In spite of deep feelings of sadness, I want to live up to this time-long tradition, and allow some heart-warming memories trickle up in my mind, and bring smile to my face (which you won't see, you blind Computerese!-)).

My experimentation on Xblite programming is certainly one of these good memories, thanks first to David S and also some participating Xbliters.

So, along with a huge THANK YOU to David, bushpilote and some generous Others, I wish you a magnificent celebration of the fading 2019, and a bright and productive soon-to-hail 2020 year.

2020 mind you! Such a beautiful name for a year!

Let it be the first of the best years of your lives!

Best regards!
Guy
Reply all
Reply to author
Forward
0 new messages