0% found this document useful (0 votes)
7 views4 pages

Program JogoDaForca - Pas

The document is a Pascal program for a Hangman game called 'JogoDaForca'. It includes procedures for drawing the hangman, clearing lines, and creating a box for the game interface. The main loop allows players to guess letters in a hidden phrase until they either guess the phrase correctly or exhaust their attempts.

Uploaded by

alcada300
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Program JogoDaForca - Pas

The document is a Pascal program for a Hangman game called 'JogoDaForca'. It includes procedures for drawing the hangman, clearing lines, and creating a box for the game interface. The main loop allows players to guess letters in a hidden phrase until they either guess the phrase correctly or exhaust their attempts.

Uploaded by

alcada300
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Program JogoDaForca ;

uses
crt;
var
frase : string[30];
conta,
tenta,
tamanho,
espacos,
encontrou,
x,
i :integer;
letra,
opcao:char;
{procedimento força}
procedure forca;
begin
gotoxy(70,6);write('******');
gotoxy(70,8);write(' *');
gotoxy(70,7);write(' *');
gotoxy(70,9);write(' *');
gotoxy(70,10);write(' *');
end;

{procedimento limpa_linha}
procedure limpa_linha(x,y,x1, cor:integer);
var
i :integer;
begin
textcolor (cor);
for i:= x to x1 do

begin
textcolor (cor);

gotoxy(i,y);

write('z');
end;

textcolor(white);

end;

{procedimento de som}

{procedimento caixa}

PROCEDURE caixa(x,y,x1,y1, cor ,cod:integer);

var i,j :integer;


begin
textcolor(cor);
for j := y to y1 do
for i:= x to x1 do
begin
gotoxy(i,j);
write(cod);
end;
textcolor(cor+1);
textbackground(cor);

gotoxy(x,y); write('É');
gotoxy(x1,y); write(' ');
gotoxy(x,y1); write('Î');
gotoxy(x1,y1); write('º');

for j := y+1 to y1-1 do

begin
gotoxy(x,y);
write('😍');
gotoxy(x1,j);
write('😍');
end;
for i := x+1 to x1-1 do
begin
gotoxy(i,y);
write('-');
gotoxy(i,y1);
write('-');
end;
textcolor(white);
end;

{bloco principal}
Begin
repeat

{cirscr;}
caixa(1,1,80,24,1,219);
caixa(2,2,79,23,3,219);
caixa(3,3,78,22,4,219);
caixa(4,4,77,21,1,219);
caixa(27,1,55,3,7,219);

highvideo;
textcolor (9+128);
gotoxy(28,2);

write('JOGO DA FORÇA');
normvideo;

textcolor(14);

textbackground(1);

forca;
conta:=0;
tenta:=0;
gotoxy(5,5);

write('INTRODIZA UMA FRASE');

gotoxy(27,5);

readln(frase);
limpa_linha(27,5,76,1);
{ tamanho := LENGHT(frase); }

for i := 1 to tamanho do
begin
gotoxy(4+1,10);
if frase[i] = '' then
begin
write('');

espacos := espacos +1;


end

else write('_');

end;

x:=5;

repeat
gotoxy(5,15);
write('INTRODUZA UMA LETRA');
GOTOXY(5,34);
repeat
letra:=readkey;
until (letra<>'');
encontrou:=0;
for i := 1 to tamanho do
begin
gotoxy(4+1,10);
if frase[i] = '' then
begin
write (letra);
conta := conta+1;
encontrou := 1;
end
else if (i = tamanho) and (encontrou = 0) then

tenta:= tenta +1;

end ;

gotoxy(x,16);
write(letra);

x:= x+2;

encontrou := 0;
case tenta of

1: begin

gotoxy(70,7);
write('O');
end;

2:begin
gotoxy(70,8);
write('i');
end;

3:begin
gotoxy(69,8);
write('/');
end;
4:begin
gotoxy(71,8);
write('\');
end;

5:begin
gotoxy(69,9);
write('/');
end;

6:begin
gotoxy(71,9);
write('\');
end;
end;
until (conta = tamanho - espacos) or (tenta < 6);

if (conta = tamanho - espacos) then


begin

highvideo ;
textcolor(white+blink);
gotoxy(30,20);
write('PARABENS...')
END
else
begin
highvideo;
textcolor(white+blink);
gotoxy(15,18);

write('A FRASE ERA: ', frase);


gotoxy(30,21);
write('PERDEU...');
end;
textcolor(write);

gotoxy(25,23);
write('QUER JOGAR OUTAR VEZ(S/N)?');
REPEAT
gotoxy(54,23);
opcao:=upcase(readkey);
until(opcao = 'N') or (opcao = 'S');
textcolor(white);
textbackground(black);

until opcao = 'N';

writeln;

End.

You might also like