This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dan200's profile picture

ComputerCraftEdu Open Beta - Download and Discussion (1.74pr37, released June 22nd)

Started by dan200, 18 June 2015 - 04:33 PM
dan200 #1
Posted 18 June 2015 - 06:33 PM
Introducing ComputerCraftEdu!

Hey guys, ComputerCraftEdu is finally here! ComputerCraftEdu is a project I've been working on for over a year with TeacherGaming, the people who made MinecraftEdu and are responsible for putting Minecraft into thousands of schools around the world. In the same vein as MinecraftEdu, ComputerCraftEdu is a streamlined version of ComputerCraft designed for use in learning and education, to teach the next generation of programmers how to code. The two main features of the mod are Beginner's Turtles and the "Turtle Remote", which when combined enable a powerful new visual way to program turtles and learn the fundamentals of programming.

TeacherGaming have provided a great Wiki with instructions on how to use the mod, and a series of video tutorials that you should check out:
http://services.mine...omputerCraftEdu
https://www.youtube....0fw8NLWnjBH-SPE

We'll be releasing the final version mod with more fanfare soon, but today, you ComputerCraft beta testers can play what we have right now. In return, I ask that you report any bugs you find, and give any feedback you have :)/>

Downloads

None. ComputerCraftEdu has now been released!
You'll also need Minecraft 1.7.10 version and Forge .

Please use this thread for Discussion only.
Please use the Bug Reports thread for bug reports.
Incorrectly placed posts will be deleted or moved, and you could have your beta access removed.

As with all betas, use this version at your own risk, and don't expect world compatibility between versions.
FunshineX #2
Posted 18 June 2015 - 06:47 PM
Hi Dan. This looks really cool. Just wanted to verify we're fine to start showing this off in youtube videos and twitch streams?
dan200 #3
Posted 18 June 2015 - 07:19 PM
Go for it! As long as you mention the current release is a beta, the more the merrier!
CrazedProgrammer #4
Posted 18 June 2015 - 08:05 PM
Oh man I've been waiting for this :D/>
I'm going to be testing this out to find bugs and make sure that the real launch will be as great as it can be!
Creator #5
Posted 18 June 2015 - 09:09 PM
When is the real launch?
FunshineX #6
Posted 18 June 2015 - 09:13 PM
Is there a plan for the turtle to have a Console tab? I noticed the visual editor has no print component, and even if you swap to code editor there's no way to output messages. How can we do a Hello World program :)/> Maybe a world chat output function?

Also would be nice to have a Visual Editor component that allowed you to type in a string.
Edited on 18 June 2015 - 07:15 PM
dan200 #7
Posted 19 June 2015 - 11:51 AM
Ooh, a "Say" command is a good idea. Would allow for "Hello World", better program feedback, and would personify the turtles a lot :)/>
Creator #8
Posted 19 June 2015 - 11:54 AM
Ooh, a "Say" command is a good idea. Would allow for "Hello World", better program feedback, and would personify the turtles a lot :)/>

Definaltely a good idea!
Bomb Bloke #9
Posted 19 June 2015 - 12:11 PM
It seems the "Code Editor" panel is a 35x21 "regular ComputerCraft display" controlled by an "ide" script included in the mod archive - basically a modified version of "edit". While it's running a script you've written/generated, you can use that same Code Editor display to read the results of print()ed messages, enter text into read() calls, and so on. The only catch is that it's cleared once the script ends (so the source you just ran can be re-rendered). For example, try this:

term.clear()
term.setCursorPos(1,1)
print("Hello world!")
local a = read()
print("You typed "..a)

print("\nPress any key to continue...")
os.pullEvent("key")

Or this:

os.run({}, "rom/programs/lua")

Attempting to launch shell/multishell triggers the autorun code that starts the editor, so it's not so easy to escape. Still working on that…

It also calls a new "edu" API, which has these functions in it:

Spoiler
clearVariable
hasProgram
setVariable
setErrored
getCurrentSlot
clearVariables
restoreTurtleState
clearManualProgram
getLibraryPrograms
getProgram
setCurrentSlot
saveTurtleState
setStopped
setPaused
areTurtlesStopped
setManualProgram
setRunning

Haven't looked into their exact behaviour, but most seem pretty obvious from the context in which they're called.

The IDE also sits and waits for a number of custom events, which are presumably fired when you press the buttons in the GUI interface. For example, you press the "Move Forward" button, a "edu_forward" event is fired, and the editor script responds to it by having the turtle move forward.

Edit:

SpoilerRunning this bit of ugliness will get you to the shell:

Spoiler
fs.copy("rom/programs/shell", "shell") local content = {} for line in io.lines("shell") do content[#content+1] = line:gsub("/rom/startup", "") end local output = fs.open("shell", "w") for i = 1, #content do output.writeLine(content[i]) end output.close() os.run({}, "shell")

It basically copies the shell script to the root of the turtle's drive, edits the copy so that it won't boot the startup script, and then executes that modified version.

Subsequent reboots will still take the turtle to the edu IDE, but you need only call os.run({}, "shell") if you wish to revisit the shell.

Unfortunately, the startup script also deals with setting all the paths, meaning that if you then want to use the pastebin script you've gotta type this sort of thing:

/rom/programs/http/pastebin get whatever

… but once you have access to pastebin, it's relatively easy to set up the turtle's drive with whatever code you want, so that's not so hard to solve from that point (assuming a server environment, of course - obviously in SSP we can just access the file system directly).

Edit 2:

Or you can just hold Ctrl + T while in the IDE. lol I'm an idiot. :lol:/>
Edited on 19 June 2015 - 11:23 AM
dan200 #10
Posted 19 June 2015 - 01:28 PM
shell.run( "shell" ), rather than os.run(), would also work. Shell only runs the startup programs if it's not invoked from another shell (ie, it's the top level), by using os.run and passing in an empty environment, it can't see the parent shell.
Bomb Bloke #11
Posted 19 June 2015 - 02:34 PM
Code the IDE runs for the user doesn't have access to the environment the IDE itself is running in (which happens to be the same environment the shell/multishell tables are in), so you can't do that. Is that not intentional? But yeah, Ctrl + T does the trick. Felt quite silly on realising it.

