Dear readers,
I am proud to present the new version of Algo Code, Version 1.0.2 !
There are new functions such as:
1. consclr(x,y,width,height)
2. wait(time,number)
3. sqrt(number)
4. sqre(number)
5. cube(number)
6. pol(a,b)
7. playMusic(filename,type)
8. and(a,b)
9. or(a,b)
10. xor(a,b)
There are also new variables to be used such as:
1. pressingD
2. pressingF
3. pressingG
4. pressingH
5. pressingJ
6. pressingK
7. pressingL
8. sqrt_R
9. sqre_R
10. cube_R
11. pol_R
12. wait_R
13. and_R
14. or_R
15. xor_R
16. PI
17. Mathe
You can download it from here:
Algo Code Version 1.0.2
Thanks.
31-05-2017
Wednesday, May 31, 2017
Tuesday, May 30, 2017
Download Algo Code Version 1.0.0
Dear readers,
You can now download Algo Code Version 1.0.0 from this website.
Algo Code Version 1.0.0
Thanks.
30-05-2017
You can now download Algo Code Version 1.0.0 from this website.
Algo Code Version 1.0.0
Thanks.
30-05-2017
Monday, May 29, 2017
CoFFeeLands Ep2 - Creating a Random World Generator Using Algo Code Part 2
Welcome back!
This time, I am going to create an algorithm.
//For grass patch
1. If Long Grass is on up, self is Grass Patch.
2. If Flower is on right, self is Grass Patch.
//For long grass
1. If Rock is on up, self is Long Grass.
2. If Grass Patch is right, self is Long Grass.
//For Flower Patch
1. If Long Grass is on right, self is Flower Patch.
2. If Grass Patch is on up, self is Flower Patch.
//For tree
1. If Rock is below, self is Tree.
2. If Flower Patch is on up, self is Tree.
//For rock
1. If Tree is on left, self is Rock.
2. If Long Grass is on left, self is Rock.
//For water
1. If Water is on right, self is also water.
2. If Water is below, self is also water.
//For sand
1. If Water is on left, self is sand.
2. If Water is on up, self is sand.
This seems complicated, so to help the computer to understand, we will assign some number to the blocks.
0 = Grass Patch
1 = Long Grass
2 = Flower Patch
3 = Tree
4 = Rock
5 = Water
6 = Sand
Next, we will design the world, 12 X 12.
_________________________________________________________________________________
var world=[
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0]];
You can edit the world numbers into anything you like, such as:
_________________________________________________________________________________
var world=[
[0,0,1,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,3,0,4,4,0],
[0,0,0,0,0,2,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,3,0,0],
[0,0,0,0,0,0,0,4,0,3,0,0],
[0,0,2,0,0,1,0,0,0,5,0,0],
[0,0,0,0,0,1,0,0,3,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,6,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,2,2,0,0,0,0],
[0,0,0,0,0,0,0,2,0,0,0,0]];
The algorithm will be like this in pseudocode:
//For long grass
1. If world[y-1][x]=4, world[y][x]=1
2. If world[y][x+1]=0, world[y][x]=1
//For Flower Patch
1. If world[y][x+1]=1, world[y][x]=2
2. If world[y-1][x]=0, world[y][x]=2
//For tree
1. If world[y+1][x]=4, world[y][x]=3
2. If world[y-1][x]=2, world[y][x]=3
//For rock
1. If world[y][x-1]=3, world[y][x]=4
2. If world[y][x-1]=1, world[y][x]=4
//For water
1. If world[y][x+1]=6, world[y][x]=5
2. If world[y+1][x]=6, world[y][x]=5
//For sand
1. If world[y][x-1]=6, world[y][x]=6
2. If world[y-1][x]=6, world[y][x]=6
You can turn this into Code form.
We do not need Grass Patch as naturally it will be the most block.
Next,
_________________________________________________________________________________
//world here
var Cx=0;
var Cy=0;
for(Cx=0;Cx<12;Cx++) {
if(Cx==12) {
Cy+=1;
Cx=0;
}
//put the ifs here
//but change the y into Cy and change the x into Cx
var blocktw=60;
if (world[Cy][Cx]==0) {
drawGrassPatch(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==1) {
drawLongGrass(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==2) {
drawFlowerPatch(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==3) {
drawTree(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==4) {
drawRock(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==5) {
drawWater(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==6) {
drawSand(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
}
_________________________________________________________________________________
And there.
Go on and try -- it won't do any harm.
Thanks for reading.
29-05-2017
This time, I am going to create an algorithm.
//For grass patch
1. If Long Grass is on up, self is Grass Patch.
2. If Flower is on right, self is Grass Patch.
//For long grass
1. If Rock is on up, self is Long Grass.
2. If Grass Patch is right, self is Long Grass.
//For Flower Patch
1. If Long Grass is on right, self is Flower Patch.
2. If Grass Patch is on up, self is Flower Patch.
//For tree
1. If Rock is below, self is Tree.
2. If Flower Patch is on up, self is Tree.
//For rock
1. If Tree is on left, self is Rock.
2. If Long Grass is on left, self is Rock.
//For water
1. If Water is on right, self is also water.
2. If Water is below, self is also water.
//For sand
1. If Water is on left, self is sand.
2. If Water is on up, self is sand.
0 = Grass Patch
1 = Long Grass
2 = Flower Patch
3 = Tree
4 = Rock
5 = Water
6 = Sand
Next, we will design the world, 12 X 12.
_________________________________________________________________________________
var world=[
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0]];
_________________________________________________________________________________
You can edit the world numbers into anything you like, such as:
_________________________________________________________________________________
var world=[
[0,0,1,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,3,0,4,4,0],
[0,0,0,0,0,2,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,3,0,0],
[0,0,0,0,0,0,0,4,0,3,0,0],
[0,0,2,0,0,1,0,0,0,5,0,0],
[0,0,0,0,0,1,0,0,3,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,6,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,2,2,0,0,0,0],
[0,0,0,0,0,0,0,2,0,0,0,0]];
_________________________________________________________________________________
//For long grass
1. If world[y-1][x]=4, world[y][x]=1
2. If world[y][x+1]=0, world[y][x]=1
//For Flower Patch
1. If world[y][x+1]=1, world[y][x]=2
2. If world[y-1][x]=0, world[y][x]=2
//For tree
1. If world[y+1][x]=4, world[y][x]=3
2. If world[y-1][x]=2, world[y][x]=3
//For rock
1. If world[y][x-1]=3, world[y][x]=4
2. If world[y][x-1]=1, world[y][x]=4
//For water
1. If world[y][x+1]=6, world[y][x]=5
2. If world[y+1][x]=6, world[y][x]=5
//For sand
1. If world[y][x-1]=6, world[y][x]=6
2. If world[y-1][x]=6, world[y][x]=6
We do not need Grass Patch as naturally it will be the most block.
Next,
_________________________________________________________________________________
//world here
var Cx=0;
var Cy=0;
for(Cx=0;Cx<12;Cx++) {
if(Cx==12) {
Cy+=1;
Cx=0;
}
//put the ifs here
//but change the y into Cy and change the x into Cx
var blocktw=60;
if (world[Cy][Cx]==0) {
drawGrassPatch(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==1) {
drawLongGrass(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==2) {
drawFlowerPatch(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==3) {
drawTree(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==4) {
drawRock(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==5) {
drawWater(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
if (world[Cy][Cx]==6) {
drawSand(Cx*blocktw,Cy*blocktw,blocktw,blocktw);
}
}
_________________________________________________________________________________
And there.
Go on and try -- it won't do any harm.
Thanks for reading.
29-05-2017
CoFFeeLands Ep1 - Creating a Random World Generator Using Algo Code Part 1
Hello and welcome to the first episode of the new series CoFFeeLands.
Today, I am going to program a random world generator using Algo Code. If you want to do this, you have to download Algo Code (unless you already have it).
Okay. Now we are going to design the blocks.
Here are the blocks that I am going to use.
1. Grass Patch /Ground
2. Long Grass
3. Tree
4. Flower Patch
5. Rock
6. Water
7. Sand
First, I am going to design the objects. The objects are going to be pixelated into 16 X 16 form.
Here are the designs that I came up with:
1. Grass Patch /Ground

3. Tree

4. Flower Patch

5. Rock

6. Water

7. Sand

I'm going to start with programming Grass Patch.
________________________________________________________________________________
drawGrassPatch=function(x,y,w,h) {
cngCol('lime');
rect(x,y,w,h);
}
_________________________________________________________________________________
Done.
Next, I'm going for Long Grass.
________________________________________________________________________________
drawLongGrass=function(x,y,w,h) {
var blockw=w*5/8;
cngCol('lime');
rect(x,y,w,h);
cngCol('green');
//grass1
rect(x+2*blockw,y+5*blockw,9*blockw,blockw);
rect(x+4*blockw,y+2*blockw,blockw,4*blockw);
rect(x+6*blockw,y+2*blockw,blockw,4*blockw);
rect(x+8*blockw,y+2*blockw,blockw,4*blockw);
rect(x+10*blockw,y+2*blockw,blockw,4*blockw);
//grass2
rect(x+4*blockw,y+10*blockw,9*blockw,blockw);
rect(x+6*blockw,y+7*blockw,blockw,4*blockw);
rect(x+8*blockw,y+7*blockw,blockw,4*blockw);
rect(x+10*blockw,y+7*blockw,blockw,4*blockw);
rect(x+12*blockw,y+7*blockw,blockw,4*blockw);
//grass3
rect(x+2*blockw,y+14*blockw,8*blockw,blockw);
rect(x+4*blockw,y+11*blockw,blockw,4*blockw);
rect(x+6*blockw,y+11*blockw,blockw,4*blockw);
rect(x+8*blockw,y+11*blockw,blockw,4*blockw);
rect(x+10*blockw,y+11*blockw,blockw,4*blockw);
}
_________________________________________________________________________________
Tree:
_________________________________________________________________________________
drawTree=function(x,y,w,h) {
var blockw=w*5/8;
cngCol('lime');
rect(x,y,w,h);
cngCol('green');
rect(x+7*blockw,y+blockw,blockw,blockw);
rect(x+6*blockw,y+2*blockw,3*blockw,blockw);
rect(x+5*blockw,y+3*blockw,5*blockw,2*blockw);
rect(x+4*blockw,y+5*blockw,7*blockw,2*blockw);
rect(x+3*blockw,y+7*blockw,9*blockw,2*blockw);
rect(x+2*blockw,y+9*blockw,11*blockw,1*blockw);
cngCol('tan');
rect(x+6*blockw,y+10*blockw,3*blockw,5*blockw);
}
Today, I am going to program a random world generator using Algo Code. If you want to do this, you have to download Algo Code (unless you already have it).
Okay. Now we are going to design the blocks.
Here are the blocks that I am going to use.
1. Grass Patch /Ground
2. Long Grass
3. Tree
4. Flower Patch
5. Rock
6. Water
7. Sand
First, I am going to design the objects. The objects are going to be pixelated into 16 X 16 form.
Here are the designs that I came up with:
1. Grass Patch /Ground
2. Long Grass

3. Tree

4. Flower Patch

5. Rock

6. Water

7. Sand

I'm going to start with programming Grass Patch.
________________________________________________________________________________
drawGrassPatch=function(x,y,w,h) {
cngCol('lime');
rect(x,y,w,h);
}
_________________________________________________________________________________
Done.
Next, I'm going for Long Grass.
________________________________________________________________________________
drawLongGrass=function(x,y,w,h) {
var blockw=w*5/8;
cngCol('lime');
rect(x,y,w,h);
cngCol('green');
//grass1
rect(x+2*blockw,y+5*blockw,9*blockw,blockw);
rect(x+4*blockw,y+2*blockw,blockw,4*blockw);
rect(x+6*blockw,y+2*blockw,blockw,4*blockw);
rect(x+8*blockw,y+2*blockw,blockw,4*blockw);
rect(x+10*blockw,y+2*blockw,blockw,4*blockw);
//grass2
rect(x+4*blockw,y+10*blockw,9*blockw,blockw);
rect(x+6*blockw,y+7*blockw,blockw,4*blockw);
rect(x+8*blockw,y+7*blockw,blockw,4*blockw);
rect(x+10*blockw,y+7*blockw,blockw,4*blockw);
rect(x+12*blockw,y+7*blockw,blockw,4*blockw);
//grass3
rect(x+2*blockw,y+14*blockw,8*blockw,blockw);
rect(x+4*blockw,y+11*blockw,blockw,4*blockw);
rect(x+6*blockw,y+11*blockw,blockw,4*blockw);
rect(x+8*blockw,y+11*blockw,blockw,4*blockw);
rect(x+10*blockw,y+11*blockw,blockw,4*blockw);
}
_________________________________________________________________________________
Tree:
_________________________________________________________________________________
drawTree=function(x,y,w,h) {
var blockw=w*5/8;
cngCol('lime');
rect(x,y,w,h);
cngCol('green');
rect(x+7*blockw,y+blockw,blockw,blockw);
rect(x+6*blockw,y+2*blockw,3*blockw,blockw);
rect(x+5*blockw,y+3*blockw,5*blockw,2*blockw);
rect(x+4*blockw,y+5*blockw,7*blockw,2*blockw);
rect(x+3*blockw,y+7*blockw,9*blockw,2*blockw);
rect(x+2*blockw,y+9*blockw,11*blockw,1*blockw);
cngCol('tan');
rect(x+6*blockw,y+10*blockw,3*blockw,5*blockw);
}
_________________________________________________________________________________
Flower patch is:
_________________________________________________________________________________
drawFlowerPatch=function(x,y,w,h) {
var blockw=w*5/8;
cngCol('lime');
rect(x,y,w,h);
//red flowers
cngCol('red');
//flower1
rect(x+3*blockw,y+2*blockw,3*blockw,blockw);
cngCol('lime');
rect(x,y,w,h);
//red flowers
cngCol('red');
//flower1
rect(x+3*blockw,y+2*blockw,3*blockw,blockw);
rect(x+4*blockw,y+blockw,blockw,3*blockw);
//flower2
rect(x+6*blockw,y+10*blockw,3*blockw,blockw);
rect(x+7*blockw,y+9*blockw,blockw,3*blockw);
//flower3
rect(x+11*blockw,y+7*blockw,3*blockw,blockw);
rect(x+12*blockw,y+6*blockw,blockw,3*blockw);
//blue flowers
cngCol('blue');
//flower4
rect(x+3*blockw,y+7*blockw,3*blockw,blockw);
cngCol('blue');
//flower4
rect(x+3*blockw,y+7*blockw,3*blockw,blockw);
rect(x+4*blockw,y+6*blockw,blockw,3*blockw);
//flower5
rect(x+blockw,y+11*blockw,3*blockw,blockw);
rect(x+2*blockw,y+10*blockw,blockw,3*blockw);
//purple flowers
cngCol('purple');
//flower6
rect(x+13*blockw,y+7*blockw,3*blockw,blockw);
cngCol('purple');
//flower6
rect(x+13*blockw,y+7*blockw,3*blockw,blockw);
rect(x+12*blockw,y+6*blockw,blockw,3*blockw);
//orange flowers
cngCol('orange');
//flower7
rect(x+8*blockw,y+3*blockw,3*blockw,blockw);
cngCol('orange');
//flower7
rect(x+8*blockw,y+3*blockw,3*blockw,blockw);
rect(x+9*blockw,y+2*blockw,blockw,3*blockw);
//flower middles
cngCol('yellow');
//flower1
rect(x+4*blockw,y+2*blockw,blockw,blockw);
//flower2
rect(x+7*blockw,y+10*blockw,blockw,blockw);
//flower3
rect(x+12*blockw,y+7*blockw,blockw,blockw);
//flower4
rect(x+4*blockw,y+7*blockw,blockw,blockw);
//flower5
rect(x+2*blockw,y+11*blockw,blockw,blockw);
}
//flower6
rect(x+14*blockw,y+7*blockw,blockw,blockw);
//flower7
rect(x+9*blockw,y+3*blockw,blockw,blockw);
}
_________________________________________________________________________________
Go ahead and do the rest yourself.
If you do not like my pictures, you can create your own.
Thanks.
29-05-2017
If you do not like my pictures, you can create your own.
Thanks.
29-05-2017
Sunday, May 21, 2017
Download Algo Code Version 1.0.1
Dear readers,
You can now download Algo Code Version 1.0.1 from this website.
Algo Code Version 1.0.1
Thanks.
21-05-2017
You can now download Algo Code Version 1.0.1 from this website.
Algo Code Version 1.0.1
Thanks.
21-05-2017
Subscribe to:
Posts (Atom)
