Fan has typed in some Battleships grids at /usr/project/courses/cps271/battleships. The format is:
c <text> - comment [may be repeated]
s <row> <col> <type> - shot [may be repeated]
a <counts for the 10 columns> - across sums
d <counts for the 10 rows> - down sums
The types are ``='' (water), ``<'', ``X'', ``>'' (across ship pieces), ``A'', ``X'', ``V'' (down ship pieces), and ``o'' (sub).
For example:
c games magazine jan 1996 p 62
c 1-seaman
s 5 8 o
s 7 2 V
a 4 1 1 1 2 4 2 2 2 1
d 2 2 1 2 1 1 1 6 1 3
This means:
This corresponds to the grid:
+----------+
| | 4
| | 1
| | 1
| | 1
| o | 2
| | 4
| V | 2
| | 2
| | 2
| | 1
+----------+
2212111613
Your program should output:
=====<XX>=
==o=======
=======o==
=========A
=======o=X
=A=<>====V
=V=====A==
===o===X==
A======V==
V=========