Thursday, March 23, 2017

Answer for Riddle of the Day

The answer is...

NEITHER! The dinosaur came first!!!

Just kidding.
It's a mystery.

Thanks for eating!

23-03-2017

Andblock to CoFFee

Hello readers!

I have come back! Sorry for the time inactive. I was very busy back then so I did not have the time. Anyway, please enjoy CoFFee and have fun! Thanks.

23-03-2017

Wednesday, March 22, 2017

Feedback

Dear readers,
As this blog is brand new, we find any feedback valuable. So, please give us feedback via comments. Also, please participate in the poll that we have now. Your decision is very important. Remember, you, the audience is the priority. So, your decision will affect this blog.

Thank you for your cooperation.

22-03-2017

Algo Code Ep 2 - Setting Up Part 2

Hello readers!

This is the second episode of Algo Code. Let's continue to startup Algo Code.

We can test Algo Code using Program Test.

In Program Test, copy this and save it as Test 1 algorithm.txt .
_________________________________________________________________________________
START
  SET start=false
  SET n=0
  REPEAT
    IF start=true AND n<100
      ADD the value of n with 1
    END IF
  UNTIL start=false
  FOREVER
    CLEAR canvas
    IF n=100
      SET n=0
      SET start=false
    END IF
    SHOW n
  END FOREVER
END
_________________________________________________________________________________
This is the algorithm for Test 1.

Next, this is Test 1 code.
_________________________________________________________________________________
var start=false;
var n=0;

update=function() {
cnvscls();
text(n,60,60);
if(start==true && n<100) {
n+=1;
}
if(n==100) {
n=0;
start=false;
conscls();
}
}

setInterval(update,15);
_________________________________________________________________________________

It is the algorithm for Test 1.

Copy and paste Test 1 into MAIN.js and run app.html . Open console. Oh  yeah! Algo Code is best to be used with Google Chrome. Anyway, in console, type 'start=true' (without the quotes). The 0 on the canvas should increase by 1 until it reaches 99 and the console will clear it self.

For Test 2, save this as Test 2 algorithm.
_________________________________________________________________________________
START
  SET a=0
  SET b=0
  SET c=0
FOREVER
    CLEAR canvas
    IF pressingUp=true
      a=a+1
    END IF

    IF pressingDown=true
      a=a-1
    END IF

    IF pressingLeft=true
      b=b-1
    END IF

    IF pressingRight=true
      b=b+1
    END IF

    SHOW a AND b
    SHOW '+'
    SET c=a+b
    SHOW '='
    SHOW c
  END FOREVER
END
_________________________________________________________________________________

Next, save this code as Test 2 code.
_________________________________________________________________________________
var a=0;
var b=0;
var c=0;

update=function() {
if(pressingUp==true) {
a+=1;
}
if(pressingDown==true) {
a-=1;
}
if(pressingLeft==true) {
b-=1;
}
if(pressingRight==true) {
b+=1;
}

text(a,80,110);
text('+',150,110);
text(b,240,110);
c=a+b;
text('=',150,180);
text(c,150,260);
}

setInterval(update,15);
_________________________________________________________________________________

Like earlier, run app.html . This time you do not need to use console. Just use the arrow keys. The Up arrow key will increase the number on the left and the Down arrow key will decrease it. The Left arrow key will decrease the number on the right and the Right arrow key will increase the number on the right.

This is how to set up Algo Code.

Thanks for eating.

Continue in Ep 3.

22-03-2017

Riddle of the Day

Who came first? The chicken or the egg?

Please give your answer in the comments section!

Have a break, have a pretzel!

22-03-2017

Faded

Dear readers,

Please enjoy this song, Faded.


Thanks for drinking!

22-3-2017

Algo Code Ep 1 - Setting Up Part 1

Hello readers!

This is the first episode of Algo Code! First, before we start programming anything, we have to startup Algo Code.

First, create some files like this:

Algo Code {
       Program Test {
       }
       Project 1 {
            app.html
            fcnt.js
            MAIN.js
            vbl.js
       }
}

Easy, right?

Next, copy this code.
_________________________________________________________________________________
<canvas id="ctx" width="360" height="360" style="border: 1px solid #000000"></canvas>
<script src="fnct.js"></script>
<script src="vbl.js"></script>
<script src="MAIN.js"></script>

<script>
var ctx=document.getElementById("ctx").getContext("2d");
ctx.font='30px Comic Sans MS';

</script>      
_________________________________________________________________________________

Save it in app.html.

After that, this code.
_________________________________________________________________________________
//color
cngCol=function(c_c) {
ctx.fillStyle=c_c;
}

