diff --git a/html/CPV.html b/html/CPV.html index 056104c..a8403be 100644 --- a/html/CPV.html +++ b/html/CPV.html @@ -1,11 +1,10 @@

You discovered CP violation!

-
CP Symmetry
-

C (Charge) and P (Parity, which can be thought of as “handedness”) are discrete transformations that can be applied to a physical system.

-

If a theory is symmetric under C, then it works the same if all particles are exchanged with their antiparticles. -If it has P-symmetry, then it is invariant under inversion (“mirroring”) of all spatial coordinates.

- -

For a long time, physicists believed that all of physics is invariant under the combination CP of both symmetries. +

CP Symmetry

+

C (Charge) and P (Parity) are discrete transformations that can be applied to a physical system.

+

If a theory is symmetric under C, then it works the same if all particles are exchanged with their antiparticles. +If it has P-symmetry, then it is invariant under inversion ("mirroring") of all spatial coordinates

+

For a long time, physicists believed that all of physics is invariant under the combination CP of both symmetries. It turned out that this is wrong, as was discovered by Cronin, Fitch et al. in 1964 when they studied the decay of the neutral K meson.

diff --git a/index.html b/index.html index c2538ce..622423f 100644 --- a/index.html +++ b/index.html @@ -95,7 +95,7 @@

Research yields {{ r.reputation | niceNumber }} reputation.

