Chuck Norris vs Travelling Salesman
CJam, L = 1482, N = 114, score 0.114
'C:L"arbon" L'h+:L;"Gold"L'u+:L;"Iron"L'c+:L;"Lead"L'k+:L;"Neon"LS+:L;"Argon"L'N+:L"ickel"L'o+:L;"Zinc""Coppe"L'r+:L"Silve"L'r+:LL'i+:L;"Tin" "Boron" "Radon" "Barium" "Cerium" "Cesium" "Cobalt" "Curium" "Erbium" "Helium" "Indium" "Iodine" "Osmium" "Oxygen" "Radium" "Sodium" "Sulfur" "Arsenic" "Bismuth" "Bohrium" "Bromine" "Cadmium" "Calcium" "Dubnium" "Fermium" "Gallium" "Hafnium" "Hassium" "Holmium" "Iridium" "Krypton" "Lithium" "Mercury" "Niobium" "Rhenium" "Rhodium" "Silicon" "Terbium" "Thorium" "Thulium" "Uranium" "Yttrium" "Actinium" "Aluminum" "Antimony" "Astatine" "Chlorine" "Chromium" "Europium" "Fluorine" "Francium" "Hydrogen" "Lutetium" "Nihonium" "Nitrogen" "Nobelium" "Platinum" "Polonium" "Rubidium" "Samarium" "Scandium" "Selenium" "Tantalum" "Thallium" "Titanium" "Tungsten" "Vanadium" "Americium" "Berkelium" "Beryllium" "Flerovium" "Germanium" "Lanthanum" "Magnesium" "Manganese" "Moscovium" "Neodymium" "Neptunium" "Oganesson" "Palladium" "Plutonium" "Potassium" "Ruthenium" "Strontium" "Tellurium" "Ytterbium" "Zirconium" "Dysprosium" "Gadolinium" "Lawrencium" "Meitnerium" "Molybdenum" "Phosphorus" "Promethium" "Seaborgium" "Technetium" "Tennessine" "Californium""Copernicium""Einsteinium""Livermorium""Mendelevium""Roentgenium"]L's+"Xenon"?
Try it online!
Each program is 13 bytes long. Here they are split up into individual lines:
'C:L"arbon"
L'h+:L;"Gold"
L'u+:L;"Iron"
L'c+:L;"Lead"
L'k+:L;"Neon"
LS+:L;"Argon"
L'N+:L"ickel"
L'o+:L;"Zinc"
"Coppe"L'r+:L
"Silve"L'r+:L
L'i+:L;"Tin"
"Boron"
"Radon"
"Barium"
"Cerium"
"Cesium"
"Cobalt"
"Curium"
"Erbium"
"Helium"
"Indium"
"Iodine"
"Osmium"
"Oxygen"
"Radium"
"Sodium"
"Sulfur"
"Arsenic"
"Bismuth"
"Bohrium"
"Bromine"
"Cadmium"
"Calcium"
"Dubnium"
"Fermium"
"Gallium"
"Hafnium"
"Hassium"
"Holmium"
"Iridium"
"Krypton"
"Lithium"
"Mercury"
"Niobium"
"Rhenium"
"Rhodium"
"Silicon"
"Terbium"
"Thorium"
"Thulium"
"Uranium"
"Yttrium"
"Actinium"
"Aluminum"
"Antimony"
"Astatine"
"Chlorine"
"Chromium"
"Europium"
"Fluorine"
"Francium"
"Hydrogen"
"Lutetium"
"Nihonium"
"Nitrogen"
"Nobelium"
"Platinum"
"Polonium"
"Rubidium"
"Samarium"
"Scandium"
"Selenium"
"Tantalum"
"Thallium"
"Titanium"
"Tungsten"
"Vanadium"
"Americium"
"Berkelium"
"Beryllium"
"Flerovium"
"Germanium"
"Lanthanum"
"Magnesium"
"Manganese"
"Moscovium"
"Neodymium"
"Neptunium"
"Oganesson"
"Palladium"
"Plutonium"
"Potassium"
"Ruthenium"
"Strontium"
"Tellurium"
"Ytterbium"
"Zirconium"
"Dysprosium"
"Gadolinium"
"Lawrencium"
"Meitnerium"
"Molybdenum"
"Phosphorus"
"Promethium"
"Seaborgium"
"Technetium"
"Tennessine"
"Californium"
"Copernicium"
"Einsteinium"
"Livermorium"
"Mendelevium"
"Roentgenium"
]L's+"Xenon"?
The missing elements are Darmstadtium, Praseodymium, Protactinium and Rutherfordium which are 12 or 13 characters long which means I can't print them in 13 characters each.
The idea is that the first few programs, which prints the elements with short names use their extraneous characters to build the string Chuck Norri
in the variable L
, which does not affect the output when used on their own. The final program then checks if anything is already on the stack, and uses it to choose between L
(plus s
) and Xenon
.
A few additional bytes are saved by using the character we just added to L
as part of the element name, specifically for C
arbon, N
ickel, Copper
and Silver
.
Python, L = 2596, N = 118, Score = 0.186
The length of each slice is 22 so that makes this pretty lengthy.
lambda:"Gold"; print"""";print "Carbon "print "Thorium "print "Curium "print "Calcium "print "Nickel "print "Zinc "print "Neon "print "Boron "print "Iron "print "Cerium "print "Barium "print "Caesium """[9::22];lambda:"Tin"[0];lambda:"Lead "#print"Argon "print"Radon "print"Xenon "print"Erbium "print"Cobalt "print"Copper "print"Helium "print"Indium "print"Iodine "print"Osmium "print"Oxygen "print"Radium "print"Silver "print"Sodium "print"Sulfur "print"Arsenic "print"Bismuth "print"Bohrium "print"Bromine "print"Cadmium "print"Dubnium "print"Fermium "print"Gallium "print"Hafnium "print"Hassium "print"Holmium "print"Iridium "print"Krypton "print"Lithium "print"Mercury "print"Niobium "print"Rhenium "print"Rhodium "print"Silicon "print"Terbium "print"Thulium "print"Uranium "print"Yttrium "print"Actinium "print"Antimony "print"Astatine "print"Chlorine "print"Chromium "print"Europium "print"Fluorine "print"Francium "print"Hydrogen "print"Lutetium "print"Nitrogen "print"Nobelium "print"Platinum "print"Polonium "print"Rubidium "print"Samarium "print"Scandium "print"Selenium "print"Tantalum "print"Thallium "print"Titanium "print"Tungsten "print"Vanadium "print"Nihonium "print"Aluminium "print"Americium "print"Berkelium "print"Beryllium "print"Flerovium "print"Germanium "print"Lanthanum "print"Magnesium "print"Manganese "print"Neodymium "print"Neptunium "print"Palladium "print"Plutonium "print"Potassium "print"Ruthenium "print"Strontium "print"Tellurium "print"Ytterbium "print"Zirconium "print"Moscovium "print"Oganesson "print"Dysprosium "print"Gadolinium "print"Lawrencium "print"Meitnerium "print"Molybdenum "print"Phosphorus "print"Promethium "print"Seaborgium "print"Technetium "print"Tennessine "print"Californium "print"Copernicium "print"Einsteinium "print"Livermorium "print"Mendelevium "print"Roentgenium "print"Darmstadtium "print"Praseodymium "print"Protactinium "print"Rutherfordium "
Here is the Salesman after the slicing and dicing:
lambda:"Gold"; print"" # <-- This is a function
"";print "Carbon "
print "Thorium "
print "Curium "
print "Calcium "
print "Nickel "
print "Zinc "
print "Neon "
print "Boron "
print "Iron "
print "Cerium "
print "Barium "
print "Caesium "
""[9::22];lambda:"Tin" # <-- This is a function and the choke point
[0];lambda:"Lead "# # <-- This is a function
print"Argon "
print"Radon "
print"Xenon "
print"Erbium "
print"Cobalt "
print"Copper "
print"Helium "
print"Indium "
print"Iodine "
print"Osmium "
print"Oxygen "
print"Radium "
print"Silver "
print"Sodium "
print"Sulfur "
print"Arsenic "
print"Bismuth "
print"Bohrium "
print"Bromine "
print"Cadmium "
print"Dubnium "
print"Fermium "
print"Gallium "
print"Hafnium "
print"Hassium "
print"Holmium "
print"Iridium "
print"Krypton "
print"Lithium "
print"Mercury "
print"Niobium "
print"Rhenium "
print"Rhodium "
print"Silicon "
print"Terbium "
print"Thulium "
print"Uranium "
print"Yttrium "
print"Actinium "
print"Antimony "
print"Astatine "
print"Chlorine "
print"Chromium "
print"Europium "
print"Fluorine "
print"Francium "
print"Hydrogen "
print"Lutetium "
print"Nitrogen "
print"Nobelium "
print"Platinum "
print"Polonium "
print"Rubidium "
print"Samarium "
print"Scandium "
print"Selenium "
print"Tantalum "
print"Thallium "
print"Titanium "
print"Tungsten "
print"Vanadium "
print"Nihonium "
print"Aluminium "
print"Americium "
print"Berkelium "
print"Beryllium "
print"Flerovium "
print"Germanium "
print"Lanthanum "
print"Magnesium "
print"Manganese "
print"Neodymium "
print"Neptunium "
print"Palladium "
print"Plutonium "
print"Potassium "
print"Ruthenium "
print"Strontium "
print"Tellurium "
print"Ytterbium "
print"Zirconium "
print"Moscovium "
print"Oganesson "
print"Dysprosium "
print"Gadolinium "
print"Lawrencium "
print"Meitnerium "
print"Molybdenum "
print"Phosphorus "
print"Promethium "
print"Seaborgium "
print"Technetium "
print"Tennessine "
print"Californium "
print"Copernicium "
print"Einsteinium "
print"Livermorium "
print"Mendelevium "
print"Roentgenium "
print"Darmstadtium "
print"Praseodymium "
print"Protactinium "
print"Rutherfordium "
Update
- [16-09-08] Sublime added an extra space when joining to a line that ends in a comment character
- [16-09-08] Made each slice 22 characters long and added gif