//fill
text=function(wor_dr,x_y,y_x) {
ctx.fillText(wor_dr,x_y,y_x);
}
rect=function(x_x,y_y,w_j,h_j) {
ctx.fillRect(x_x,y_y,w_j,h_j);
}

//clear
cnvscls=function() {
ctx.clearRect(0,0,WIDTH,HEIGHT);
}

//time
wait=function(w_w) {

var v_v=w_w*25;
a_exist=true;

if(t_t<v_v && a_exist==true) {
b_exist=true;
}
if(t_t==v_v) {
a_exist=false;
b_exist=false;
n_n+=1;
t_t=0;
}

}

//console
conssay=function(w_v) {
console.log(w_v);
}

conscls=function() {
console.clear();
}

/*
document.onmousedown=function(mouse) {
if(mouseX>0 && mouseX<WIDTH && mouseY<0 && mouseY<HEIGHT) {
mouseisPressed=true;
}
}
*/
//rpt
vard=function() {
/*
var mouseX=mouse.clientX-0;
var mouseY=mouse.clientY-8;
*/
//time
if(b_exist==true) {
t_t+=1;
}
}

setInterval(vard,15);

//keyboard
document.onkeydown=function(event) {
//www.cambriaresearch.com/articles/15/javascript-char-codes-key-codes
    if(event.keyCode === 39)
        pressingRight = true;

    else if(event.keyCode === 37)
        pressingLeft = true;

    else if(event.keyCode === 38)
        pressingUp = true;

    else if(event.keyCode === 40)
        pressingDown = true;

    else if(event.keyCode === 65)
        pressingA = true;

    else if(event.keyCode === 66)
        pressingB = true;

    else if(event.keyCode === 67)
        pressingC = true;
}

document.onkeyup=function(event) {
//www.cambriaresearch.com/articles/15/javascript-char-codes-key-codes
    if(event.keyCode === 39)
        pressingRight = false;

    else if(event.keyCode === 37)
        pressingLeft = false;

    else if(event.keyCode === 38)
        pressingUp = false;

    else if(event.keyCode === 40)
        pressingDown = false;

    else if(event.keyCode === 65)
        pressingA = false;

    else if(event.keyCode === 66)
        pressingB = false;

    else if(event.keyCode === 67)
        pressingC = false;
}
_________________________________________________________________________________
Save this in fcnt.js .

Lastly, this in vbl.js .
_________________________________________________________________________________
//canvas
var WIDTH=360;
var HEIGHT=360;

//mouse
/*
var mouseX=mouse.clientX-0;
var mouseY=mouse.clientY-8;
var mouseisPressed=false;
*/

//keyboard
var pressingUp=false;
var pressingDown=false;
var pressingLeft=false;
var pressingRight=false;
var pressingA=false;
var pressingB=false;
var pressingC=false;

//time
var a_exist=false;
var b_exist=false;
var n_n=0;
var t_t=0;
_________________________________________________________________________________

These are the files that we need in Project 1.

Continue in Ep 2

22-03-2017

Tuesday, March 21, 2017

Forever Young

CoFFee will be Forever young!

Lyrics:
Let's dance in style, let's dance for a while,
Heaven can wait we're only watching the skies.
Hoping for the best, but expecting the worst,
Are you gonna drop the bomb or not?
Let us die young or let us live forever
We don't have the power, but we never say never
Sitting in a sandpit, life is a short trip
The music's for the sad man.
Can you imagine when this race is won?
Turn our golden the faces into the sun,
Praising our leaders, we're getting in tune
The music's played by the, the madman.
Forever young,
I want to be forever young.
Do you really want to live forever?
Forever, and ever
Forever young,
I want to be forever young
Do you really want to live forever?
Forever young.
Some are like water, some are like the heat
Some are a melody and some are the beat
Sooner or later they all will be gone
Why don't they stay young?
It's so hard to get old without a cause
I don't want to perish like a fading horse
Youth's like diamonds in the sun,
And diamonds are forever
So many adventures given up today,
So many songs we forgot to play.
So many dreams swinging out of the blue
Oh let it come true.
Forever young,
I want to be forever young.
Do you really want to live forever,
Forever, and ever?
Forever young,
I want to be forever young.
Do you really want to live forever,
Forever, and ever?
Forever young
I want to be forever young
Do you really want to live forever,
Forever young

21-03-2017

Algo Code

Dear programmer lovers!
I am going to start a new series called Algo Code. Algo Code is a programming languae that I created myself. I can be used to program simple programs. However, for Verison 1.0.0, mouse interaction is unavailable. Sorry.

Anyway, just have fun!


21-03-2017

CoFFee is created!

On 21-3-2017, CoFFee was created!


Never say never!


21-03-2017