Skip to main content
added 114 characters in body
Source Link

FSharp - 153bytes153 143 bytes

let t(s:string)=
 let c=s.[2..]|>Seq.map string|>Seq.reduce(+)|>float
 matchif s.[0] with
[0]='B'then |'B'->sprintf"Ft%sprintf"Ft%.0f"(ceil(c/2.))
  |'F'->sprintf"Bo%else sprintf"Bo%.0f"(c*2.-1.)

Updates

  1. Knocked a few bytes off by switching from pattern matching to a simple if ... then ...

FSharp - 153bytes

let t(s:string)=
 let c=s.[2..]|>Seq.map string|>Seq.reduce(+)|>float
 match s.[0] with
 |'B'->sprintf"Ft%.0f"(ceil(c/2.))
  |'F'->sprintf"Bo%.0f"(c*2.-1.)

FSharp - 153 143 bytes

let t(s:string)=
 let c=s.[2..]|>Seq.map string|>Seq.reduce(+)|>float
 if s.[0]='B'then sprintf"Ft%.0f"(ceil(c/2.)) else sprintf"Bo%.0f"(c*2.-1.)

Updates

  1. Knocked a few bytes off by switching from pattern matching to a simple if ... then ...
Source Link

FSharp - 153bytes

let t(s:string)=
 let c=s.[2..]|>Seq.map string|>Seq.reduce(+)|>float
 match s.[0] with
 |'B'->sprintf"Ft%.0f"(ceil(c/2.))
 |'F'->sprintf"Bo%.0f"(c*2.-1.)