Thursday, January 26, 2012

A computer program "painted" this artwork from its own imagination


This landscape may not look like that much - it's a solid B+ in middle school art, I'd say - but this might just be proof that its creator, a computer program named the Painting Fool, is a creative being.

The program is the brainchild of Dr. Simon Colton, a computer scientist at Imperial College London. This is one of dozens of paintings by the Painting Fool, and it's particularly exciting because the program wasn't working from an existing digital image, as it usually does. Instead, this is actually a set of images that sprang from the AI equivalent of imagination. And when the program does work from a preexisting image, the results are even more impressive in more traditional aesthetic terms, as you can see in this video and at its website.

MORE HERE >>

Saturday, January 21, 2012

Using the PRINT statement

---------------------------------------------------------------------------

If I say:

X = 5;
PRINT X;


Then the value printed out is

> 5

---------------------------------------------------------------------------

If I say:

X = 5;
PRINT "X";


Then the value printed out is

> X

---------------------------------------------------------------------------

If I say:

X = 5;
PRINT X "is the Biggest";


Then the value printed out is

> 5 is the Biggest

---------------------------------------------------------------------------

If I say:

X = 5;
PRINT "X is the Biggest";


Then the value printed out is

> X is the Biggest

---------------------------------------------------------------------------

Assigning a value to a Variable

---------------------------------------------------------------------------

If I want to assign a vaule to a variable, I do the following

X = 5;

we say this as "X gets the value 5".

---------------------------------------------------------------------------

If I want to assign the value of X to a new variable Biggest, I do the following

Biggest = X;

we say this as "Biggest gets the value of X".

---------------------------------------------------------------------------

If I want to add two numbers and print out the result, I do the following

X = 5;
Y = 4;
SumOfNums = X + Y;

The following is incorrect:

X + Y = SumOfNums;

---------------------------------------------------------------------------

Sunday, January 15, 2012

BubbleSort Pseudocode

---------------------------------------------------------------------------

PROGRAM BubbleSort:

/*===================
DECLARING VARIABLES
===================*/

int ARRAY[N];
int innerloop = 0;
int outerloop = 0;

/*-------------------*/

WHILE (outerloop < N)

    DO WHILE (innerloop < N)

        DO  IF (A[innerloop] > A[innerloop + 1])

                THEN Swap (A[innerloop], A[innerloop + 1]);

            END IF;

            innerloop++;

        END WHILE;

        innerloop = 0;

        outerloop++;

END WHILE;

/*-------------------*/

END.


---------------------------------------------------------------------------
---------------------------------------------------------------------------


PROGRAM Swap (int First, int Second):

/*===================
DECLARING VARIABLES
===================*/

int Temp;

/*-------------------*/
Temp = First;
First = Second;
Second = Temp;

END.

---------------------------------------------------------------------------