Anyway, my thoughts on the interface:

With the visual editor, let's say I want to make a "for" loop. If, for whatever reason, I wanted to use the side panel on the right to get the icons needed, it wouldn't be immediately obvious which ones to use; they're not in any sort of order. Granted, I know how to construct a for loop, but beginners will just see a jumbled mess there and won't know what to make of it. Maybe group related control structure keywords together, or colour-code them, so it's obvious that eg "do" doesn't come immediately after "for".

Dragging the first icon - "for" - out to the grid then allows you to fill in the rest by right-clicking the following empty tiles and picking the correct options from the context menu, which works pretty well. Though it does start offering comparison symbols such as "greater than", for some reason, which beginners will not have any use for while building "for" loops. At first I thought you were actually going to allow ternary-type statements to be constructed, but although the editor does allow you to build them within a for loop definition just by using the suggested tiles from right-clicking, it'll red-out the final result and refuse to write it in Lua. I also notice that you can't set the step size - maybe considering setting it to -1 automatically if the limit is lower than the starting point?

It'd be neat if related icons in the program grid had some sort of visual indication that they were related. The tool-tips and context menus tell you what needs to go where, but offer no information as to why - if you moved your mouse over a tile where a "to" is expected, for eg, it'd be neat if the corresponding "for" icon lit up or something.

Once the complete statement is finished, it's a nuisance to move it around. You can't insert a row of empty tiles (or even just single tiles), as far as I can tell, nor can you re-order existing rows short of manually dragging around every single icon they contain. Want to add a row to the top of a ten-row script? Well, you can do it, but it's not fun

If you really wanted to go all-out, you could even have a button that correctly indents all the placed icons! :)/>

Are these beginner turtles supposed to be "plush toys", by the way…? Can't help but notice the recipe contains a lot of wool…

Anyway, good work! :)/>
Bomb Bloke #12
Posted 20 June 2015 - 01:36 PM
Another suggestion, maybe make a config option for fuel consumption? It'd make the mod a bit more appealing to mod pack authors, I suspect. It'd be great to see it added to some packs, and I can't think of anything else that'd hold it back in that regard.

Just playing about, I put together this simple script to make it easier to get other scripts into your library:

inject
local arg = {...}

edu.setStopped()

print("Select the script in your library you wish to replace (or create a new script), then re-focus this console window and press return.")
read()

local import = {}
for line in io.lines(arg[1]) do
  import[#import + 1] = line
end

edu.setManualProgram(import)

To use it, enter a beginner turtle's console display, Ctrl+T out of the IDE script, and install the above code using:

pastebin get dfSSzfZR inject

… then, choose a script on the turtle's own drive that you wish to add to your library, and do:

inject <scriptname>

You'll be asked to select the slot within your library where you wish to install the script to. You can either select an existing one, or create a new one.

Once that's done, hit return back within the main terminal display area, and the specified script will be added to the specified slot in your library (which is available to you regardless as to which beginner turtle you're using).
FunshineX #13
Posted 22 June 2015 - 07:30 AM
Hi Dan,

Just seconding a request for a "right click > insert row" command for the visual editor, or some way to shift rows down in case you forgot to put a piece of code somewhere
dan200 #14
Posted 22 June 2015 - 06:49 PM
I really recommend anyone trying out ComputerCraftEdu read TeacherGaming's documentation on the mod, especially the programming page. The mod is somewhat designed to be used in conjunction with it, and it details a couple of things that aren't self-evident from the user interface.

A big thing a couple of people have missed (that we should probably find a way to indicate in-game), is the keyboard controls for the Visual Editor: they allow you to use the keyboard to navigate the programming grid, and crucially, they include ways to insert and remove lines, and shift code in-bulk along lines. Space, Backspace, Delete and Enter work just like in a text editor.

Bomb bloke: Plush toys is a nice way of thinking of it! The idea of the wool in the recipes is a somewhat metaphorical one: they're "softer" turtles with no hard edges :)/>
dan200 #15
Posted 22 June 2015 - 10:58 PM
Just dropped a new version :)/>
DD008 #16
Posted 23 June 2015 - 04:11 AM
Awesome, My school is looking into this and if so we might use it!
dan200 #17
Posted 23 June 2015 - 10:31 AM
Awesome, My school is looking into this and if so we might use it!

Great! Does your school use MinecraftEdu? If so, they should check out some o the extra schools material here:
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/minecraft-teachers/OoqIirGHnpg/qVDKcb-vbEEJ
Liamjarvisman #18
Posted 27 June 2015 - 06:28 AM
Hi dan can you use computercraftEdu on minecraftEdu? because i'm trying to trick my school into getting minecraft so i was thinking of getting computercraftEdu.
-thanks
Bomb Bloke #19
Posted 27 June 2015 - 07:39 AM
Yes, you can either use it with Forge, or with MineCraftEdu.
dan200 #20
Posted 27 June 2015 - 08:40 AM
Hi dan can you use computercraftEdu on minecraftEdu? because i'm trying to trick my school into getting minecraft so i was thinking of getting computercraftEdu.
-thanks

Yep. It's been designed to work well with it, and has some special integration with MinecraftEdu features, there's some info here:
http://services.minecraftedu.com/wiki/ComputerCraftEdu