This was a really interesting project to work on as it merges the virtual and physical worlds. These magical Bluetooth blocks get paired with your device and connected in various ways that can execute logic. It was mainly used in schools as an introduction to programming.
Simple Example
Button Block
Light Block
When you press on the button and the light will turn green.
Role
My role was mainly building the SAM Space App. But I also had to work on a variety of prototypes that explore the capabilities of this technology.
Prototypes
LED Matrix – Animations
I made a little animation app that would allow you to make animations in 9x9+. It would send the frames over by Bluetooth and you could watch your animations loop on the physical LED matrix.
Snappable Bricks
SAM Space App has been limited in its ability to do anything more complex, basic things that are possible with programming. I’ve implemented a rough implementation of snappable bricks with Abstract Syntax Tree. It has proven to be a start in the right direction.
// Base interface for all expressions.publicinterfaceIExpression{ValueEvaluate(Dictionary<string,Value>env);stringTokenize(Dictionary<string,Value>env);}// If statement (IF Test THEN Consequence ELSE Alternative).publicclassConditional:IExpression{publicreadonlyIExpressionTest;publicreadonlyIExpressionConseq;publicreadonlyIExpressionAlt;publicConditional(IExpressiontest,IExpressionconseq,IExpressionalt){Test=test;Conseq=conseq;Alt=alt;}publicValueEvaluate(Dictionary<string,Value>env){vartest=Test.Evaluate(env)asBool;returntest.Value?Conseq.Evaluate(env):Alt.Evaluate(env);}publicstringTokenize(Dictionary<string,Value>env){returnstring.Format("if ({0}) {{\n {1}\n}} else {{\n {2}\n}}\n",Test.Tokenize(env),Conseq.Tokenize(env),Alt.Tokenize(env));}}
// A Fibonacci example with ASTs.voidFibonacci(){varenv=newDictionary<string,Value>(){{"x",newNumber(0)}};varx=newVariable("x");varfib=newFunction("fib",newConditional(newBinaryOperation(x,newNumber(1),"<="),newNumber(1),newBinaryOperation(newCall(newVariable("fib"),newBinaryOperation(x,newNumber(1),"-")),newCall(newVariable("fib"),newBinaryOperation(x,newNumber(2),"-")),"+")),"x");IExpressionexp=newCall(fib,newNumber(10));Valueresult=exp.Evaluate(env);Debug.Log(result);}
You would not need to write code like this yourself. There is a visual layer that constructs it on the fly as you drag and snap bricks together.
Augmented Reality
We tried adding an AR layer on top of the physical blocks. This, in theory, would allow you to control an object in the physical world that would look different on screen. It failed due to AR being unstable at the time.