Have you been nice this year?
CJam, 109 108 107 bytes
l" has been "1$[_,\S-:eu'@f-:A:+__,:)f%0e=@=\_{)__2+**))}%&A2ew::-:g1b0<]{}#4,="very "*_5>\"naughty""nice"?
Try it online.
Explanation
A full explanation will have to wait until later, but here is the code broken down into the different sections:
l" has been "1$[ e# Some preparation...
_,\S-:eu'@f-:A:+ e# Determine letter sum.
__,:)f%0e=@= e# Check divisor count.
\_{)__2+**))}%& e# Check for Christmas number.
A2ew::-:g1b0< e# Check ladder.
]{}#4,="very "*_5>\"naughty""nice"? e# Determine nice/naughtiness.
Pyth 86 bytes
Apparently I've been nice this year...
jd[z"has been"?qlzl{yPJsKxL+NG@Grz0"nice"+*"very "&!}Jm+*+2d*dd2SJhgs._M-VKtK0"naughty
Try it online: Demonstration or Test Suite
Explanation:
jd[z"has been"... list with input string, "has been" and ...; join with spaces
qlzl{yPJsKxL+NG@Grz0 compares the length of input with the number of divisors
(computes all prime factors and counts the elements in the powerset)
?..."nice" if True, use "nice" as last list element
else:
}Jm+*+2d*dd2SJ check for christmas number
(checks, if its of the form n^3+2*n^2+2)
gs._M-VKtK0 check if raising ladder string ends lower or equal
(assigns each neighbor pair a number -1,0,1 and computes the sum)
&!...h... returns 0, 1 or 2
*"very " repeat "very " this times
+..."naughty add "naughty" and use this as the third list element
MATL, 117 bytes
My longest MATL program so far :-) :-(
Uses current release of the language, which is earlier than this challenge.
jttk96-t0>)tstt:\~s4$bn=?xx'nice'}[1,2,0,2]99:ZQ=a?'naughty'}dt0>sw0<s-O>~'very naughty'w?'very 'wh]]]' has been 'whh
Examples
>> matl
> jttk96-t0>)tstt:\~s4$bn=?xx'nice'}[1,2,0,2]99:ZQ=a?'naughty'}dt0>sw0<s-O>~'very naughty'w?'very 'wh]]]' has been 'whh
>
> Doorknob
Doorknob has been very naughty
>> matl
> jttk96-t0>)tstt:\~s4$bn=?xx'nice'}[1,2,0,2]99:ZQ=a?'naughty'}dt0>sw0<s-O>~'very naughty'w?'very 'wh]]]' has been 'whh
>
> Jakube
Jakube has been nice
Explanation
jt % input string. Duplicate
tk96-t0>) % duplicate. Convert to lower, then to numbers, remove spaces
ts % duplicate. Sum
tt: % duplicate. Vector from 1 to obtained sum
\~s % modulus operation. Count zeros to determine number of divisors
4$bn= % does it equal original name length?
? % if so
xx'nice' % remove values not needed, and push string
} % else
[1,2,0,2]99:ZQ % all Christmas numbers
=a % does sum equal any Christmas number?
? % if so
'naughty' % push string
} % else
dt0>s % total number of increases
w0<s % total number of decreases
-O>~ % subtract both. Is total <=0?
'very naughty'w % push string, which will be needed in either case. Swap
? % if total was <=0
'very 'wh % prepend string
] % end if
] % end if
] % end if
' has been 'whh % build complete string from pushed parts