Gra wisielec

Gra została napisana w języku Perl.
wisielec - online
wisielec.rar

#!D:/Perl/bin/perl
#use warnings;
use CGI;
use CGI::Carp qw 'fatalsToBrowser';

my $cgi = new CGI;
print $cgi->header(-type => 'text/html',-charset => 'iso-8859-2');

my $all .= $cgi->param(all).$cgi->param(st);
my $max = 13;

if(!$cgi->param(slowo) || $cgi->param(slownik))
   {
   $f = slowo();
   @t = split(/:/,$f);;
   $slowo = @t[0];
   $opis = @t[1];
   }
else
  {
  $opis = $cgi->param(opis);
  $slowo = $cgi->param(slowo);
  }

$slowo2 = $slowo;
if($all)
  {
  $slowo2 =~ s/[^$all]/-/g;
  }
else
   {
   $slowo2 =~ s/[a-zA-Z]/-/g;
   }

$ile_razy = $cgi->param(ile_razy);
$ciag = $cgi->param(st);

if($slowo2 =~ m/$ciag/ == false)
{
  $ile_razy++;
}
if($slowo2 =~ m/-/)
  {
   $text = 'Wygrałeœ!!!';
  }
else
{    
if($ile_razy < $max)
  {
  $text = 'Zostało jeszcze '.($max - $ile_razy).' prób';
  }
else
  {
  $text = 'przegrales';
  }

print $cgi->start_html(-title => 'Wisielec',-bgcolor=>"white"),
           $cgi->div({-align=>center}) ,
           $cgi->table({-border=>0,-width=>"100"},
           $cgi->Tr([$cgi->td({-align=>center},"Wybierz słownik:")]),
           $cgi->Tr([$cgi->td({-align=>center},
               $cgi->table({-border=>0,-width=>"100%"},
                   $cgi->Tr([$cgi->td({-align=>left},$cgi->a({-href=>'?slownik=telekomunikacja'},"telekomunikacja"))]),
                   $cgi->Tr([$cgi->td({-align=>left},$cgi->a({-href=>'?slownik=akronimy'},"akronimy"))]),
                   $cgi->Tr([$cgi->td({-align=>left},$cgi->a({-href=>'?slownik=ogolny'},"ogólny"))]),)
           )]),),
           $cgi->start_form(-method=>"post",-action=>"gra.cgi"),
           $cgi->table({-border=>0,-width=>"500"},
           $cgi->Tr([$cgi->td({-align=>center},$cgi->hr({-width=>"100%"}).$cgi->b("Opis: ").$opis),
           $cgi->td({-align=>center},$slowo2),
           $cgi->td({-align=>center},''),
           $cgi->td({-align=>center},$text)
           ]));

if($ile_razy < $max)
   {
    przyciski();
   }
 #print $cgi->hidden(-value=>$all,-name=>"all");
 print '';
 print '';
 print '';
 print '';
 
 print $cgi->table({-border=>0,-width=>"100%"});
 print $cgi->Tr([$cgi->td({-align=>center},$cgi->submit(-name=>'reset',-value=>'RESET'))]);
 print $cgi->end_form(),$cgi->end_html();
sub przyciski{
    print '

'; if ($all !~ /a/) { print $cgi->submit(-name=>'st',-value=>'a');} if ($all !~ /b/) { print $cgi->submit(-name=>'st',-value=>'b');} if ($all !~ /c/) { print $cgi->submit(-name=>'st',-value=>'c');} if ($all !~ /d/) { print $cgi->submit(-name=>'st',-value=>'d');} if ($all !~ /e/) { print $cgi->submit(-name=>'st',-value=>'e');} if ($all !~ /f/) { print $cgi->submit(-name=>'st',-value=>'f');} if ($all !~ /g/) { print $cgi->submit(-name=>'st',-value=>'g');} if ($all !~ /h/) { print $cgi->submit(-name=>'st',-value=>'h');} if ($all !~ /i/) { print $cgi->submit(-name=>'st',-value=>'i');} if ($all !~ /j/) { print $cgi->submit(-name=>'st',-value=>'j');} if ($all !~ /k/) { print $cgi->submit(-name=>'st',-value=>'k');} if ($all !~ /l/) { print $cgi->submit(-name=>'st',-value=>'l');} if ($all !~ /m/) { print $cgi->submit(-name=>'st',-value=>'m');} if ($all !~ /n/) { print $cgi->submit(-name=>'st',-value=>'n');} if ($all !~ /o/) { print $cgi->submit(-name=>'st',-value=>'o');} if ($all !~ /p/) { print $cgi->submit(-name=>'st',-value=>'p');} if ($all !~ /q/) { print $cgi->submit(-name=>'st',-value=>'q');} if ($all !~ /r/) { print $cgi->submit(-name=>'st',-value=>'r');} if ($all !~ /s/) { print $cgi->submit(-name=>'st',-value=>'s');} if ($all !~ /t/) { print $cgi->submit(-name=>'st',-value=>'t');} if ($all !~ /u/) { print $cgi->submit(-name=>'st',-value=>'u');} if ($all !~ /v/) { print $cgi->submit(-name=>'st',-value=>'v');} if ($all !~ /w/) { print $cgi->submit(-name=>'st',-value=>'w');} if ($all !~ /x/) { print $cgi->submit(-name=>'st',-value=>'x');} if ($all !~ /y/) { print $cgi->submit(-name=>'st',-value=>'y');} if ($all !~ /z/) { print $cgi->submit(-name=>'st',-value=>'z');} } sub slowo() { if($cgi->param(slownik)) { $pl = $cgi->param(slownik).".txt"; } else { $pl = "ogolny.txt"; } open(PLIK,$pl); @linie = ; $ile = @linie; $in = int(rand($ile)); return @linie[$in]; }

Dział: