Now with BONUS for run-time placement.

Write a program to fill a text box with the identifiers used in your program while keeping your program small. With all the identifiers you have used (excluding those you created) in your program, fill a 12x6 box with as many as you can. You get extra points for identifiers that cross over (crossword style), but they can't join end to end.

Output

Your program should print (to stdout) a 12x6 character box with your packed identifiers and a # border. The box should have columns labeled with letter A-L and the rows 1-6 (spaced like the example below). Then print a line for each identifier used. Each line will have the location of the first letter, the identifier itself, and the score. The score is equal to the number of letters in the identifier with a possible '+bonus' added. The identifier gets a 5 point bonus for each letter shared with a crossing identifier. The final line reports 'TOTAL: ' and the sum of the identifier scores. An example output for a possible Python program would look like this:

   ABCDEFGHIJKL
##############
1 #  pinsert   #
2 #  o         #
3 #  print     #
4 #    not     #
5 #            #
6 #import      #
##############
C1 pop 3+5
D1 insert 6
C3 print 5+10
E3 in 2+10
E4 not 3+5
A6 import 6
TOTAL: 55


Notes:

• Identifiers can be unattached (like import above).
• You cannot join pop and print inline with poprint.
• The string in inside insert cannot be used. Joining words must be orthogonal.
• Identifiers can be placed next to each other (like pop and insert above).

Score

Your score for the challenge will the the puzzle score squared divided by the size of your source code (in bytes). Eg: The puzzle above with a 300 byte program would score 55*55/300 = 10.08. Highest score wins.

Rules

• You can use any identifier in your program that is not defined by you. Keywords, class names, method names, library names, and built-in function names are examples of eligible identifiers.
• EDITED: You may only use standard libraries that are included with the minimum language release. Extended language packages and the use of external libraries (are now) forbidden. The huge range of libraries with extensive lists of identifiers would unbalance this challenge. If you are unsure of how this works with your language, please leave a question in the comments.
• Identifiers must consist of [a-zA-Z_] characters only and have at least 2 characters.
• You may only use each identifier once in the puzzle.
• Identifiers can only be used left to right or downwards.

Dynamic Bonus!

If your code determines where to place identifiers at run time, the shared letter bonus will be 20 instead of 5. You may list which identifiers will used, but your code must decide where in the box to place them. Your code must also calculate and print the score list. If your placements depend on the ordering of the identifier list, hard-coded pairings, or other non-dynamic placement short-cuts, you are not eligible for the Dynamic Bonus.

In the example output above, the puzzle score for a run-time placement program would become 145. Then if the code was 800 bytes, the score would be 145*145/800 = 26.28.

The Dynamic Bonus is designed to reward clever algorithms instead of static hard-coded solution strings, and compensate for the larger resulting source code size.

EDITS:

• Changed libraries used to only those in the minimum language release.
• Added the dynamic bonus option.
• Just to be clear, greater score is better, right? Feb 8, 2015 at 6:01
• Correct. Jam as many unique identifiers into the box while keeping your program as small as possible -> best score. Feb 8, 2015 at 6:21
• Does this challenge actually involve programming? Feb 8, 2015 at 7:58
• Perhaps I should make this more clear. You must write and execute a program that outputs the text requirement. The text in the output depends on the identifiers used in the program you write. Feb 8, 2015 at 8:03
• FYI, some libraries involving SIMD or Shader defines all combinations of xyzw / rgba / stpq :) Feb 8, 2015 at 10:27

Python, 1342 / 349 = 50.02

If I have understood the rules correctly, this should be a valid submission.

from sys import *
stdout.write("""   ABCDEFGHIJKL
##############
1 #from   f  i #
2 #  r   not t #
3 #      write #
4 #  s   import#
5 #  y   False #
6 #  stdout    #
##############
A1 from 4+5
C1 or 2+5
H1 format 6+25
K1 iter 4+10
G2 not 3+5
G3 write 5+10
C4 sys 3+5
G4 import 6+10
G5 False 5+5
C6 stdout 6+10
TOTAL 134
""".format(not False or iter([])))


You can really just keep incrementing your score by adding more identifiers: the size of the program increases linearly (by approx. twice the identifier length), while the score increases approximately by the square of the identifier length. Then the challenge becomes more how to cram most keywords into the square instead of how to write a short program to do it.

• Your answer looks valid. I had planned to motivate programmers to write a dynamic solver with some level of introspection, but I expect this embed-the-answer-in-a-string approach will be easier. Sigh. Feb 9, 2015 at 5:26
• Your point that the challenge is more puzzle than programming is well taken. I have added a bonus for answers that use run-time placement in their programs. The string printing style is still valid, but I hope to see more programming solutions that make use of the bonus. Thanks for your answer and insights +1. Feb 9, 2015 at 6:52
• Maybe I'm just missing something, but why stdout.write rather than print, and what's with the format(not False or iter([])) at the end? You could also easily add as "is" next to the "sys" and a "for" below "from"... Feb 10, 2015 at 15:52
• @aquavitae You can only use identifiers that are used in your program in valid syntax, so Frxstrem is including the identifiers that will be used in the puzzle. The program does not have to make sense or be efficient. Feb 11, 2015 at 3:29
• Ah, sorry, apparently I didn't read the problem properly. In that case you could change the format to read iter([i for i in [not False is sys]]) Feb 11, 2015 at 4:21

