Playing with RobotC

We made a couple of demos to introduce ROBOTC  “the premiere robotics programming language for educational robotics and competitions.” The first practice was to follow a dark line in a light background and the second one is a paparoach that runs to hide in a shadow.

1. Line Tracker

As long as the sensor detects the black line, advance forward in full-speed.

If the sensor looses the line, spin the robot towards the last direction the line was found.

If after 30° of spin the line was not found, the robot assumes the line changed direction, and makes a spin on the opposite direction until the line is found to counteract the previous spin.

2. Paparoach

As long as the light sensor (now pointing up) detects light, the robot advances forward in full-speed. If the robot stumbles upon an object, it stops, makes a 100° backspin to change direction, and resumes the run.

When the light sensor detects a shadow, the robot stops. Note the robot resumes if the shadow is lost again.

Fork us @GitHub!

First-order logic + the Einstein Challenge

Welcome ProgSchedule villagers, our AI Team has been working in a couple of First-order logic challenges, which are a very approach to how would machines make their own deductions, applying inference rules, through a formal system. Let’s have a brainstorm to get in the context:

  1. Inference is the act of deriving logical conclusions from premises known or assumed to be true.
    Therefore, a->c
  2. First-order logic is the standard for the formalization of mathematics into axioms. A theory about some topic is usually first-order logic. It’s formal syntax includes:
    1. Logical connectives ^ “and”, v “or”, ~ “not”, → “imples”…
    2. Quantifier symbols ∀ “for all”, ∃ “there exists”
    3. Parentheses, brackets, variables, equality symbol…

With this in mind, let’s assume we are ready for the challenges:


family tree unsolved

Could you fill the tree above using the following clauses?

  • Miguel and Alejandro call “dad”and “son” among them.
  • Fernando has an older brother.
  • Alejandro is the brother of Carmen.
  • Alberto is the grandfather of Marcos.
  • María only has 2 children, just as Carmen and Alberto.
  • Tomás is the brother in law of Lucía
  • Berta is the youger sister of her sister, but is older than her brother.
  • Patricia is the niece of Carmen.


There are five houses in a row and in five different colors.

In each house lives a person from a different country.

Each person drinks a certain drink, plays a certain sport, and keeps a certain pet.

No two people drink the same drink, play the same sport, or keep the same pet.

  • The Brit lives in a red house
  • The Swede keeps dogs
  • The Dane drinks tea
  • The green house is on the left of the white house
  • The green house owner drinks coffee
  • The person who plays polo rears birds
  • The owner of the yellow house plays hockey
  • The man living in the house right in the center drinks milk
  • The Norwegian lives in the first house
  • The man who plays baseball lives next to the man who keeps cats
  • The man who keeps horses lives next to the one who plays hockey
  • The man who plays billiards drinks beer
  • The German plays soccer
  • The Norwegian lives next to the blue house
  • The man who plays baseball has a neighbor who drinks water.

Question: Who owns the fish?



family tree solved


1 ( i , j ) nacionality(i)!=nacionality(j)    
2 ( i , j ) color(i)!=color(j)    
3 ( i , j ) pet(i)!=pet(j)    
4 ( i , j ) cigarrete(i)!=cigarrete(j)    
5 ( i , j ) drink(i)!=drink(j)    
6 ( i , j ) link(i,j) -> (j=i+1 ^ j<=5) V (j=i-1 ^ j>=1)
7 ( i ) i == 1 -> nacionality(i)= Norwegian
8 ( i , j ) i==1 ^ color(j)==blue -> link(i,j)
9 ( i ) i == 3 -> drink(i)= milk
10 ( i ) color(i) == red -> nacionality(i)= Brit
11 ( i ) pet(i) == dog -> nacionality(i)= Swede
12 ( i ) drink(i) == tea -> nacionality(i)= Dane
13 ( i , j ) color(i)==white^ color(j)==green -> j = i+1
14 ( i ) drink(i) == brown -> color(i)= green
15 ( i ) cigarrete(i) == pallmall -> pet(i)= birds
16 ( i ) cigarrete(i) == dunhill -> color(i)= yellow
17 ( i , j ) cigarrete(i)==blend ^ pet(j)==cats -> link(i,j)
18 ( i , j ) cigarrete(i)==dunhill ^ pet(j)==horses -> link(i,j)
19 ( i ) cigarrete(i) == bluemaster -> drink(i)= beer
20 ( i ) cigarrete(i) == prince -> nacionality(i)= German
21 ( i , j ) cigarrete(i)==blend ^ drink(j)==water -> link(i,j)


Color Nacionality Pet Cigarrete Drink
yellow Norwegian cats Dunhill water
blue Dane horses Blend tea
red Brit birds Pallmall milk
green German   Prince coffe
white Swede dog Blue Master beer

Answer: Not the Norwegian, nor the Dane, nor the Brit, not the Swede

Heuristic Optimization to our State Generator

Greetings from the AI-ProgSchedule Team, we continued improving our state generator and have now incorporated a heuristic optimization to the program we explained on the last post!

The heuristic we implemented works as following:
Each state has a list of possible following states, that we use to find a path to the target state. Each time the next state has to be chosen, we order the list of states according to how similar the next state is to the target state.

For example, suppose we want to get to a target state such as this:
1 2 3
4 5 6
7 8 –

If on a certain part of the analysis we are on a state such as this:
1 2 –
6 4 3
7 8 5

There are two possible states we can pass from such a state;
Moving 3 up:
1 2 3
6 4 –
7 8 5

And moving 2 right:
1 – 2
6 4 3
7 8 5

However, if we count how many numbers on each possible state match the target state, we find that moving 3 up matches 5 numbers, while moving 2 right matches only 3 numbers.

