Liberal copyright conditions for everything on this web site
NEWS 17 Oct 2011: CAS-AI: Poplog/Pop11 resources for Computing at School (CAS)
THIS IS NOT AN OFFICIAL DOCUMENT OF THE UNIVERSITY OF BIRMINGHAM OR THE SCHOOL OF COMPUTER SCIENCE.
NEITHER THE UNIVERSITY NOR THE SCHOOL HAS ENDORSED THE OPINIONS EXPRESSED HERE.
If the answer to either, or preferably both, is "Yes", then two ways of making progress are described here.
If you already have linux and want to use the facilities described here
you can fetch and install poplog on most linux systems as described in
http://www.cs.bham.ac.uk/research/projects/poplog/latest-linux-poplog.html
After that you'll be able to run all the examples described
below and in
this web site on 'thinky
programming'.
This list is not exhaustive. In particular, an alternative not discussed here is use of a 'bootable live USB' memory stick with (e.g.) linux and a collection of required development tools and applications. (If someone has a link to a good web site describing that option for schools and teachers, please let me know.)
apt-get install gcc build-essential tcsh \ libxext-dev libx11-dev libxt-dev libmotif-dev (If libmotif-dev fails, try liblesstif-dev)There's a video demo of installation of linux poplog on Fedora, followed by running some demos to test it at: http://tinyurl.com/PopVidTut
The .ova file
includes Poplog (a free open source toolkit for teaching and research
in AI and more general programming)
for
demonstration/evaluation purposes.
With many thanks to Tim Bateson, Houghton Kepier Sports College,
and various testers.
The package was created using VirtualBox and has so far
been tested running VirtualBox on Windows 7 and Linux (fedora 15).
It should also work with VB on Macs, and should also be runnable using
VMWare or other packages that conform to the OVF (Open Virtualization
File) format.
A simple online tutorial introduction to linux/unix can be found here:
https://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/unixintro/unixintro.html
(There are many other tutorials. I have not attempted to list them.)
Option 1 requires no huge downloads and benefits from remote management of the linux system, which can be used and shared by different individuals or institutions. Schools sharing such a system can easily share teaching materials and engage in collaborative projects.The disadvantage is that using such a system remotely requires network ports to be open that local managers may not allow.
Option 2 requires the Virtual Box (VB) software (or equivalent) to be downloaded and in addition the encapsulated linux package that can be run locally using VB. So in addition to the initial download (between 1 and 2 GB, depending on how the system is used) there can be a substantial file-space commitment. However the virtual linux system running on a local machine (windows, linux or mac) can be shared between different users accessing it on a local network, behind a firewall.
Option 2 is totally free, whereas there may in future be charges for the use of the Amazon-based system.
Users of option 1 may be seriously hampered by internet connection speeds, whereas users of option 2 can use the speeds supported by the local network, or even greater speeds if the package is run on the user's machine. This can be important for interactive graphical projects, or use of sound.
The main advantage of option 1 is that it provides an opportunity to gain experience using an already set up AI teaching and learning environment, with associated mailing list.
Running the systemTwo files are available (close to 1GB in size) created by Tim Bateson, for use with VirtualBox (or similar tool) running 32-bit linux. -rw-r--r-- 1 1133732864 bytes Jun 2 09:13 pop_crunch.ova -rw-r--r-- 1 1115579499 bytes Jun 2 09:34 pop_crunch.zip The first file, pop_crunch.ova, is the one that needs to be run. It is slightly larger, so if you have a slow internet connection, you may prefer to fetch the pop_crunch.zip file and unzip it to extract the ova file. (Some web servers seem to complain about the .ova file.) Virtual Box (or VMWare) is needed to run it VirtualBox can be downloaded here: http://www.virtualbox.org/ Downloads: http://www.virtualbox.org/wiki/Downloads (Choose the x86 option not AMD64 -- though it will run on a 64-bit cpu.) Contents of the .ova file It provides a full CrunchBang linux which will open up with a desktop in which you can run linux facilities, including graphics and sound and networking (more detailed instructions for installation will be added). It includes a fully installed version of Poplog.
On windows, after installing Virtualbox and downloading the .ova file just click on the ova file to start it. On linux, run it from a command line with the file .ova name as argument. virtualboxNB You may need to configure the keyboard settings in the linux systemI assume that will also work on Macs, but don't have a mac to try. Look carefully at all the menu options that come up, and if in doubt make guesses. (Click on the 'Terminal' option to open up an 'xterm' window in which you can give linux commands, including commands to start up poplog/pop11.) Later I'll try to collect more detailed instructions here. In the networking section, disable the network connection provided by default. It should then connect through the network already running on the host machine. Login name and password 'poplog'. Use 'sudo' to become superuser, e.g. if you want to do any installation of extra linux packages, or register other users. Besides the Poplog/Pop-11 examples, the package can be used for trying out many other unix/linux facilities, including shell commands, file manipulation, network access using SSH, etc. It also includes a simple text editor 'nano' which can be used instead of the poplog editor Ved/XVed illustrated below (though not for running pop11 commands inside the editor). The default keyboard mapping is for the UK (GB). For other countries you can change the setting by following instructions kindly provided by Everett Waters who was using a US keyboard:Run pop_crunch in VirtualBox, right-click for fly-out/pop-up menu. Select "keyboard". Select "Layout" tab. Uncheck "Use system defaults". Use drop down "Keyboard model" menu to select a plausible keyboard model (30 or more are offered; in Everett's case Generic 102 worked). Next, in the "Keyboard layout" box (below the Keyboard model drop-down menu) highlight the currently active model and layout. (The default is "gb") Click "edit" to get a list of country names and select the correct country. (E.g. Selecting United States changed active layout indicator to "us"). Exit and try new keyboard settings.
Testing Poplog/Pop-11 and AI Teaching materials The .ova file includes a pre-installed version of the free open source poplog system for teaching and research in AI and more general computing, with incremental compilers for Pop-11, Prolog, Common Lisp and Standard ML. The same package is available on the 32 bit Linux virtual machine set up by Lee Gillam, as described above. All the examples described below should work in both systems, as should the examples described in: http://www.cs.bham.ac.uk/research/projects/poplog/examples (If anyone needs more explicitly packaged instructions for playing with the examples, please ask: email Aaron Sloman.) Everything in the "teach" files here http://www.cs.bham.ac.uk/research/projects/poplog/teach/ should work. (All included in the Poplog package, and accessible via the 'teach' command in the poplog editor.) And the Pop-11 graphical programming examples and demos here: http://www.cs.bham.ac.uk/research/projects/poplog/figs/rclib/ Testing with a demo: Running rc_polypanel One demonstration not described there that illustrates the functionality is a toy demo for teaching young learners about numbers and angles by playing with a program originally inspired by the LOGO "polyspiral" example: At the linux prompt type poplog pop11 You'll get a colon prompt from Pop-11. (Exit with CTRL-D). Type to pop11 uses rc_polypanel (End all commands with the RETURN key) It will compile a library program (using Pop-11's incremental compiler) and print out TYPE: rc_poly(); So, type to pop11 rc_poly(); You'll get a display with buttons, sliders, etc. You must choose a foreground colour and a background colour (using the mouse to click on colour names, one from each array). After that play with options (possibly trying the 'Suggestions button'). Initially use the 'FAST' speed button, which makes the program run fast enough not to take forever, but slowly enough for you to see how the pictures are made. This is quite a nice tool for teaching students to think about positive and negative increments, the effects of changing the corner angle, what happens when a length goes from positive to negative, and other things. E.g. they can think about parameters needed to generate a closed triangle, pentagon, hexagon, etc. This can be done by a teacher with a group of learners making suggestions and discussing explanations for what is observed to happen. If that demo works, everything else in Poplog should work.Examples of polypanel at work
Here are two images showing the program at work. The first is the result of selecting a blue background and ivory foreground, initial length of 400, length increment of -1.0, turn angle of 89 degrees, and the total number of sides to draw = 400. (Click to get full sized view.) Can you tell from the next picture what was changed before DRAW was clicked? (Ignore error message at bottom. A relic of an earlier mistaken command.) The Pop-11 RCLIB (Relative Coordinates) graphical library on which this and other demos are based is summarised here: http://www.cs.bham.ac.uk/research/projects/poplog/help/rclib Don't try to read all that now. It just gives a feel for the kind of detail available in documentation (in this case for expert programmers). =========================================================================================Chatbot demo
You can test the Eliza chatbot using this command: poplog /usr/local/poplog/current-poplog/bin/demos/run-eliza Follow instructions and end with 'bye'. The main interrupt command on linux is CTRL-C Also on the web, here (using almost the same code): http://www.cs.bham.ac.uk/research/projects/cogaff/eliza A student exercise could involve being given some samples of the rules used by eliza, and then changing them or producing new rules using the same mechanisms. A later exercise could be designing and implementing a (simplified) version of the whole architecture including user interface, rule finding and rule instantiating mechanisms. A further extension would be to use the Pop-11 database package to give the chatbot a memory (either within interaction sessions or across sessions). ========================================================================================= Tiny "RiverWorld" programming demo (for absolute beginners) This demo is concerned with the puzzle: the aim is to enable the Farmer to get fox, chicken and grain across the river, making sure that the fox is never left with the chicken or the chicken left with the grain. The solution can be expressed as a program in a "toy" language implemented in Pop-11, to illustrate some principles of programming for absolute beginners (e.g. the benefits of using procedures, and of using parameters). To run it type this to the linux prompt. poplog pop11 it prints out: Sussex Poplog (Version 15.64 Sat Oct 2 16:22:52 BST 2010) Copyright (c) 1982-2009 University of Sussex. All rights reserved. Setpop : Type uses river That prints out: ** Here is the state of the river-world: ** [chicken fox grain man ---\ \_ _/ _________________ /---] Please type intro(); To get instructions type intro(); Then experiment with the commands, e.g. put the fox in the boat: : putin(fox); ** Here is the state of the river-world: ** [chicken grain man ---\ \_ fox _/ _________________ /---] Then give the instruction to get into the boat : getin(); ** Here is the state of the river-world: ** [chicken grain ---\ \_ man fox _/ _________________ /---] ;;; MISHAP - DISASTER ;;; INVOLVING: chicken has eaten grain TOO BAD ;;; DOING : river_mishap eat checkeat getin pop_setpop_compiler ** Here is the state of the river-world: ** [chicken ---\ \_ man fox _/ _________________ /---] Setpop : So the learner discovers that semantically meaningful error messages can sometimes tell you what has gone wrong. It's then possible to return to the initial condition using start(); and then give other commands. The TEACH RIVER file (also here) shows how to assemble commands to produce a procedure that can be run to display the solution to the puzzle. It also shows how the solution program can be considerably shortened by defining re-usable subroutines for the repeated sequences, e.g. getin(); crossriver(); getout(); and putin(X); getin(); crossriver(); getout(); takeout(X); For more details see the teach file. A later teach file allows the the students to define their own versions of the procedures putin, getin, takeout, etc., using the small integrated pop11 database package to store the states of the world and the history of states if needed. http://www.cs.bham.ac.uk/research/projects/poplog/teach/river2 Building on the riverworld exercise A still later teach file illustrates the combined use of the chatbot mechanisms and the riverworld mechanisms to provide a program that can have conversations about where the items are, and which will obey instructions to change the world, while checking for illegal instructions and refusing to obey them, instead of obeying them and then reporting an error as happened above. See http://www.cs.bham.ac.uk/research/projects/poplog/teach/riverchat This also helps students to think about the architecture of a computing system. One of the design aims of Pop11 and poplog is to make it easy for teachers to develop their own teaching packages consisting of some libraries, perhaps defining domain-specific micro-languages, and tutorial documentation, which can then all be accessible via the editor Ved or XVed. (XVed is the multi-window version. Ved runs in a console window, possibly split into two horizontally.) A grammar package A package defining a sample grammar and lexicon for commands, questions and assertions about a robot capable of manipulating things on a table is here: http://www.cs.bham.ac.uk/research/projects/poplog/examples/robolang/CONTENTS.html One of the sentences that can be generated by the grammar is move the big red box on the tray onto the top of the block on the left side of Jeremy"s triangular horse When this sentence is parsed, the parse tree can be displayed in the Poplog editor, looking like this: Students can define their own grammar and lexicon for some conversational domain, then generate sentences, and see the parse trees. They may get some surprises. ========================================================================================= Programming 'factorial' in the Xved editor and testing it Here is the recursive definition of factorial typed into an XVed window, followed by a command to run it with input values from 1 to 10. The 'l1' command (load one file, the current file) shown on the editor 'command; line causes the whole file to be compiled. The output of programs run in the editor goes by default to a file called output.p, shown below in another XVed window: In the next screenshot, a trace command trace factorial has been added (after the previous loop command, followed by this command to compute the factorial of 5 and print out the result: factorial(5) => Because the factorial function has been 'traced' above, the printout shows that when running the factorial procedure displays its inputs, depth of recursive nesting, and outputs, before printing out the final result: Tracing can be turned off with "untrace factorial" Individual lines of code in the editor can be run by putting the editor cursor on them and typing 'ESC d'. Alternatively a range of the file can be marked (using function keys F1 (start range) and F2 (end range), and then compiled using CTRL d. ========================================================================================= Moving emotional agents demo A more sophisticated demo using the poplog SimAgent toolkit shows two dumb but "emotional" red and blue agents moving around showing changing facial expressions, and reporting on what they think is happening. This command will run it: /usr/local/poplog/current-poplog/bin/demos/simagent-demo Speed up and slow down the demo by right or left clicking on the DELAY button. The two agents (red and blue squares) the obstacles (green circles), and the two targets (red and blue circles) can be moved using the mouse. The spatial arrangements affect the behaviours of the agents. See if you can work out what they are trying to do. Later students can modify the code to make the agents more (or less) intelligent. The tutorial overview (not for beginners) is included in the package, and also here: http://www.cs.bham.ac.uk/research/projects/poplog/teach/sim_feelings An overview of the SimAgent toolkit used for this demo is presented here: http://www.cs.bham.ac.uk/research/projects/poplog/packages/simagent.html ========================================================================================= Exit and Interrupt commands To exit from pop11 when you get the colon prompt, just use the normal linux/unix command line exit: type CTRL-d If you are using the editor Ved/Xved use the ENTER (not RETURN) key (or CTRL-g) to go to the command line and type q That will quit one file. It asks if you want changes saved, unless it was a protected file. You can do 'ENTER x' to leave the editor and go back to the pop11 command line. You can do 'ENTER xx' to leave the editor AND Pop11 and go back to the linux command line. ==================================================================================== Getting to know the editor (console-based Ved, multi window version XVed) You can learn a lot more if instead of starting up pop11 on its own, you start it with the editor 'XVed' running. Type poplog xved You can then start up an interactive (recursive, extendable) menu system by typing to the editor (using the ENTER key -- far right on keypad, or CTRL g) ENTER menu This brings up a detached menu panel (usually bottom right, but you can move it around). It has some entries for commands (e.g. get a teach file) and some entries to get other menu panels (e.g. a menu for compiling portions of a file or the whole file). The buttons to fetch other menu panels have labels '...', e.g. 'Compiling...' It may be worth while playing with the tutorial on using the editor for a while (click on the TUTOR menu item, when the "Toplevel" menu panel comes up). The menu panels are persistent, but each has a 'Dismiss' button. Get to know how to use the keyboard to drive the editor The poplog editor makes use of function keys. The two most important are F1 = mark current line as start of range [or ESC m] F1 = mark current line as end of range [or ESC M] There are many commands that operate on the marked range, e.g. compile marked range format marked range write marked range to another file delete marked range copy marked range within the file copy or move marked range to another file etc. The editor can also be used for documentation, but because it was originally developed to support programming, it does not automatically wrap lines when you change window width. There's lots more -- most of which can be ignored by a beginner programmer, but the extra features become more useful as the learner advances. For a (partial) editor keymap see: http://www.cs.bham.ac.uk/research/projects/poplog/ova/keymap.html (Displaying that file requires your browser to allow monospace/typewriter fonts to be displayed, with equal spacing for all characters.) ========================================================================================= Documentation Poplog includes incremental compilers and documentation of various sorts for four programming languages: Pop-11 (or pop11) (the "core language") (All the other languages are implemented on the basis of Pop-11's incremental compiler) Common Lisp (Similar in power to Pop-11 but with a very different syntax, and some differences in philosophy.) Prolog (The "logic programming" language) Standard ML (SML) A strongly typed, polymorphic, modular, functional language. Illustrated here. The poplog package includes a lot of teaching material on Pop-11 and AI, and some teaching material on Prolog, Standard ML and Common Lisp (for all of which languages there are incremental compilers, written in Pop-11). A primer of Pop-11, for experienced programmers is here: http://www.cs.bham.ac.uk/research/projects/poplog/primer/ Online, web-browsable http://www.cs.bham.ac.uk/research/projects/poplog/primer.pdf Printable: 294 pages http://www.cs.bham.ac.uk/research/projects/poplog/primer2.pdf Printable: two pages per A4 sheet. 143 pages. One of several introductory tutorials for beginners was produced by Chris Thornton at Sussex University, online here: http://www.informatics.sussex.ac.uk/users/christ/teachpacks/popcourse/popcourse00.html With more advanced material here: http://www.informatics.sussex.ac.uk/users/christ/teachpacks/popcourse/popcourse11.html There's lots more! See also the CS4FN web site: http://www.cs4fn.org/ai/
Enormous thanks are owed to Tim Bateson ICT Strategy Manager Houghton Kepier Sports College, Dairy Lane, Houghton le Spring, Tyne and Wear, DH4 5BH. NB: The pop_crunch.ova file may later have additional teaching material included, or packages made available to be downloaded and installed when the system is running.=======================================================================
NOTES: Added 5 Jun 2011:
The default user of the .ova package is 'poplog'
Password is the same. You can change this after installation.