yea, snake/nibbles/worm whatever ^^ i dont know where to start from lolz, never did this before !
yea, snake/nibbles/worm whatever ^^ i dont know where to start from lolz, never did this before !
something like...
[pascal]program test;
uses
sysutils, crt;
type
Tpoint = record
x , y : integer;
end;
var
snake : array [1 .. MAXSNAKESIZE] of Tpoint;
snakesize : integer;
direction : integer;
var
i : integer;
begin
// initial snake
snakesize := 3;
snake[1].x := 3;snake[1].x := 1;
snake[2].x := 4;snake[2].x := 1;
snake[1].x := 5;snake[1].x := 1;
direction := 0;
while true do
begin
cls;
for i := 1 to snakesize do
case direction of
0 : snake[i].x := snake[i].x + 1;
1 : snake[i].y := snake[i]y - 1;
2 : snake[i].x := snake[i].x - 1;
3 : snake[i].y := snake[i].y + 1;
end;
for i := 1 to snakesize do
begin
goto(snake[i].x,snake[i].y);
write('*');
end;
// add keypress code to manage directions
// add a simple double loop to check snake head coliding with tail
// add a check if snake don't hit the walls
end;
end.[/pascal]
*don't sure if it works
*sorry for syntax errors, i writed this directly on the board
From brazil (:
Pascal pownz!
Bookmarks