About the programming that can draw lots.

Use pascal

begin

Randomization;

Writeln ("Congratulations!" , random (< numbers >)+1,"Win!" );

End.

Programs that can be played? Here is a snake program, original, but there seems to be a bug (no impact on the game)

Program GReedySNAKE

Using Crt

const up = 0;

Right =1;

down = 2;

Left = 3;

Normal = 0;

Bonus =1;

shorten = 2;

Type point = record

X, y: integer;

End;

Tfood type = record

Fpoint: point;

ftype:byte;

Upper and lower case bytes of

Normal: ();

Bonus:

(b time:word;

bs core:byte);

Shorten:

(stime:word;

slength:byte);

End;

var cur,bin:point;

Food: tfood

Orbit: the point of array [1..200];

ch:char;

Dir: bytes;

Hit: Boolean type;

Int, length, score: integer;

Function Pzero (p: point): Boolean;

Var bool: Boolean type;

begin

If (p.x=0) and (p.y=0), then

Boolean: = true

other

bool:= false;

p zero:= bool;

End;

Process pwrite (p: point; ch:char);

begin

If it is not pzero(p), then

begin

gotoxy(p.x,p . y);

Write (ch);

End;

End;

Function psame(p, p2: point): Boolean;

Var bool: Boolean type;

begin

If (p.x=p2.x) and (p.y=p2.y), then

Boolean: = true

other

bool:= false;

psame:= bool;

End;

Process pset (var p: point; X2, y2: integer);

begin

p . x:= x2;

p . y:= y2;

End;

Process new food (var s food: t food);

Var int2: integer;

Ok: Boolean type;

begin

Do it with sfood

begin

pwrite(fpoint,' ');

ftype:= random(9);

If (ftype=3) or (ftype=4), then ftype: =1;

If ftype=5, ftype: = 2;

If ftype & gt5 then ftype:= 0;;

Case type

Usually:;

Bonus:

begin

btime:=(random(3)+4)* 20; {20= 1000/50}

bs core:= 8-(btime div 20);

End;

Shorten:

begin

If 3>, then the length

Ftype:= Usually

other

begin

stime:=(random(3)+4)* 20;

slength:= random(2)+ 1;

End;

End;

End;

repeat

Ok: = true;

pset(fpoint,random(78)+2,random(46)+2);

For int:= 1 to length do

okay:=okay and (not psame(fpoint,track[int]);

Okay:=okay and (non-psame(fpoint, cur)) and (non-psame(fpoint, bin)););

Until it's okay;

Case type

Usually:

begin

Textcolor (light magenta);

