A self-learning AI... for the Apple-1 :-)

3 posts / 0 new
Last post
Online
Last seen: 3 min 28 sec ago
Joined: May 4 2021 - 06:35
Posts: 172
A self-learning AI... for the Apple-1 :-)
Dear Friends,
some time ago on the Facebook  RetroProgramming Italia - RP Italia (A division of RetroCampus)  group an interesting program for C64 by  Jader Monari appeared, taking up a project by Prof. Massimo Ferri of the University of Bologna that also appeared in some online magazine.
 
For those unfamiliar with it, it is a project that aims to explain in simple terms how AI self-learning works, using only paper cups, letters, tokens and a hexagonal-shaped game board.
 
The game, or rather the games, involve the human player trying to place his or her tokens according to specific sequences (alternating, or three in a row, or two adjacent plus a separate one), while the goal of the "Paper Cup Machine" (or PCM in English) is to prevent this from happening.
 
Similar to what happens in more sophisticated systems, the machine progressively excludes, by playing more and more matches, the moves that lead it to lose (emptying the cups), while holding and reinforcing those that lead it to win.
 
We can therefore say that this State Machine actually mimics a very very simple neural network, and just like more sophisticated ones, it needs training to make fewer and fewer mistakes.
 
Specifically, the amount of games to be played to achieve "invincibility" depends on the type of game chosen, as well as, of course, the moves of the human " trainer."
 
We are, however, talking about an educational experiment, so consider the constraints described in the project -such as always having the human player start by placing his token in 'A'- as a means of limiting the number of States of the Machine (and thus the number of cups to be prepared).
Without such constraint the games would certainly be more fun, but at the cost of much longer and clunkier preparation.
 
Jader's excellent work persuaded my good friend Francesco Sblendorio to adapt the code for any BASIC, Applesoft BASIC included, in order to run it on Apple-1 / II, II+ etc.
 
The program also provides a choice of game type, choosing it from those mentioned above.
 
The Applesoft version does not use colors but different symbols for the human player (*) and the Paper Cup Machine (@).
 
It was unfortunately not possible to port the program to INTEGER BASIC due to the lack of some essential instructions such as CHR$, READ, DATA etc.
 
I have made a short video showing the self-learning phase (sped up in editing, don't worry) of Game #2  up to the point where the human player can no longer win.
 
In the video description you will find all the links to the documentation, sources and source code.
 
Enjoy your viewing, then!
 
I'm pretty sure the next time you read about some application moved by "machine learning," "neural networks," "artificial intelligence" you will ask yourself... "Yes, but... could it be done with paper cups? And if yes... how many of them?" :-D
 
Enjoy!  :-)
 
 
Claudio - P-LAB
 
 
Offline
Last seen: 19 hours 35 min ago
Joined: Jun 29 2018 - 16:55
Posts: 590
Awesome stuff, Claudio. I'll

Awesome stuff, Claudio.

 

I'll love to try it, my workspace is being redone but maybe I can get out my briel with the SD expansion and try it; I should be able to jumper to applesoft BASIC on there iirc, or load another BASIC from SD card perhaps but it's been a while. 

 

Of course none of this matters until my cat, Marvin, has had his evening cuddles and food. No fussing about until after that :D 

Online
Last seen: 3 min 28 sec ago
Joined: May 4 2021 - 06:35
Posts: 172
^__^ ... cats!

Ah, cats...  ^__^

 

Thank you for your kind words! :-)

 

Yes, you should be able to load the Applesoft BASIC from microSD Storage Card.

The SD archive (https://p-l4b.github.io/sdcard/fw.html)  has already been updated with the Italian and English versions of the game, you will find everything in the ASOFT directory, including Applesoft BASIC (use the version that matches your SD OS).

While you're at it, and if you like ‘impossible’ games, try ANGELA GAME too, I'm sure you'll like it. :-D

 

All ported games can be found here, along with listings/source code/binary files:

https://p-l4b.github.io/angela/

 

Have fun, ciao!

 

Claudio - P-LAB

 

 

 

Log in or register to post comments