Skip to content

Instantly share code, notes, and snippets.

@morganwilde
Last active December 23, 2015 10:29
Show Gist options
  • Save morganwilde/6622014 to your computer and use it in GitHub Desktop.
Save morganwilde/6622014 to your computer and use it in GitHub Desktop.
program gyvatė;
var
taskas, tarpp, liko, ilgis, tarpo, laik, tn : integer;
begin
tn := 1;
while tn = 1 do
begin
Randomize;
taskas := Random(15)+5;
tarpp := 0;
liko := taskas - 1;
while liko > 0 do
begin
// komentaras
for laik:=1 to tarpp do write(' ');
liko := taskas - tarpp-1;
ilgis := Random(liko-2)+2;
// kitas
for laik:=1 to ilgis do write('x');
tarpo := liko - ilgis;
for laik:=0 to tarpo do write(' ');
if liko > 0 then
begin
writeln('o');
tarpp := tarpp + ilgis - 1;
end
else
begin
if ilgis <> 2 then writeln('x');
writeln;
writeln('Jei dar kartą spausk 1');
Readln(tn);
end;
end;
end;
Readln;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment