A golang project to read the blueprint of an apartment and identify the placements of different chair in different tooms
The layout of an apartment may look as follows :
+-----------+------------------------------------+ | | | | (closet) | | | P | S | | P | (sleeping room) | | P | | | | | +-----------+ W | | | | | W | | | | | | +--------------+---------------------+ | | | | | W W | | | (office) | | | | +--------------+ | | | | | | | (toilet) | | P | | C | | | | | | | +--------------+ +---------------------+ | | | | | | | | | | | | | (bathroom) | | (kitchen) | | | | | | | | W W | | | | W W | | P + | | | / +---------------------+ | / | | / | | / W W W | +---------+ | | | | S W W W | | (living room) | | S | | | | | | | | | +--------------------------+---------------------+ | | | P | | (balcony) | | P | | | +---------------------+
./start.sh
go build
go test -v
// to run a specific test
go test -run Test_ReadRoom -v
We now need a command line tool that reads in such a file and outputs the following information:
- Number of different chair types for the apartment
- Number of different chair types per room
The different types of chairs are as follows:
W: wooden chair
P: plastic chair
S: sofa chair
C: china chair
The output must look like as follows:
total:
W: 3, P: 2, S: 0, C: 0
living room:
W: 3, P: 0, S: 0, C: 0
office:
W: 0, P: 2, S: 0, C: 0