Friday, May 20, 2016

Colobot: Robot switching Power Cells by itself

If you have discovered Colobot: Gold Edition, you've been missing a great game.  It's free as in open source and is available on all operating systems.

The main feature is the possibility to program your robots with real code.  The syntax does look like Java or C# and is quite easy to master.  I've created a little program that will find the best available power cell in the area and will let the robot find it and use it as it's new power source.

Here's the code:
extern void object::FindEnergy()
{
while(true){
object newcell = FindCell();
if (newcell !=null){
message("New cell found!");
turn(direction(newcell.position));
moveToPosition(position,newcell.position);
replaceCell();
} else {
message("Cannot find another cell...");
break;
}
}
}
void moveToPosition(point p1,point p2){
errmode(0);
int err = move(distance(p1,p2)-1.5);
while (err != 0){
turn(45);
move(5);
err = move(distance(p1,p2)-1.5);
}
}
object FindCell(){
message("Scanning for cell...");
int minDist = 5;
object cell = radar(PowerCell,0,360,5);
object otherCell= cell;
while (otherCell != null ){
minDist += 1;
otherCell = radar(PowerCell,0,360,minDist);
if (otherCell != null){
if (otherCell.energyLevel > cell.energyLevel){
cell = otherCell;
}
}
}
if (cell.energyLevel == 0){
cell = null;
return cell;
}
void replaceCell(){
message("Replacing cell...");
grab(EnergyCell);
drop(Behind);
grab(InFront);
drop(EnergyCell);
grab(Behind);
drop(InFront);
turn(-90);
move(4);
}
 
See it in action:


Have fun!

Tuesday, May 17, 2016

Google Spaces just launched...

Yesterday, Google Spaces was available on my iPad and my iPhone.  I downloaded the new thing to try it out and explore the features.

As you may guess, it's a bit lonely in space... (Pun intended).  Basically, you create a "space" about your favourite subject and post links relevent to the theme.  I've created one for ScreenStudio and posted a few links.


After a few posts, I then realized that this is Pinterest à la Google.  You can post (pin) all kinds of links and comments.  You can invite your friends and family to join your own personal space as the only way to join seems to be sharing the "secret" link.  I still don't know if Spaces is meant to create small and personal communities or to be a central point for all the stuff that you are interested in.

On iOS, the app does look nice but lacks the tablet format support.  I will go explore http://spaces.google.com from my computer to see how it does behave on a large display.

If you want to explore a bit, here's the link to the ScreenStudio space: https://goo.gl/spaces/oLeXGyJbHutGwX5v5

More to come...

Sunday, May 15, 2016

Scracth Jr for iOS: Coding for kids


Wondering if you have what's required to create an app or a game?  Why not start gently with Scratch Jr. for iPad.



A few years ago, I was showing my kids what I was doing at my job by using Scratch on the computer.  Basically, it's a software that lets you create small games and applications using logic blocks that you can drag and drop on you characters.  It's a bit like playing Lego blocks with your mouse.

There is an iOS version called Scratch Jr. available in the AppStore.  It targets kids but anyone who wants to learn about software programing can start with this little app.  Of course, you won't be able to publish your apps or create the latest 3D games with Scratch Jr.  It is meant to be a really simplified version of the real thing.  But nevertheless, you will learn about conditions, loops and events in a matter of minutes.


The best thing is that Scratch Jr. is free.  The MIT has created this amazing app so kids, and grown ups, can learn about software development in a fun way.


There is a more advanced version of Scratch available online at https://scratch.mit.edu.

Have fun!