Arrr... Ahoy there, me maties! Unfurl tha' mainsail! Full to starboard! Ah, feel th' wind in yer hair!
Right, me hearties... I be needin' a bit of yer codin' skills! Me crew are a li'l more modernized than meself... I still be preferrin' th' points of th' compass (see here for more info, Arrr...) while me crew are always usin' a headin'... I be wantin' an easy way of convertin' this twaddle they call a headin' into what I be able to understand, Arrr!
What I be needin' is code tha' be takin' input of a number (decimals are okay) such tha'
0 <= the headin' < 360 and it be spittin' out th' answer as th' closest compass point! Arrr!
Here be some examples:
> heading 0.1
> heading 11.25
North by East
> heading 22.7
> heading 44.99
> heading 91
Now, if'n th' headin' ye be givin' be such that it falls exactly in th' middle of two compass points, don' ye be frettin', me hearties... I be expectin' th' code to spit out
Between <point 1> and <point 2>, e.g.
heading 5.625 will say
Between North and North by East
This only be happenin' for a headin' tha' be satisfyin' the equation
H = 5.625 + 11.25(N) where H be th' headin' and N be an integer between 0 and 31 inclusive...
Two restrictions tho'...
1) I not be wantin' ye to use arrays for storin' yer data for the points or th' headin's... Tha' be cheatin', sir, an' ye be gettin' a taste of me blunderbuss... This has t' be calculated, jus' like th' old days! Arrr!
2) Shortest code wins, or I'll be makin' ye walk th' plank... Arrr!