- +
diff --git a/js/game.js b/js/game.js index a42cc86..13ff24a 100644 --- a/js/game.js +++ b/js/game.js @@ -62,7 +62,7 @@ }, 1000); }]); - app.controller('ResearchController', function() { + app.controller('ResearchController', ['$compile', function($compile) { this.research = research; this.doResearch = function(item) { var cost = item.research(); @@ -72,9 +72,19 @@ achievements.update('research', item.name, 1); UI.showUpdateValue("#update-data", -cost); UI.showUpdateValue("#update-reputation", item.reputation); + analytics.sendEvent( + analytics.events.categoryResearch, + analytics.events.actionResearch, + item.name, + item.level + ); } }; - }); + this.showInfo = function(r) { + UI.showModal(r.name, r.getInfo()); + UI.showLevels(r.level); + }; + }]); app.controller('HRController', function() { this.workers = workers; @@ -107,7 +117,8 @@ this.achievementsAll = achievements.list; }); - app.controller('SaveController', ['$scope', '$interval', function($scope, $interval) { + app.controller('SaveController', + ['$scope', '$interval', function($scope, $interval) { $scope.lastSaved = new Date(); $scope.saveNow = function() { GameObjects.saveAll(); @@ -115,7 +126,9 @@ achievements.lastSave = $scope.lastSaved.getTime(); }; $scope.restart = function() { - if (window.confirm('Do you really want to restart the game? All progress will be lost.')) { + if (window.confirm( + 'Do you really want to restart the game? All progress will be lost.' + )) { ObjectStorage.clear(); window.location.reload(true); } diff --git a/js/gameobjects.js b/js/gameobjects.js index 9c97b89..ea42e52 100644 --- a/js/gameobjects.js +++ b/js/gameobjects.js @@ -61,6 +61,7 @@ var GameObjects = (function() { */ var researchPrototype = { level: 0, + interesting: false, is_visible: function() { return this.level > 0 || lab.data >= this.cost * .7; }, @@ -70,7 +71,10 @@ var GameObjects = (function() { research: function() { if (lab.research(this.cost, this.reputation)) { this.level++; - analytics.sendEvent(analytics.events.categoryResearch, analytics.events.actionResearch, this.name, this.level); + if (this.info_levels.length > 0 && this.level === this.info_levels[0]) { + this.interesting = true; + this.info_levels.splice(0, 1); + } var oldCost = this.cost; this.cost = Math.round(this.cost * this.cost_increase); return oldCost; @@ -81,11 +85,9 @@ var GameObjects = (function() { if (!this._info) { this._info = Helpers.loadFile(this.info); } + this.interesting = false; return this._info; }, - showInfo: function() { - UI.showModal(this.name, this.getInfo()); - } }; var research = $.extend([], Helpers.loadFile('json/research.json'), ObjectStorage.load('research')); diff --git a/js/ui.js b/js/ui.js index 1166253..6553599 100644 --- a/js/ui.js +++ b/js/ui.js @@ -21,13 +21,26 @@ var UI = (function () { }); /** Show a bootstrap modal with dynamic content. */ - var showModal = function(title, text) { + var showModal = function(title, text, level) { var $modal = $('#infoBox'); $modal.find('#infoBoxLabel').html(title); $modal.find('.modal-body').html(text); $modal.modal({show: true}); }; + /** Display only the elements with data-min-level above a certain + * threshold. + */ + var showLevels = function(level) { + $('#infoBox').find('[data-min-level]').each(function() { + if (level >= $(this).data('min-level')) { + $(this).show(); + } else { + $(this).hide(); + } + }); + }; + var showUpdateValue = function(ident, num) { if (num != 0) { var formatted = Helpers.formatNumberPostfix(num); @@ -92,6 +105,7 @@ var UI = (function () { return { showModal: showModal, + showLevels: showLevels, showUpdateValue: showUpdateValue, validateVersion: validateVersion } diff --git a/json/research.json b/json/research.json index 0c78b77..8e441c6 100644 --- a/json/research.json +++ b/json/research.json @@ -6,7 +6,8 @@ "cost": 10, "cost_increase": 1.4, "image": "assets/icons/png/CPV.png", - "info": "html/CPV.html" + "info": "html/CPV.html", + "info_levels": [1, 5, 10, 25] }, { "name": "J/ψ", @@ -15,7 +16,8 @@ "cost": 100, "cost_increase": 1.45, "image": "assets/icons/png/Jpsi.png", - "info": "html/Jpsi.html" + "info": "html/Jpsi.html", + "info_levels": [1, 5, 10, 25] }, { "name": "τ lepton", @@ -24,7 +26,8 @@ "cost": 2000, "cost_increase": 1.5, "image": "assets/icons/png/tau.png", - "info": "html/tau.html" + "info": "html/tau.html", + "info_levels": [1, 5, 10, 25] }, { "name": "Beauty quark", @@ -33,7 +36,8 @@ "cost": 25000, "cost_increase": 1.55, "image": "assets/icons/png/b.png", - "info": "html/b.html" + "info": "html/b.html", + "info_levels": [1, 5, 10, 25] }, { "name": "W and Z boson", @@ -42,7 +46,8 @@ "cost": 50000, "cost_increase": 1.6, "image": "assets/icons/png/weak.png", - "info": "html/weak.html" + "info": "html/weak.html", + "info_levels": [1, 5, 10, 25] }, { "name": "Top quark", @@ -51,7 +56,8 @@ "cost": 2000000, "cost_increase": 2, "image": "assets/icons/png/t.png", - "info": "html/top.html" + "info": "html/top.html", + "info_levels": [1, 5, 10, 25] }, { "name": "Antihydrogen", @@ -60,7 +66,8 @@ "cost": 10000000, "cost_increase": 2.5, "image": "assets/icons/png/antihydrogen.png", - "info": "html/antihydrogen.html" + "info": "html/antihydrogen.html", + "info_levels": [1, 5, 10, 25] }, { "name": "B oscillations", @@ -69,7 +76,8 @@ "cost": 50000000, "cost_increase": 2.5, "image": "assets/icons/png/BBbar.png", - "info": "html/BBbar.html" + "info": "html/BBbar.html", + "info_levels": [1, 5, 10, 25] }, { "name": "Higgs boson", @@ -78,6 +86,7 @@ "cost": 72500000, "cost_increase": 3, "image": "assets/icons/png/H.png", - "info": "html/H.html" + "info": "html/H.html", + "info_levels": [1, 5, 10, 25] } ]