28.03.2009

A printer ink friend language

Good news, everyone!

If you are interested in a cool game and not at all in computer science, then skip to the end right now. Otherwise eat a banana.

Since you don't have enough printer ink anymore, you should start programming in Babedepupi!
Babedepupi ist a great language in the sense that it doesn't have keywords. That's good, since you don't like keywords. They are stupid and ugly.

It is an object oriented language like Smalltalk or Schemetalk and not like Java or Eiffel.
But let's take a look at how it looks, looking at us, a simple arithmetic operation:

1 + 2


Here '+' is a message passed to the object '1' with the argument '2', returning a new object ('3'). So nothing new or special. What about parentheses? Since no non-white-space character is allowed, we have to do it differently. The expression '2 * (1 + 3)' would translate to:

2 *  1 + 3


As '*' expects one argument, it would consume the '1' and we would lose our parenthesis. So we have to delay the multiplication and we do that with a double space (did you notice? You should buy new glasses). In this example * waits for the rest to execute and then consumes the result.
A more comple exa8mple?
(3 * 4 - 8 * 9) / 2
translates to
3 * 4 +  8 * 9  / 2


It will be executed as follows: first 3 * 4 is executed, since there is no delay. Then a delay occurs, so '+' is delayed and 8 * 9 is executed (as there is no delay after 8 *). After that we get a delay, this time not after a message but after an object. This means that the last delay is resolved, the one after '-'. Finally we end up with / 2 and the result is given.
Now, how are classes defined, let's implement a Boolean class.

Boolean
then block end
System print "Not my responsibility, muaha!"
then thenBlock else elseBlock end
System print "Not my responsibility either!"
True Boolean
then block end
block execute
then thenBlock else elseBlock end
thenBlock execute
False Boolean
then block end
then thenBlock else elseBlock end
elseBlock execute


So we first define Boolean and two methods which should be implemented by inheriting classes. It helps us to define the if then and the if then else. The then else block is special. 'else' is not an argument and belongs to the method definition (note the two spaces). True and False are implemented straightforwardly.
An easy example is:
0 = 1 then

System print "0=1!"
end

A block is written with an indendation. The first line holds all the block variables (none here). After this line, still indendated, we will have the commands of the block.
Similarly we can write:

block =
System print "I am a block, LOL"


Now we will look at how the work in action. We will use a Fibonacci class.

Fibonacci
fib n
n = 0 then

fib = 0
else

n = 1 then

fib = 1
else

fib = fib n - 1 + fib n - 2
end
end


Now you may get confused by the '=' which is used on one hand as equality check like in 'n = 0' and on the other hand as assignment 'fib = 1'. '0' works as equality, iff there is no message send after it, which belongs to Boolean. Finally we find the 'fib = ' statement. The name of the method is always the result variable (like in Pascal). Alternatively it could work like in C/Java and directly jump out of the method.
How about a more complex class, for instance a linked list?

LinkedList
new
first = Container new
last = first
add item
last nextItem item
last = Container new item item
removeAt i
at i nextItem at i nextItem nextItem
[ i ]
[ = at i
at i
at = atRec i first
atRec i current
i = 0 then
atRec = current
else
atRec = atRec i - 1 current
end
Container
item item
data = item
nextItem container
next = container


Yeah, that's all for now. It's obvious that Babedepupi still has flaws, just wanted to write it down for the afterworld.
If you read till here, you are brave indeed. And you'll get a cake (if you didn't see it already): BACK THROUGH TIME!"
That's all folks, next time a drawing again? Who knows? Who? Yeah you there, in the back? No, I don't want your Bible, thank you very much.

PS: No Scheme/LISP-trolling please.

11.03.2009

How I Got My Driver's Licence

Today I got my drivers license.

Many of my dear readers will ask themselves, why in god's name someone like me should be even considered to be driving on any street or any vehicle. Well this article is not about that. Rather I will explain the most efficient and fun way of learning how to drive.
First thing you will have to do, is to buy or "buy" a copy of Grand Theft Auto. Preferrably a version above GTA 3, since you want to have a realistic simulation! Install it and begin with the 10 step learning plan:

1. Find a car and start it. You will see the accelerator as well as the decelarator at your foot. Just step hard on the accelerator until you reach maximal speed.

2. Do not get angry and do not show it to your fellow drivers.



3. If you encounter any vehicles in front of you, you are safe to change lanes. Try to push slow drivers off the street, if they take too much space. It is not advised to cut off the street turning left, when a big truck is involved. Unless you are the truck.

4. Please stay calm, if the techno hippies with their loud cars and disco lights appear in your rear mirror.

Make sure you keep pace with them, otherwise they will run you the fuck down.

5. Sometimes you need to drive slower, even though just in rare cases. In that case you quickly step on and off the accelerator. The higher your frequency, the faster. If you really have to brake, step on the decelerator. It is advised to keep pressing the decelerator to move backwards to preserve fuel.

6. It is not advised to drive on sideways. Pedestrians may slow you down.

7. Driving with damaged cars is unsafe; make sure your car is always maintained. Otherwise take another car.



8. Crossings are dangerous. To avoid damage, drive through the crossing very fast.

9. Do not shoot firearms on a highway or at traffic signs. You may miss.

10. Put your seatbelt on.

What are you waiting for? Get your driver's license now!

05.03.2009

Today I dropped a glas of water over my computer. That's when I fell through a portal in the other dimension.

Greetings.

04.03.2009

Stumble2

In the last post I talked about the game idea of playing a game only with sound.
Someone did something very similar.

That's all folks. Perhaps next time Super Mario.

Cheers
Super Black Coat Rabbit 3