At that point, our program would order the list so that moving the 3 up would be the first state to be attempted, since its more likely to lead us to the solution.

Here is a screenshot of a test run for a depth-first-search from this initial state:
– 1 2
3 4 5
6 7 8

To this target state:
1 2 5
4 6 8
3 7 –

Heuristic Run

As you can see using our heuristics takes less than a second to complete. We are certain applying more complex heuristics the time could be improved, but for our first attempt we are happy with the result.

You can find the source code here:

We will keep you informed on the progress of the project. See you later!

States Generator and Searches

Greetings from the AI-ProgSchedule Team, today we will show you a practice that we develop that creates a Generic States Generator for a given problem and  how we apply Depth First Search and Breadth First Search.

This practice consists in develop a generic states generator of all possible states for a given problem. We have an initial state that could be any possible state and applying operators and some functions to obtain all the states linked by operators.

Once we have all states linked by operators we can apply Depth First Search or Breadth First Search to solve the problem.

In this practice the search determine what is the next state (step) to solve the problem, and at the end we will have the final state that it’s the solution.

Now we will show you some screenshot.

We can see that depending if we use Depth First Search or Breadth First Search  the results are different (in time).







You can check the code here:

We can try having better results  implementing some heuristic, but that will come in our next Post… so we hope you can read us next time, see you!!

The Artificial Intelligence Debate

Greetings from the AI-ProgSchedule Team, today we were reading the Computer Machinery and Intelligence, written by Allan Turing, the father of computer science.This writing leads us to pose some questions such as: what does being intelligent means? what is the difference between a human and a computer? can machines think?

Let’s just summarize the introduction of Allan Turing by quoting the description of his Imitation Game:

It is played with three people, a man (A), a woman (B), and an interrogator (C) whom may be of either sex. The interrogator stays in a room apart from the other two. The object of the game for the interrogator is to determine which of the other two is the man and which is the woman […] We now ask the question , “What will happen when a machine takes the part of A in this game ? ” Will the interrogator decide wrongly as often when the game is played like this as he does when the game is played between a man and a woman?

The article and the general opinion proposes some potential objections against the artificial intelligence search, they say that there are several human skills impossible to be replicated by a computer; distinguishing good from evil or loving for instance. In fact, we believe that the most difficult part to mimic is that of our feelings and emotions, we humans do stupid things while machines would never lose their logic sense.

As machines may not be able to feel -and act illogically as consequence of that- we would have to program their behaviour, the problem would then depend on our understanding of ourselves…

We can add some other doubts like how would a computer pass a psychological test? would we detect any characteristic such as egoism or altruism? How would a machine relate cognitive abstractions like shapes with colours? What about pattern recognition? Would the computer figure out a shape in a spot? a constellation?

The article was written in 1950, in it, Turing predicted that by 2000 a computer should have a 30% chance of passing a Turing Test 5 minutes with an average interrogator. We are considering that in 2015, in the era of instant communications, we are not so far from what we predicted, we believe it is very likely that there is already a machine that pass these tests.

It seems that regardless of technological advances, there still exist objections against artificial intelligence, even considering a half-century of distance between the author of this and that article. Beliefs and a growing paranoia of an invasion never stops being fashionable.

Technology evolves so fast that it also annoys some economic and social factors, factors that may add to the refusal of developing an intelligence comparable to ours; a kinda flashback to what happened back in the Industrial Revolution times.

In the end we concluded that the knowledge we have is not yet definitive and it would be a very interesting challenge to build an intelligence that works to fulfil the experiment. It requires a multidisciplinary team work… In a broader sense this would also helps us to know ourselves. What about you readers think?

Cloud Computing elementals: SaaS PaaS IaaS

Cloud computing is the paradigm where we rely on services offered through the internet. It stands on a layered architecture whose primal objective is to encapsulate the different concerns of a complex computational solution; therefore, we can break the problem into smaller individuals. In other words, it is the cloud’s Divide and Rule protocol.

Cloud Computing Pyramid

Cloud Computing Pyramid


Software as a Service

Software applications are addressed to end users. The advantages of cloud applications implementation, above traditional models, are due to the characteristic that software is a service that customers can access to with no need to acquire a copy.

Product vs Service

Product vs Service

So you don’t have to harass users with false licenses, compile customized versions or provide specialized  support and updates.



Platform as a Service

Includes the operating system, programming language execution environment, database and web server required to hold your application running. Cloud-destined software is built up on a a cloud-specialized platform.


Infrastructure as a Service

Infrastructure as a service points to hardware: storage media, networking components, servers and virtual/physical machines.





The SQL pillars: DDL, DML, DCL, TCL, and why


Considering the hierarchy bellow, SQL statements are classified in 4 pillars:

  • DDL (Data Definition Language)

Comprising instructions that work in the hierarchy from table upwards:

create, alter, drop, rename…

  • DML (Data Manipulation Language)

Working in fields and records with:

select, insert, update, delete, explain…

  • DCL (Data Control Language)

For administrative purposes, working with users and permissions with:

grant, revoke…

  • TCL (Transaction Control Language)

With magic power to undo or save changes:

commit, rollback, savepoint, set transaction…

NOTE: There are some differences from one to another Database engine, for example Oracle’s hierarchy encloses groups of tables in schemas; SQL statements also differ a little because of this, but no matter what, SQL language defined in the World Wide Web Consortium (W3C) reference have never failed with me.


If you are like me, I’d always asked my self why such a complexity of knowing which instruction belongs to which group. Well, answer is that interesting stuff happens when theory faces the realm. Let’s first talk about TCL…

When you

Transaction Control Language comprises magic powers,