Problem F
MAZE EXPLORATION
Inpu Fil Name F.DAT
Progra Sourc File F.PA o F. o F.CPP
maz o rectangula room i represente o tw
dimensiona gri a illustrate i figur 1a Eac poin o th
gri i represente b character Th point o roo wall ar
marke b th sam characte whic ca b an printabl characte
differen tha .*. ._ an space I figur thi characte i ..
(decima cod 219) Al th othe point o th gri ar marke
b spaces
.......................................... ..........................................
.. .. .. .. .. .. .......................... .. ..
.. .. .. .. .......................... .. ..
.. .. .. .. .. .. .......................... .. ..
............ ...... .................... ..........................................
.. .. .. .. .. .. .. ..................................
.. .. * .. .. ..................................
.. .. .. .. .. .. .. ..................................
.......................................... ..........................................
a Initial maz b Painte maze
Figur 1. Mazs o rectangula rooms
Al room o th maz ar equa size wit al wall
point wid an poin thic a illustrate i figur 2 I
addition wal i share o it ful lengt b th separate
rooms Th room ca communicat throug doors whic ar
positione i th middl o walls Ther ar n outdoo doors
door
|
.... ....
.. . .. measure fro withi th room
doo - ...-- wall ar point wide
.. . ..__
.......... |
|___ wall ar on poin thick
Figur 2 roo wit doors
You proble i t pain al room o maz whic ca b
visite startin fro give room calle th .star room whic i marke b sta (.*. positione i th middl o th room
roo ca b visite fro anothe roo i ther i doo o th
wal whic separate th rooms B convention roo i painte
i it entir surface includin th doors i marke b th
characte . (decima cod 176 a show i figur 1b.
Th progra inpu i tex fil structure a follows:
1 Th firs lin contain positiv intege whic show th
numbe o maze t b painted.
2 Th res o th fil contain th mazes
Th line o th inpu fil ca b o differen length Th
tex whic represent maz i terminate b separatio lin
ful o underscore (._.) Ther ar a mos 3 line an a mos
80 character i lin fo eac maze
Th progra read th maze fro th inpu file paint the
n write th painte maze o th standar output.
Th outpu tex o painte maz ha th sam forma a tha
whic ha bee rea fo tha maze includin th separatio
lines Figur illustrate simpl inpu whic contain
singl maz an th correspondin output.
a input - numbe o mazes
..................
.. .. ..
.. * ..
.. .. ..
..................
.. ..
.. ..
.. ..
..........
_____ __ separatio line
en o file
b output ..................
..................
..................
..................
..................
.. ..
.. ..
.. ..
..........
_____
end of file
Figur 3 An exampl o progra inpu an outpu.........................................