103
28
One nice property of a Turing-complete language is that it can be used to write any program, up to and including the simulation of the entire Universe.
Your job is to do exactly that: write a program which simulates the Universe.
Note: although I don't doubt you'll be able to accomplish this task, nowadays I don't have enough spare time to verify whether all 1090 of the particles in your simulation do what they really should do. Therefore, solely to simplify testing and evaluation, it is enough if your universe simulator only works with a single starting particle. To keep things interesting, let's assume this particle is the recently discovered Higgs Boson.
Your universe starts with nothing but a single Higgs Boson of approximately 120 GeV in the middle of it. To not make the output too long, let's make this universe tick at only 10-25 seconds instead of its "usual clock rate" of 5.4×10−44 seconds..
This Higgs boson will decay sooner or later as it has a half-life of 1.6×10−22 seconds, so at every tick of the simulation, it has a 0.0433% chance of decaying. You can check here what it will decay into. To have a central and simplified requirement, I list the branching ratios you should use:
Running the simulation
At each tick of the simulation, the Higgs boson has a 0.0433% chance of decaying. If that happens, it will decay into the following particles, with the listed probabilities (you should use these names in the output):
- bottom quark + bottom antiquark (64.8%)
- 2 W bosons (14.1%)
- 2 gluons (8.82%)
- tau lepton + antitau lepton (7.04%)
- charm quark + charm antiquark (3.27%)
- 2 Z bosons (1.59%)
- 2 photons (0.223%)
- 1 Z boson + 1 photon (0.111%)
- muon + antimuon (0.0244%)
- top quark + top antiquark (0.0216%)
For a total of 100%.
Some of these particles will decay further.
W boson: half-life of 10-25 seconds, this means a 50% chance to decay at every tick into one of the following, with equal probabilities:
- positron + neutrino
- antimuon + neutrino
- antitau lepton + neutrino
Z boson: half-life of 10-25 seconds, this means a 50% chance to decay at every tick into one of the following:
- neutrino + antineutrino (20.6%)
- electron + positron (3.4%)
- muon + antimuon (3.4%)
- tau lepton + antitau lepton (3.4%)
- down quark + down antiquark (15.2%)
- strange quark + strange antiquark (15.2%)
- bottom quark + bottom antiquark (15.2%)
- up quark + up antiquark (11.8%)
- charm quark + charm antiquark (11.8%)
top quark: half-life of 5×10-25 seconds, this means a 12.95% chance to decay at every tick into the following, with equal probabilities:
- W boson + down quark
- W boson + strange quark
- W boson + bottom quark
Of course, the W boson will also soon decay...
The top antiquark behaves similarly to the top quark: it decay into a W boson and a d/s/b antiquark.
All other particles (so all except for the Z and W bosons and top quarks) have a half life many orders of magnitude longer, so to not clutter the output, they are all considered stable for our simulation.
As the universe is largely empty, all the particles will have enough space for themselves and will not interact with each other. Therefore all individual particles are independent from each other in every regard, including the probabilities of splitting.
Output:
Every tick of the simulation, you have to print the contents of the simulated universe into a new line. For example:
The universe contains 1 Higgs boson.
The universe contains 1 Higgs boson.
The universe contains 1 Higgs boson.
The universe contains 1 Higgs boson.
The universe contains 2 W bosons.
The universe contains 2 W bosons.
The universe contains 1 W boson, 1 positron and 1 neutrino.
The universe contains 1 positron, 1 antitau lepton and 2 neutrinos.
Simulation ended after 0.8 yoctoseconds.
The order of the particles in the line is not important. The formatting, however, must be exactly as in the example above, including punctuation and pluralization. If you simulate an entire (mini-) universe, it should look nice (And I wanted to eliminate the abusing of a not sufficiently strict output requirement)
Each line corresponds to 0.1 yoctoseconds, but you will be forgiven if it takes longer than that for your program to print the output.
The simulation ends when only "stable" particles remain.
Scoring
Standard code golf rules apply.
The random number generator can be pseudo-random, but you must seed it if the language doesn't seed it by default. The probability distribution of your RNG must be uniform.
- You will get a bonus -10% to the code size if the program takes an integer as an input, and starts with that many Higgs bosons.
Exception for Turing machine enthusiasts.
For those who dare to try their luck with an actual Turing machine or a similar language (like Brainfuck), their task is made easier by the following rule changes (only applicable if the language is a Brainfuck-derivative or otherwise a very simplified Turing-machine, incapable of assignment, lacking an ALU, and values on the tape can only be incremented and decremented by one):
- The particle names are simplified to d, s, b, t, u, c for the quarks, v for the neutrino, T for tau lepton, m for muon, g for gluon, p for photon, Z, W and H for the bosons, - for the electron and + for the positron. At each tick, an input with the value of 0 or 1 are provided from the standard input, indicated whether the first unstable particle in the list decays or not.
The example output will therefore become
H
H
H
H
W W
W W
W + n
+ !T n n
78Does Mathematica have a
SimulateUniverse
built-in function? – Digital Trauma – 2015-11-04T21:32:27.180@DigitalTrauma : you have to use the names of the particles, and the probabilities of decay as presented here. Just calling a built-in particle simulator, if your language happens to have one, is extremely unlikely to lead in these exact results. – vsz – 2015-11-04T21:36:49.047
Don't worry - it was a rhetorical question, written in jest :) – Digital Trauma – 2015-11-04T21:38:40.710
1Does anyone know how to add mathematical formulas? The usual $...$ -based system doesn't seem to work on this site. – vsz – 2015-11-04T21:48:46.147
1@vsz We don't have MathJax support on this site. Unfortunately there's no native way to add formulas. – Alex A. – 2015-11-04T21:49:11.770
14So... This universe doesn't have a big bang... - just a little bang? – Level River St – 2015-11-04T23:53:35.753
1“top quark: half-life of 5[ticks], this means a 10% chance to decay at every tick” A 10% chance of decay per tick means that, after 5 ticks, the chance of would be around 40%. A 12,95% chance per tick matches much better. – Édouard – 2015-11-05T00:32:23.320
@Édouard : You are right, I tried to simplify it too much, but lost too much accuracy in the process. As there are (as of yet) no answers, I corrected it with more accurate values. If an answer is soon posted with the old values, I will still accept it if it proves to be hard to change it. – vsz – 2015-11-05T04:26:28.613
3If a top quark decays, shouldn't a top antiquark decay too? I guess it doesn't matter, rules are rules. But physics is physics (and my particle physics isn't very good, but it seems odd.) – Level River St – 2015-11-05T07:22:29.157
@steveverrill : what does a top antiquark decay into? A W-boson and a down-type antiquark? I don't know of any antiparticle of the W boson. If a W-boson + a down-type antiquark are sufficient approximations, I would add them. – vsz – 2015-11-05T07:25:10.077
1I assume the intention is that the probability of each particle decaying is independent of every other particle. As it stands this is not explicit, however, and someone could take a single random number for all of them. – Alchymist – 2015-11-05T09:41:25.250
@Alchymist : I was assuming it was unambiguous, but now I made it more explicit, thanks for the comment. – vsz – 2015-11-05T10:10:50.120
1What about particle/antiparticle reactions? Why are we ignoring those? – SuperJedi224 – 2015-11-05T20:56:52.457
23Our whole universe might be a code golf challenge. – coredump – 2015-11-06T13:41:14.670
1Where are you, CJam and Pyth? – Blackhole – 2015-11-07T11:47:40.733
18I suppose I'd be best at this challenge... ;) – Beta Decay – 2015-11-08T10:35:39.707
3One of my goals with this challenge was to give mainstream languages a chance, because the most simple challenges are dominated by golfscript or similar languages which are good for one-liners but not that good for larger programs. I'm still curious whether anyone will try a golfing language, or try to golf in a mainstream language, because the existing solutions are not that much golfed. Golfer masterminds, who solve a mathematical formula or a string operation by a handful of characters and a crazy abuse of the stack, where are you now?? – vsz – 2015-11-08T14:21:52.970
At each tick, an input with the value of 0 or 1 are provided from the standard input, indicated whether the first unstable particle in the list decays or not.
Can you elaborate on this? – YoYoYonnY – 2016-01-28T00:04:08.7501FYI: I just (more or less) made the program in Scratch. – Florrie – 2016-01-28T00:38:03.337
does it matter, for the TM exception, the amount of spaces between particles, and leading spaces? Or newlines between lines of output? – Destructible Lemon – 2016-09-23T00:26:30.563
2@BetaDecay Haha. You bring me into existence I guess? xD – HyperNeutrino – 2017-07-20T02:26:44.477
2I tried to run a solution but my simulated universe started creating simulation of itself. DO NOT run for more than 4e17 seconds. – workoverflow – 2018-02-11T13:08:43.353
1This is [code-golf] right? Really wanna see some answers in real golfing languages lol. – Chromium – 2018-06-21T08:02:20.297
High level stuff. – Manoj Kumar – 2018-07-06T04:53:46.920
@LevelRiverSt No, this Universe has a little phhbwt http://dilbert.com/strip/1993-01-01
– seadoggie01 – 2018-07-06T16:52:38.317