pwrite(fpoint,# 3);

Textcolor (yellow);

End;

Bonus:

begin

Textbackground (red);

pwrite(fpoint,' B ');

Textbackground (black);

End;

Shorten:

begin

Textbackground (green);

pwrite(fpoint,' S ');

Textbackground (black);

End;

End;

End;

End;

Program newtrack

var int:integer;

begin

pwrite(bin,' ');

For int:= 1 to length do

pwrite(track[int],# 2 19);

Textcolor (light red);

pwrite(cur,# 2);

Textcolor (yellow);

gotoxy(cur.x,cur . y);

End;

begin

Randomization;

check break:= false;

Textbackground (black);

Textcolor (yellow);

clrscr

Writeln ('greedy snake');

Writeln ('Use', #27#24#25#26,' keys to control the snake.' );

Writeln ('Pressing one of the keys continuously can make the snake run faster.' );

Textcolor (light magenta);

Write (# 3);

Textcolor (yellow);

Writeln ('Ordinary food, eating score+10.' );

Textbackground (red);

Write ('b');

Textbackground (black);

Writeln ('Reward food, if you eat it, score +40 or 60 or 80. "Eat quickly!" );

Writeln ('If eaten, the length of the snake will greatly increase.' );

Writeln ('so try to eat this food:');

Textbackground (green);

Write ('s');

Textbackground (black);

Shorten the length of the snake with food. And fast! ”);

Writeln ('The maximum length of a snake is 20 1.' );

Writeln ('If the length is really 20 1, the game is over.' );

Writeln ('Don't let the snake hit the wall or its body!' );

Writeln(' P' key: pause, press any key to continue when pausing. );

Writeln ('Note: (1) You'd better press Alt-Enter before the game.' );

Writeln(' (2) If the snake walks too fast, try opening it again.' );

Writeln ('Press any key to continue ...');

ch:= read key;

If ch=#0, then ch: = readkey;

clrscr

Writeln ('talking about experience:');

Writeln('( 1) Press one of the keys', #27#24#25#26,' continuously to make the snake faster,');

Writeln ('Use this carefully!' );

Writeln ('It should only be used when food is unusual.' );

Writeln('(2) When the length of the snake is too long,');

Writeln ('it's best to give up the opportunity to eat reward food.' );

Writeln('(3) It's best not to chase bonus food again and again!' );

Writeln ('Maybe the snake will hit its body.' );

Just talk about experience. Use it or not, it's your choice. );

Writeln ('Press any key to continue ...');

ch:= read key;

If ch=#0, then ch: = readkey;

text mode(8060);

Textbackground (black);

clrscr

Textcolor (yellow);

pset(cur, 1, 1);

For int:= 1 to 100 do.

pset(track[int],0,0);

pset(bin,0,0);

Length: =1;

Score: = 0;

dir:= right;

Textbackground (red);

gotoxy( 1,50);

writeln

writeln

Textbackground (blue);

Write ('length:', length+1);

gotoxy( 1,49);

Write ('score:', score);

Textbackground (black);

Textcolor (red);

gotoxy( 1, 1);

Write (# 2);

gotoxy( 1, 1);

Textcolor (yellow);

Newfood (food);

ch:= read key;

If ch=#0, then ch: = readkey;

repeat

repeat

Case food. ft type

Usually:

begin

Textcolor (light magenta);

pwrite(food.fpoint,# 3);

Textcolor (yellow);

End;

Bonus:

begin

Textbackground (red);

pwrite(food.fpoint,' B ');

Textbackground (black);

End;

Shorten:

begin

Textbackground (green);

pwrite(food.fpoint,' S ');

Textbackground (black);

End;

End;

gotoxy(food.fpoint.x,food . fpoint . y);

If psame(cur, food.fpoint), then

begin

Case food. ft type

Usually:

begin

Inc (score);

Inc (length);

End;

Bonus:

begin

inc(score,food . bs core * 2);

inc(length,trunc(food . bs core * 2.5));

End;

Shorten:

begin

for int:= 1 to food . slength do

begin

pwrite(track[length-int+ 1],' ');

pset(track[length-int+ 1],0,0);

End;

Dec (length, food, length);

End;

End;

Textbackground (blue);

gotoxy(8,49);

Write (score *10);

gotoxy(9,50);

Textbackground (red);

clreol

Textbackground (blue);

Write (length+1);

Textbackground (black);

Newfood (food);

End;

Delay (50);

If food.ftype & lt& gt That's as usual.

begin

dec(food . b time);

If food.btime=0, then

Newfood (food);

End;

Case catalogue

Up:

begin

If cur.y & gt, then 1

begin

Bin:= track [length];

If the length < then =200

for int:=length downto 1 do

Orbit [int+ 1]:= Orbit [int]

other

for int:= 199 down to 1 do

track[int+ 1]:= track[int];

track[ 1]:= cur;

December (current year);

newtrack

end

other

hit:= true;

End;

Left side:

begin

If cur.x & gt, then 1

begin

Bin:= track [length];

If the length < then =200

for int:= length- 1 down to 1 do

Orbit [int+ 1]:= Orbit [int]

other

for int:= 199 down to 1 do

track[int+ 1]:= track[int];

track[ 1]:= cur;

dec(cur . x);

newtrack

end

other

hit:= true;

End;

Right:

begin

If cur.x & lt, then 80.

begin

Bin:= track [length];

If the length < then =200

for int:= length- 1 down to 1 do

Orbit [int+ 1]:= Orbit [int]

other

for int:= 199 down to 1 do

track[int+ 1]:= track[int];

track[ 1]:= cur;

Inc(cur . x);

newtrack

end

other

hit:= true;

End;

Down:

begin

If cur.y & lt, then 48.

begin

Bin:= track [length];

If the length < then =200

for int:= length- 1 down to 1 do

Orbit [int+ 1]:= Orbit [int]

other

for int:= 199 down to 1 do

track[int+ 1]:= track[int];

track[ 1]:= cur;

Inc(cur . y);

newtrack

end

other

hit:= true;

End;

End;

For int:= 1 to length do

begin

Hit:=hit or psame(cur, track [int]);

End;

If the length & gt=200 and then hit: = true;

Until the key is pressed or pressed;

If you hit it,

other

begin

If psame(cur, food.fpoint), then

begin

Case food. ft type

Usually:

begin

Inc (score);

Inc (length);

End;

Bonus:

begin

inc(score,food . bs core * 2);

inc(length,trunc(food . bs core * 2.5));

End;

Shorten:

begin

for int:= 1 to food . slength do

begin

pwrite(track[length-int+ 1],' ');

pset(track[length-int+ 1],0,0);

End;

Dec (length, food, length);

End;

End;

Textbackground (blue);

gotoxy(8,49);

Write (score *10);

gotoxy(9,50);

Textbackground (red);

clreol

Textbackground (blue);

Write (length+1);

Textbackground (black);

Newfood (food);

End;

ch:= read key;

First box

#27: Pause;

#0:

begin

ch:= read key;

First box

#72:{UP}

begin

if(cur . y & gt; 1) and (dir < > down) and then

begin

Bin:= track [length];

If the length < then =200

for int:= length- 1 down to 1 do

Orbit [int+ 1]:= Orbit [int]

other

for int:= 199 down to 1 do

track[int+ 1]:= track[int];

track[ 1]:= cur;

December (current year);

newtrack

dir:= up;

end

other

If the directory & lt& gt is downloaded and then typed: = true;

End;

#75:{LEFT}

begin

if(cur . x & gt; 1) and (dir < > pair) and then

begin

Bin:= track [length];

If the length < then =200

for int:= length- 1 down to 1 do

Orbit [int+ 1]:= Orbit [int]

other

for int:= 199 down to 1 do

track[int+ 1]:= track[int];

track[ 1]:= cur;

dec(cur . x);

newtrack

dir:= left;

end

other

If the directory < gt is right and then hit: = true;

End;

#77:{RIGHT}

begin

if(cur . x & lt; 80) and (dir < gt left) and then

begin

Bin:= track [length];

If the length < then =200

for int:= length- 1 down to 1 do

Orbit [int+ 1]:= Orbit [int]

other

for int:= 199 down to 1 do

track[int+ 1]:= track[int];

track[ 1]:= cur;

Inc(cur . x);

newtrack

dir:= right;

end

other

If the directory < > is left, then type: = true;

End;

# 80:{ Down}

begin

if(cur . y & lt; 48) and (dir < > up) and then

begin

Bin:= track [length];

If the length < then =200

for int:= length- 1 down to 1 do

Orbit [int+ 1]:= Orbit [int]

other

for int:= 199 down to 1 do

track[int+ 1]:= track[int];

track[ 1]:= cur;

Inc(cur . y);

newtrack

dir:= down;

end

other

If the directory & lt& gtup then hit:= true;;

End;

End;

End;

Else if (ch='P') or (ch='p') then

begin

ch:= read key;

If ch=#0, then ch: = readkey;

End;

End;

End;

Until it hits;

text mode(co80);

Textbackground (black);

Textcolor (yellow);

clrscr

Write (# 219 # 219 # 219);

Textcolor (light red);

Write (# 2);

Textcolor (yellow);

Writeln ('Game over!' );

writeln(' Score:',Score * 10);

Write ('snake length:');

If the length is < 200 and then writeln (length+1)

else writeln(20 1);

writeln(' Press & lt; Enter & gt to exit ...);

readln

End.