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

2 posts / 0 new
Last post
Online
Last seen: 24 min 35 sec ago
Joined: May 4 2021 - 06:35
Posts: 160
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: 5 hours 29 min ago
Joined: Jun 29 2018 - 16:55
Posts: 586
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 

Log in or register to post comments