Firstly, BASIC 256 is awesome. We are now using it in my school for introductory programming classes and having great success - particularly by starting with gotos and one line per statement (i.e. not using structured programming) to create adventure games. We're using this to give a really solid base of flow and then will introduce structured programming as a follow on. It really does lower the bar to entry and give all our students the chance to create something.
My actual question
How easy would it be to create a command line interpreter for BASIC 256? I am looking at doing some automated testing. I know that you can run BASIC 256 with a switch to run the program, but that still requires the GUI be run up. I would like to run it with command line only. The graphic features could either be turned off, or perhaps the user program would need to save a jpg of the created graphics which could then be compared with a reference jpg.
Ideally I would like to be able to run this on a server without having X installed. This then enables me to set up a CodeCademy style course in the Moodle Learning Management System.
If it would not be too hard (i.e. the GUI calls are well seperated from the language implementation) then I'd be really happy to give the needed coding a go.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Update - as this would only be needed to run on Linux, then I could use xvfb as the X server - thus eliminating the need to run X. The issue would then be accepting stdin and writing to stdout rather than the text window.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If we do this, and I am not totally sold on the idea, we would need to modify the code so that at compile time all of the GUI, graphics commands, and almost ALL of the QT stuff would not be used.
The thought of using the xvfb or xorg's dummy would work for ?IX operating systems, but most of our users and downloads are for Windows. I don't want to make a ?IX fork or add a lot of implementaion specific code as we have worked hard to eliminate that stuff.
Let me think of a hack... Will be back in a few...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I do C++ with my exam classes and I have just started using coderunner for automatic testing. This helps to drill syntàx and common coding patterns. The sandbox server for this only runs on Linux. I'd like to extend this to my younger classes. I would expect students to develop on the BASIC 256 graphical client and then copy and paste their answer into the LMS to be checked.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have now got this working as a quick hackaround. I compiled the latest version, noting the -a and -r switches. Combined with xvfb-run, I can run basic256 from the command line on a headless server. The only issue then was to mirror the output window to stdout.
I inserted a cout output statement in RunController.cpp and this produces the correct behaviour. I am now working on two things:
1. Taking input from cinor a file as well as / instead of typing into the QTextedit derived BasicOutput box.
2. Adding a switch to turn this behaviour on and off. I have added the swtch to the command line parser, but this is local to main() - is there anywhere to store this setting for later retrieval? If not, then I could add a get/set to the RunController class...
Any pointers from someone familiar with the codebase would be most welcome.
By the way, for the latest subversion checkout, I needed to add #include <math.h> to BasicGraph.cpp as fabs() was undefined.
Cheers
Paul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Right, have had a short time today to look at this. It now automatically loads and runs a program, taking data from stdin and outputting to stdout. All of this only happens when a command line switch is set.
Needs more testing and refining
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there,
Preamble
Firstly, BASIC 256 is awesome. We are now using it in my school for introductory programming classes and having great success - particularly by starting with gotos and one line per statement (i.e. not using structured programming) to create adventure games. We're using this to give a really solid base of flow and then will introduce structured programming as a follow on. It really does lower the bar to entry and give all our students the chance to create something.
My actual question
How easy would it be to create a command line interpreter for BASIC 256? I am looking at doing some automated testing. I know that you can run BASIC 256 with a switch to run the program, but that still requires the GUI be run up. I would like to run it with command line only. The graphic features could either be turned off, or perhaps the user program would need to save a jpg of the created graphics which could then be compared with a reference jpg.
Ideally I would like to be able to run this on a server without having X installed. This then enables me to set up a CodeCademy style course in the Moodle Learning Management System.
If it would not be too hard (i.e. the GUI calls are well seperated from the language implementation) then I'd be really happy to give the needed coding a go.
Update - as this would only be needed to run on Linux, then I could use xvfb as the X server - thus eliminating the need to run X. The issue would then be accepting stdin and writing to stdout rather than the text window.
If we do this, and I am not totally sold on the idea, we would need to modify the code so that at compile time all of the GUI, graphics commands, and almost ALL of the QT stuff would not be used.
The thought of using the xvfb or xorg's dummy would work for ?IX operating systems, but most of our users and downloads are for Windows. I don't want to make a ?IX fork or add a lot of implementaion specific code as we have worked hard to eliminate that stuff.
Let me think of a hack... Will be back in a few...
Hi Jim,
Really appreciate you thinking about it.
I do C++ with my exam classes and I have just started using coderunner for automatic testing. This helps to drill syntàx and common coding patterns. The sandbox server for this only runs on Linux. I'd like to extend this to my younger classes. I would expect students to develop on the BASIC 256 graphical client and then copy and paste their answer into the LMS to be checked.
I have now got this working as a quick hackaround. I compiled the latest version, noting the -a and -r switches. Combined with xvfb-run, I can run basic256 from the command line on a headless server. The only issue then was to mirror the output window to stdout.
I inserted a cout output statement in RunController.cpp and this produces the correct behaviour. I am now working on two things:
1. Taking input from cinor a file as well as / instead of typing into the QTextedit derived BasicOutput box.
2. Adding a switch to turn this behaviour on and off. I have added the swtch to the command line parser, but this is local to main() - is there anywhere to store this setting for later retrieval? If not, then I could add a get/set to the RunController class...
Any pointers from someone familiar with the codebase would be most welcome.
By the way, for the latest subversion checkout, I needed to add #include <math.h> to BasicGraph.cpp as fabs() was undefined.
Cheers
Paul
Right, have had a short time today to look at this. It now automatically loads and runs a program, taking data from stdin and outputting to stdout. All of this only happens when a command line switch is set.
Needs more testing and refining