Skip to content

xpepper/exo-train-kata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exo-train kata

Given a string representation of a train, print an ASCII-art representation of this train.

  • H: locomotive <HHHH
  • P: passenger car |OOOO|

Cars are attached together by ::

HPP ---> <HHHH::|OOOO|::|OOOO|


  • R: restaurant car |hThT|

HPRP ---> <HHHH::|OOOO|::|hThT|::|OOOO|


  • H: locomotive attached at the end HHHH>

HPRPH ---> <HHHH::|OOOO|::|hThT|::|OOOO|::HHHH>


  • A car can be deatached from the head or the end of the train

HPRPH ---> toASCIIart ---><HHHH::|OOOO|::|hThT|::|OOOO|::HHHH> ---> detachEnd ---> <HHHH::|OOOO|::|hThT|::|OOOO| ---> detachHead ---> |OOOO|::|hThT|::|OOOO|


  • C: cargo car |____| (when empty) |^^^^| (when full)

HCCC ---> <HHHH::|____|::|____|::|____| ---> fill ---> <HHHH::|^^^^|::|____|::|____| ---> fill ---> <HHHH::|^^^^|::|^^^^|::|____| ---> fill ---> <HHHH::|^^^^|::|^^^^|::|^^^^| ---> fill ---> error: cannot fill a full train


About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published