19
1
Challenge
Given a quark composition of a particle as input, output the corresponding hadron's name.
Quarks will be represented by a capital letter and antiquarks by a lowercase letter.
The quarks may be in any order, not necessarily the order given below.
Built-in functions the access data about particles and/or quarks are disallowed.
The only quarks you will be given are U (up), u (antiup), D (down), d (antidown), S (strange), s (antistrange), C (charm), c (anticharm), B (bottom or beauty), b(antibottom or antibeauty).
List of Hadrons and their quark compositions
Note that although there are various other hadrons such as pentaquarks and glueballs etc., you only need to support the hadrons given in the following lists
Baryons (QQQ) and Antibaryons (qqq)
The names in brackets are alternative names for the particles. You may output either name.
Input - Output
UUU - delta++
uuu - antidelta++
UUD - delta+ (proton)
uud - antidelta+ (antiproton)
UDD - delta0 (neutron)
udd - antidelta0 (antineutron)
DDD - delta-
ddd - antidelta-
UUS - sigma+
uus - antisigma+
UDS - sigma0
uds - antisigma0
DDS - sigma-
dds - antisigma-
USS - xi0
uss - antixi0
DSS - xi-
dss - antixi-
SSS - omega-
sss - antiomega-
UUC - charmed sigma++
uuc - charmed antisigma++
UDC - charmed sigma+
udc - charmed antisigma+
DDC - charmed sigma0
ddc - charmed antisigma0
UUB - bottom sigma+
uub - bottom antisigma+
UDB - bottom sigma0
udb - bottom antisigma0
DDB - bottom sigma-
ddb - bottom antisigma-
USC - charmed xi+
usc - charmed antixi+
DSC - charmed xi0
dsc - charmed antixi0
UCC - double charmed xi++
ucc - double charmed antixi++
DCC - double charmed xi+
dcc - double charmed antixi+
USB - bottom xi0
usb - bottom antixi0
DSB - bottom xi-
dsb - bottom antixi-
UBB - double bottom xi0
ubb - double bottom antixi0
DBB - double bottom xi-
dbb - double bottom antixi-
UCB - charmed bottom xi+
ucb - charmed bottom antixi+
DCB - charmed bottom xi0
dcb - charmed bottom antixi0
SSC - charmed omega0
ssc - charmed antiomega0
SSB - bottom omega-
ssb - bottom antiomega-
SCC - double charmed omega+
scc - double charmed antiomega+
SCB - charmed bottom omega0
scb - charmed bottom antiomega0
SBB - double bottom omega-
sbb - double bottom antiomega-
CCB - double charmed bottom omega+
ccb - double charmed bottom antiomega+
CBB - charmed double bottom omega0
cbb - charmed double bottom antiomega0
CCC - triple charmed omega++
ccc - triple charmed antiomega++
BBB - triple bottom omega-
bbb - triple bottom antiomega-
Mesons (Qq)
Input - Output
Ud - pion+
Uu - pion0
Dd - pion0
Du - pion-
Us - kaon+
Ds - kaon0
Sd - antikaon0
Su - kaon-
Ss - phion0
Cd - D meson+
Dc - D meson-
Cu - D meson0
Uc - antiD meson0
Cs - strange D meson+
Sc - strange D meson-
Cc - psion0
Bu - B meson-
Ub - B meson+
Db - B meson0
Bd - antiB meson0
Sb - strange B meson0
Bs - strange antiB meson0
Bb - upsilon0
Winning
Shortest code in bytes wins.
11Built-in functions the access data about particles and/or quarks are disallowed. I'm looking at you, Mathematica. – Okx – 2017-05-14T14:42:59.547
So, this challenge is essentially to compress aa look up table? – Rohan Jhunjhunwala – 2017-05-14T15:32:10.257
@RohanJhunjhunwala there is actually quite a lot of logic behind the values albeit it takes time to find. – dzaima – 2017-05-14T15:35:33.430
3Mathematica does have a
ParticleData
function with aQuarkContent
option. – Ian Miller – 2017-05-14T15:36:30.683@dzaima what I meant was, there is a look up table which can be generated through a logical means, but the goal is to generate it with the shortest code. – Rohan Jhunjhunwala – 2017-05-14T15:39:47.387
1Doesn't look hard. I mean, each quark has its own electric charge, you only have to handle the name, not the charge. – Matthew Roh – 2017-05-14T17:39:12.213
1>
Cb
andBc
are missing. Is this intentional? 2. Ordering the letters differently would mean the same thing - must our program be able to handle different orders of letters, or will they always be ordered as shown? (i.e. will it always beUDS
for example or could it beSUD
orDSU
for example?) Similarly for mesons could we haveuD
?@LevelRiverSt
Cb
andBc
being missing are most likely an oversight. Since there's no ordering to the quarks in QCD, I'd expect that the quarks could be named in any order. However, clarification is needed from the author. – Mego – 2017-05-15T03:38:15.587@Level, "the quarks may be in any order, not necessarily the order given below." – Peter Taylor – 2017-05-15T05:22:14.843
There is no Top quark in your challenge, but it's too late to change. (Also its just bottom, not beauty or something. There is no such quark as a 'beauty quark'.) – Matthew Roh – 2017-05-15T07:41:29.197
@SIGSEGV 1. A top quark decays too quickly for it to interact via the strong force and form into hadrons. 2. The bottom quark at one point was called a beauty quark, as per Murray Gell-Mann's poetic naming of charm and beauty, but bottom was favoured by boring physicists – Beta Decay – 2017-05-15T08:57:14.507
@LevelRiverSt I couldn't find any mention of a
Cb
or aBc
meson anywhere, so I couldn't find a name for it – Beta Decay – 2017-05-15T08:58:26.857Read
name the hard-ons
... I'll go back to elementary school now._.
. – Magic Octopus Urn – 2017-05-16T19:54:48.480