Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Tag Info

Hot answers tagged restricted-source

1300

Python, 52 bytes print sum(ord(c) for c in 'Happy new year to you!') Updated for 2015 thanks to @Frg: print sum(ord(c) for c in 'A Happy New Year to You!') Mouse over to see 2016 version: Try it online!

258

Ruby def method_missing(meth,*args) puts 'Banana' send(meth.next) end def also puts "Orange you glad I didn't say banana?" end ahem Demo Clears its throat, prints "Banana" 3070 times, and also puts "Orange you glad I didn't say banana?". This uses Ruby's ridiculous just-in-time method definition functionality to define every method that lies ...

243

Befunge 98 - 17 11 9 8 bytes '-:*b-.@ Similar to the old version, but I remembered about ' '-:* pushes 45, duplicates it, then squares it, producing 2025 b- subtracts 11 from it, resulting in 2014 .@ prints the result, then ends the program Interestingly, 452-11 is the only pairing of numbers a,b where $$(a,b)∈[32,126]\times[10,15]\land a^2-b=2014$$ ...

239

Ruby, 15 p Time.new.year Temporary ;) Note that the section of the question independently of any external variables such as the date or time or a random seed was not edited in until long after I posted my answer... Jan Dvorak offers a great alternative in the comments: Happy = Time Happy.new.year But it's so unenthusiastic. I prefer: Happy = Time ...

223

Go, 2 bytes (UTF-16) One unicode character (2 bytes in UTF-16, 3 bytes in UTF-8 format), output 2014 as part of an error — http://ideone.com/dRgKfk can't load package: package : prog.go:1:1: illegal character U+2014 '—'

177

Python, 26 print int('bbc',ord("\r"))

171

