import { Random } from "./random" ; export { BorderConfig , BorderType , RandomBorderConfig } ; enum BorderType { Line , Text , Space } class BorderConfig { constructor ( private borders ) { } GetBorderTypes ( ) { return this . borders ; } Shorthand ( ) { return this . borders . map ( type => ( type === BorderType . Line ? "L" : "T" ) ) . reduce ( ( previous , current ) => { return previous + current ; } ) ; } } function RandomBorderConfig ( random ) { let circles = random . nextFloat ( ) * 3 + 2 ; let borders = new Array < BorderType > ( ) ; for ( let c = 0 ; c < circles ; c ++ ) { borders [ c ] = random . nextFloat ( ) >= 0.5 ? BorderType . Text : BorderType . Line ; } return new BorderConfig ( borders ) ; }