CodeBlocks


MOC


THIS PROJECT WILL CONTINUE AS CODEBLOCKS 2 HERE






Description

Codeblocks is a plugin that allows you to control a robot by creating programs out of special blocks. The programs are ordered sequences of these blocks. The programming constructs available are: Functions, Looping through recursion, and Branching (If / Else) through Sensing/

CodeBlocks

Commands

  1. run <program name> - Runs the specified program from the beginning
  2. pause - Pauses execution of program
  3. stop - Stops execution of program
  4. resume - Continues execution of program where it was stopped
  5. blocks - Clears inventory and fills it with code blocks
  6. save - Saves programs
  7. speed <number> - Sets the speed of program execution (1 is fastest, 20 is one instruction per second)
  8. shift [number] - Shifts the column of code blocks the number of blocks away from the start of the program. If the number is ommitted, shifts by 1 block
  9. unshift [number] - Shifts the column of code blocks towards the start of the program. If the number is ommitted, shifts by 1 block
  10. compass - Indicates which cardinal direction you are facing

Robot Actions

  1. Forward - The robot moves 1 block forward in the direction it is facing
  2. Backward - The robot moves 1 block backward
  3. Turn Right - The robot rotates 90 degrees clockwise
  4. Turn Left - The robot rotates 90 degrees counter-clockwise
  5. Up - The robot ascends 1 block
  6. Down - The robot descends 1 block
  7. Destroy - The robot removes a dirt or grass block directly in front of it
  8. Defuse - The robot removes a TNT block directly in front of it
  9. ShootArrow - The robot fires an arrow
  10. Pickup Block - The robot will pickup the block in front of it. These blocks are placed in a stack internally
  11. Place Block - The robot places the topmost block of its internal stack in front of itself
  12. DigInFront - The robot will mine and collect the block in front of it
  13. DigBelow - The robot will mine and collect the block below it

Blocks that require signs

  1. Sense - The robot compares the block in front of it to the specified block. If the robot sees the specified block, it will continue executing actions placed on the green arrow. If it does not, it will instead execute actions placed on the red arrows. The first line of the sign on the Sense block needs to specifiy which block to sense for
  2. Build - The robot will create the specified block at the specified location to the robot. The first line of the block needs to be the location relative to the robot. Possible locations are (Front, Back, Top, Bottom, Left, Right). The second line needs to be the type of block to place (e.g. Wood, Brick, Gold_Block, etc).
  3. Function - The robot will perform the specified function. The function can be specified with either one or two lines. If only the first line is used, the system will assume that you are running a function that belongs to the program. If you use both lines, the system will look for the function that matches the name. See the section on functions for further explanation

Creating Programs

Programs are described by a sequence of blocks built from North to South (You can determine which direction you are facing by typing '/cb compass'). The start of a program needs to be a sign which describes the name of the program. The first line needs to be the word 'program' and the second line is the name (See below). The following program is named 'example1' and tells the robot to Move Forward, Turn Left, and Move Forward. To run the program, you would place a robot on the ground and type '/cb run example1'.

Ex1

Functions

Creating a function is much like creating a program; however, instead of the first line of its starting sign having the word 'program', you instead place the name of the program the function belongs to.

Ex2

To call a function, place a function block with a sign on top. The sign should read the name of the function. You can use shorthand by just writing the name - the system will look for a function with that name belonging to the program. You can also write the full name of the function (this allows you to call functions from other programs - on my server I have a set of 'global' functions that I use in several of my programs). Both of the function calls below reference the same function.

Ex3

Looping

Looping is accomplished through recursion. To have a set of actions repeated, place the actions in a function and put a function call at the end of the function that tells the robot to perform the function again.

Sensing

Branching (If/Else) can be accomplished with the Sense Block. See above for an explanation.

Ex4

Saving

The system remembers which programs belong to each player. This way, players can have programs and functions with identical names and not conflict. You can manually save your programs so that they will exist on server restart by typing '/cb save'. Additionally, all of the programs are saved when the plugin is disabled (i.e. on a graceful shutdown).

Dependencies

Requires the Spoutcraft client (Uses custom blocks)

Permissions

codeblocks.all - Gives access to the plugin

Texture Pack

The robot will be converted into a dispenser when it is placed on the ground. If you would like to have the robot retain its texture, you can use this texture pack. It is the default texture for Minecraft, with the one change that makes dispensers look like the robot.

http:isue-server.eecs.ucf.edu/CodeBlocks/CodeBlocksTextures.zip

Other

This plugin was created as part of a research project. Upon running 5 programs, players will be prompted with a short survey. The survey must be completed to continue using the system. After 30 programs have been run, the survey will be shown again. Please try to take the survey seriously, we are very interested in your responses.

We are very open to suggestions and feature requests, so if there is something you would like to see added, let us know.


Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Recent Files