Perl Since the obvious answer uses shifting of some kind, I feel obligated to post something using Acme::EyeDrops, however with the extra power I thought mine ought to be a little more fun. ''=~('('."\?". '{'.(''|'%').('['^'-' ).(''|'!'). ("\"| ',' ).'"'.('['^...

155

Python 2, 14 bytes print3<3[~3] The expression 3<3 gives the Boolean False, and the backticks give its string representation 'False'. From here, it remains to extract the letter a. Python is 0-indexed, so the a is at index 1, which is a banned character. It can be expressed as 3-2, but there's a shorter way. Python allows indexing from the back, ...

147

JavaScript (ES7), score 17, 176 bytes They said it couldn't be done, so I did it :D (thanks to a lot of help from @FullDecent) ""**"" ~(~/~//~/~/)/~/~/ 3 4 !NaN- -!NaN- -!NaN- -!NaN- -!NaN 6 7 8 9 ++[[]][+[]]+[+[]] 11 'lengthlength'.length 222>>2>>2 ${^}xE^ 0XF C=CSS==CSS;C<<C<<C<<C<<C 555555555555555555555%55 ... 146 MATLAB, Scala (4 characters, 5 bytes) You can take advantage of MATLAB's (and Scala's) relatively weak type system, here. The trick is to apply the unary + operation on a string composed only of the character ߞ (of UTF-8 code point U+07DE, or 2014 in decimal). This operation implicitly converts the string to a double (in MATLAB) and to an Int (in Scala): +'... 136 bash, vim and dc (343) I'm sitting at a bash prompt which has been configured by the Evil Genius, and of course he has VISUAL=vim in the default environment. Using the default bash binding for edit-and-execute-command (C-x C-e) bash invokes$VISUAL and will execute its buffer contents on exit (ZZ). I type in the following sequence (Note: kbd-mode are ...

126

Mouse-2002, 4 bytes. That's 4 bytes of pure, sweet ASCII. In Mouse, the letters of the alphabet are initialised to the values 0-25. ! is the operator for printing integers, thus this prints 20 then 14 (no intermittent newline). U!O! There's no online interpreter available, but here you will find an interpreter written in C (needing some tweaks before one ...

126

90. Brainfuck, uses no " ++++ ++++ [>+>++>+++>++++>+ ++++>++++++>+++++++ >+++++++ +>++++++ +++>++++++++++>+ ++ ++ ++++++>++++ +++ +++ ++> +++ +++ ++++ +++>++++++++ +++ +++ >++ +++ ++++ ++ ++ ++ >+++ ++++ ...

118

dc, 6 chars DiBBCp D pushes 13 on the stack, even tho the input radix is 10 initially i changes input radix (to 13 from 10) BBC is 2014 base 13. p prints. Console output: $dc <<< "DiBBCp" 2014 109 bash,$127127 x;echo \?$? Try it online! Since the x command doesn't exist, it errors and sets the exit code to 127. Then, the code outputs a dollar sign followed by$? twice. The $? variable stores the exit code of the previous command, so this outputs$127127 in 13 bytes.

103

Perl Some say perl is a language full of ascii noise and random symbols like $... That is not true :P s zzHelloq worldmz and s zqzchr 44ze and s zmzchr 33ze and print 96 Unary, N=1 4132527913354820031118363262102424570092493175835499123283719 (4.1325279e+60) bytes Source code in unary is obviously too large to post here. It can be easily reproduced by typing out (or generating) a file filled with "0"s of the same length as the number of bytes above. Here is the binary representation: ... 94 Windows 2000 - Windows 8 (3907172 / 23³ = 321) NOTE: DON'T F'ING RUN THIS! Save the following to a batch file and run it as Administrator. CD|Format D:/FS:FAT/V/Q Output when run on a 4TB drive with the first printed number in bold. Insert new disk for drive D: and press ENTER when ready... The type of the file system is NTFS. The new file system ... 92 Morse Code, 23 ;) ..--- ----- .---- ....- 90 Jelly, 47 integers, 519 bytes e BI$⁼# ⁾⁾⁾Ụ^/ ı***ıḞḞ 5 6 7 .:::: 9 EȮ< ⁻GṘ =pVV×DQV ~A~A~A~A~A~A~A~A~A~A~A~A~A ⁷ṾṾṾw ⁴ḟ€⁴Ṁ mmmmċ ṭṭṭṭṭṭṭṭḍḄḄḄḄḄḄḄḄḄ +Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ CNCNCNCNCNCNCNCNCNCNCNCNCNCNCNCNCNCNC ĖḌĖḌ ṫṣȦJṫȦ⁸ȦJ 22 “@ṃ» !ḤḤ! ³HH ØaM ;;;;;;;;;;;;;;;;;;;;;;;;;;;¬¬ḅ¬ irið8c ⁶ḲĠṂ°İṂĊ œṡ¹ẆẆTUṖṖṖṖP ȷ½RṪ LµdddddµFL 33 ...

88

72 45 characters in the code; Zero character codes This is far from the shortest answer posted, but no one has yet posted an answer that doesn't use character codes as a substitute for numbers, and doesn't call the system date. Using pure math (okay, and an automatic boolean conversion) in R, from the R console: x<-(T+T);x+floor(exp(pi)^x)*x*x-(x*x)^(...

88

GolfScript, score: way too much OK, how big a number can we print in a few chars of GolfScript? Let's start with the following code (thanks, Ben!), which prints 126: '~'( Next, let's repeat it 126 times, giving us a number equal to about 1.26126 × 10377: '~'(.`* (That's string repetition, not multiplication, so it should be OK under the rules.) ...

86

C, 327 chars #define O(O)-~O #define OO(o)O(O(o)) #define Oo(o)OO(OO(o)) #define oO(o)Oo(Oo(o)) #define oo(o)oO(oO(o)) #define O0 putchar main() { O0(OO(oO(!O0(~O(Oo(OO(-O0(~O(Oo(-O0(O(OO(O0(oo(oO(O0(O(oo(oO(OO(Oo(oo(oO( O0(oo(oo(!O0(O(OO(O0(O0(O(OO(Oo(O0(O(Oo(oo(oO(O0(oo(oo(oO(oo(oo(0)))))))) )))))))))))))))))))))))))))))))))))))); } Strangely,...

86

Pluso, 1 byte o Pluso Esolangs Page. Pluso contains a single accumulator, that starts with the value 1. It uses two commands, p which increments the accumulator (mod 27), and o which prints the current value as an uppercase ASCII character, A-Z or space (where 1-26 represents A-Z respectively, and 0 represents space). As the accumulator starts at 1, the ...

85

Scala REPL 34 29 characters. +"Happy new year to you!".sum Well ok if you really want it golfed with any chars, you can use: '@'*' '-'"' or "{yz}"map(_-'I'toChar) which have 11 and 22 chars respectively.

82

Python - 16 or any other language with eval. exec"print 1;"*9

80

CSharp I've expanded the code into a more readable fashion as this is no longer code golf and added an increment counter so that people can actually see that this program does something. class P{ static int x=0; ~P(){ System.Console.WriteLine(++x); new P(); } static void Main(){ new P(); } } (Don't do this ever ...

77

JavaScript (ES6) 164 B='teen-hundreds were a time',alert(B.replace(/./g, "The eigh"+B+" for rum.\nThe nine"+B+" for fun.\nThe two-thousands are a time to run\na civilized classroom.\n")) Test In FireFox/FireBug console.

77

Haskell, 4 chars ()=; With ()= we are able to define S, K and I. The definitions must be separated by either ; or a NL. We define (==) as S (the second line shows a more readable version): ((=====)==(======))(=======)=(=====)(=======)((======)(=======)) ( a == b ) c = a c ( b c ) (===) as K: (=====)===(======)=(====...

Only top voted, non community-wiki answers of a minimum length are eligible