pgul / battleship

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Count ships on field for battleship game

Input should be text file with exact 10 lines 10 characters length each. Space char means empty field, any oather character means ship.

Single pass, no extra arrays.

Tests:

$./battleship.pl field1
There are 3 ships
$./battleship.pl field2
There are 4 ships

About


Languages

Language:Perl 100.0%