STATA, 387^2 / 677 = 221.2

I got lazy and just wanted to output something that works before trying to get it with optimal score. I'll probably update it later as I fit more words in, and I'm open to suggestions from anyone that uses STATA (which doesn't seem very popular on CodeGolf). STATA is really good about having a lot of two letter commands/parameters. Also, usually most can be shortened to save characters/fit better (i.e. display can be display, displa, displ, disp, dis, or di). Also, the capture means that it suppresses output and error messages. So the entire while loop has 0 output.

cap infile using a,us(b)
cap while _rc>0{
ls
cap ge c=1 if 0<1
so c
egen d=rownonmiss(c),str
regres c d
notes
clist,noh no
li,compress
dec c,g(f)
do a
}
gl e=";;;ABCDEFGHIJKL ;;############## 1;#rownonmissdo# 2;#e;hd;o;notes# 3;#geii;hif_rc;# 4;#r;ls;clist;;# 5;#egen;ailu;;;# 6;#slcompress;;# ;;############## A1;rownonmiss;10+30 K1;do;2+5 H2;notes;5+20 A3;ge;2+5 G3;if;2+5 I3;_rc;3+15 C4;ls;2+10 F4;clist;5+20 A5;egen;4+20 C6;compress;8+20 A1;regres;6+15 C1;while;5+15 F1;noh;3+5 H1;infile;6+25 I1;so;2+10 J1;str;3+15 K1;dec;3+15 D2;dis;3+5 I3;_s;2+10 F4;cap;3+10 G4;li;2+5 B5;gl;2+5 D5;no;2+10 I5;us;2+5 TOTAL:;387"
token $e forv x=1/34{ dis subinstr(x'',";"," ",.)_s(0) }  generates  ABCDEFGHIJKL ############## 1 #rownonmissdo# 2 #e hd o notes# 3 #geii hif_rc # 4 #r ls clist # 5 #egen ailu # 6 #slcompress # ############## A1 rownonmiss 10+30 K1 do 2+5 H2 notes 5+20 A3 ge 2+5 G3 if 2+5 I3 _rc 3+15 C4 ls 2+10 F4 clist 5+20 A5 egen 4+20 C6 compress 8+20 A1 regres 6+15 C1 while 5+15 F1 noh 3+5 H1 infile 6+25 I1 so 2+10 J1 str 3+15 K1 dec 3+15 D2 dis 3+5 I3 _s 2+10 F4 cap 3+10 G4 li 2+5 B5 gl 2+5 D5 no 2+10 I5 us 2+5 TOTAL: 387  • This answer looks valid. Currently the leader. Feb 10, 2015 at 15:42 Perl, 7282 / 639 = 829.4 Oh well, this is not valid, missed that I have to have the identifiers in my code. #!perl -l use B::Keywords'@Symbols','@Barewords'; use List::Util shuffle; srand 45502; @b=@a=shuffle map{push@{+length},$_;$_}grep/^[a-z]{2,}$/,@Symbols,@Barewords;
$z=$"x12 .$/;$z x=6;
$s=length,$z=~s/ {$s}/$_/&&($_=0)for@a;$_=$z;$"='|';
sub f{join'',/(.)(?=@_.*(\n))/sg}$_=f".{12}(.)"x5; s/@a/$v=length$&;$tot+=$v*21;$r.=(map{m!.!;map{$&.$_}1..7}A..L)[@-]." $&$v+".($v*20)."\n";uc$&/ge;
$_=f".{6}(.)"x11; s/@b/$v=length$&;$b=$&=~y!A-Z!!;$tot+=$v+$b*20;$c=lc$&;$r.=(map{m!.!;map{$_.$&}A..M}1..6)[@-]."$c $v+".($b*20)."\n";uc$&/ige;$_=$z; s/ /# /mg; s/^/++$l.' #'/mge;
print'   ',A..L,'
','#'x14,'
',$_,' ','#'x14,"${r}TOTAL: \$tot"


This requires a perl reflection module (B::Keywords). Can be installed on ubuntu with sudo apt-get install libb-keywords-perl. With the seed given in the code above it generates the 728 answer:

   ABCDEFGHIJKL
##############
1 #dumplogforqr#
2 #lcfirstbreak#
3 #socketshmctl#
4 #requiregiven#
5 #lengthgmtime#
6 #getserventdo#
##############
B1 uc 2+40
C2 fc 2+40
F3 tr 2+40
G1 gt 2+40
I1 or 2+40
J1 recv 4+80
L4 ne 2+40
A1 dump 4+20
E1 log 3+20
H1 for 3+40
K1 qr 2+0
A2 lcfirst 7+60
H2 break 5+40
A3 socket 6+40
G3 shmctl 6+20
A4 require 7+20
H4 given 5+40
A5 length 6+0
G5 gmtime 6+20
A6 getservent 10+0
K6 do 2+0
TOTAL: 728


Note that different versions of perl may have different RNG and different keyword list, but it should be easy to find a seed with a comparable result.

• You have spotted one of the problems - identifiers must occur at least once in your code. There is another problem. You should not use libraries that are not provided in the basic language package. This is a necessary rule to stop the use of libraries that would provide unfair advantages in this challenge. I hope you can change your approach and create a good Perl answer for the challenge. Feb 9, 2015 at 15:00