From fce53857bac38e304c7b6e649b0dddb91b717ce6 Mon Sep 17 00:00:00 2001 From: Minh Date: Thu, 15 Aug 2024 12:19:25 +0900 Subject: [PATCH 1/7] Changed pub mult display --- theory.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/theory.js b/theory.js index 12c6cca..ea2350f 100644 --- a/theory.js +++ b/theory.js @@ -165,12 +165,13 @@ const permaCosts = BigNumber.from('1e1000') ]; +const pubPower = 0.2102; const tauRate = 0.4; -const pubExp = 0.2102 / tauRate; +const pubExp = pubPower / tauRate; const pubMult = BigNumber.TWO; var getPublicationMultiplier = (tau) => tau.pow(pubExp) * pubMult; var getPublicationMultiplierFormula = (symbol) => -`${pubMult.toString(0)}\\times{${symbol}}^{${pubExp}}`; +`${pubMult.toString(0)}\\times{${symbol}}^{${pubPower}\\times${1 / tauRate}}`; const milestoneCost = new CustomCost((level) => { From ed305345696d919fab693451ef04894558c0c4aa Mon Sep 17 00:00:00 2001 From: Minh Date: Thu, 15 Aug 2024 12:25:49 +0900 Subject: [PATCH 2/7] Moved bhz calculations to foundZero block --- theory.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/theory.js b/theory.js index ea2350f..0423a1c 100644 --- a/theory.js +++ b/theory.js @@ -1248,8 +1248,17 @@ var tick = (elapsedTime, multiplier) => searchingRewind = false; if(Math.abs(bhdt) < 1e-9) { - foundZero = true; + foundZero = true; // log(`found zero, bhdt = ${bhdt.toExponential(2)}`); + + // Calculate bhzTerm + zResult = zeta(t); + let tmpZ = zeta(t + 1 / derivRes); + let dr = tmpZ[0] - zResult[0]; + let di = tmpZ[1] - zResult[1]; + bhdTerm = BigNumber.from(Math.sqrt(dr*dr + di*di) * + derivRes); + bhzTerm = BigNumber.from(zResult[2]).abs(); } } } @@ -1261,15 +1270,6 @@ var tick = (elapsedTime, multiplier) => } else { - if(!bhzTerm || !bhdTerm) - { - zResult = zeta(t); - let tmpZ = zeta(t + 1 / derivRes); - let dr = tmpZ[0] - zResult[0]; - let di = tmpZ[1] - zResult[1]; - bhdTerm = BigNumber.from(Math.sqrt(dr*dr + di*di) * derivRes); - bhzTerm = BigNumber.from(zResult[2]).abs(); - } derivCurrency.value += bhdTerm.pow(bTerm) * w1Term * w2Term * w3Term * bonus; normCurrency.value += tTerm * c1Term * c2Term * w1Term * bonus / From 6fa4a01e9f9320cbc024892cbe59d69941ff0398 Mon Sep 17 00:00:00 2001 From: Minh Date: Thu, 15 Aug 2024 18:43:30 +0900 Subject: [PATCH 3/7] Added save t button to BH menu --- theory.js | 74 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/theory.js b/theory.js index 0423a1c..7164b29 100644 --- a/theory.js +++ b/theory.js @@ -8,6 +8,7 @@ import { ui } from '../api/ui/UI'; import { Color } from '../api/ui/properties/Color'; import { LayoutOptions } from '../api/ui/properties/LayoutOptions'; import { TextAlignment } from '../api/ui/properties/TextAlignment'; +import { Thickness } from '../api/ui/properties/Thickness'; var id = 'riemann_zeta_f'; var getName = (language) => @@ -79,9 +80,9 @@ var authors = 'propfeds, Eylanding\n' + 'Omega_3301 & pacowoc - 繁體中文\n' + 'Jooo & Warzen User - Español\n' + 'propfeds - Tiếng Việt'; -var version = 0.5; +var version = 0.51; -const versionName = 'v0.5'; +const versionName = 'v0.5.1'; let pubTime = 0; @@ -200,6 +201,7 @@ const locStrings = menuBlackhole: 'Black Hole Settings', blackholeThreshold: 'Unleash black hole at: ', blackholeCopyt: 'Take current t', + save: 'Save', rotationLock: [ 'Unlock graph', @@ -302,6 +304,7 @@ const locStrings = menuBlackhole: 'Cài đặt hố đen', blackholeThreshold: 'Giải phóng hố đen tại: ', blackholeCopyt: 'Lấy t hiện tại', + save: 'Lưu', rotationLock: [ 'Mở khoá đồ thị', @@ -893,8 +896,8 @@ let createHesitantSwitch = (params, callback, isToggled) => } const bhImage = game.settings.theme == Theme.LIGHT ? -ImageSource.fromUri('https://raw.githubusercontent.com/propfeds/riemann-zeta/black-hole-automation/icons/dark/black-hole-bolas.png') : -ImageSource.fromUri('https://raw.githubusercontent.com/propfeds/riemann-zeta/black-hole-automation/icons/light/black-hole-bolas.png'); +ImageSource.fromUri('https://raw.githubusercontent.com/propfeds/riemann-zeta/main/icons/dark/black-hole-bolas.png') : +ImageSource.fromUri('https://raw.githubusercontent.com/propfeds/riemann-zeta/main/icons/light/black-hole-bolas.png'); // const mainMenuLabel = ui.createLatexLabel // ({ // row: 0, column: 1, @@ -1157,7 +1160,7 @@ var init = () => foundZero = false; bhzTerm = null; bhdTerm = null; - if(lastZero >= 14) + if(lastZero >= 14 && lastZero > t - 10) t = lastZero; } blackholeMs.refunded = (_) => @@ -1325,9 +1328,11 @@ var getEquationOverlay = () => let createBlackholeMenu = () => { + let tmpThreshold = tClipThreshold; + let clippingSwitch = createHesitantSwitch ({ - row: 0, column: 1, + row: 0, column: 2, horizontalOptions: LayoutOptions.END }, () => { @@ -1344,7 +1349,7 @@ let createBlackholeMenu = () => let thresholdEntry = ui.createEntry ({ row: 0, column: 1, - text: tClipThreshold.toString(), + text: tmpThreshold.toString(), fontSize: 14, keyboard: Keyboard.NUMERIC, horizontalTextAlignment: TextAlignment.END, @@ -1352,25 +1357,35 @@ let createBlackholeMenu = () => { if(!actuallyEditing) return; - let tmpML = parseFloat(nt) ?? tClipThreshold; + let tmpML = parseFloat(nt) ?? tmpThreshold; if(isNaN(tmpML)) - tmpML = tClipThreshold; - tClipThreshold = tmpML; + tmpML = tmpThreshold; + tmpThreshold = tmpML; } }); let copytBtn = ui.createButton ({ - row: 0, column: 2, + row: 0, column: 0, text: getLoc('blackholeCopyt'), onClicked: () => { Sound.playClick(); actuallyEditing = false; - tClipThreshold = t; - thresholdEntry.text = tClipThreshold.toString(); + tmpThreshold = t; + thresholdEntry.text = tmpThreshold.toString(); actuallyEditing = true; } }) + let saveBtn = ui.createButton + ({ + row: 0, column: 1, + text: getLoc('save'), + onClicked: () => + { + Sound.playClick(); + tClipThreshold = tmpThreshold; + } + }) actuallyEditing = true; @@ -1382,37 +1397,42 @@ let createBlackholeMenu = () => ({ children: [ + ui.createLatexLabel + ({ + margin: new Thickness(0, 0, 0, 6), + text: getLoc('blackholeThreshold'), + verticalTextAlignment: TextAlignment.CENTER + }), ui.createGrid ({ - heightRequest: getImageSize(ui.screenWidth), - columnDefinitions: ['1*', 'auto'], + columnDefinitions: ['auto', '1*', 'auto'], children: [ ui.createLatexLabel ({ row: 0, column: 0, - text: getLoc('blackholeThreshold'), + margin: new Thickness(0, 0, 6, 0), + text: '\$t\\ge\$', + horizontalTextAlignment: TextAlignment.START, verticalTextAlignment: TextAlignment.CENTER }), + thresholdEntry, clippingSwitch ] }), + ui.createBox + ({ + heightRequest: 1, + margin: new Thickness(0, 6) + }), ui.createGrid ({ - columnDefinitions: ['auto', '1*', '1*'], children: [ - ui.createLatexLabel - ({ - text: '\$t\\ge\$', - row: 0, column: 0, - horizontalTextAlignment: TextAlignment.START, - verticalTextAlignment: TextAlignment.CENTER - }), - thresholdEntry, - copytBtn + copytBtn, + saveBtn ] - }), + }) ] }) }); From 3c4ee6aab38a85244771b91483dcb1e86e019692 Mon Sep 17 00:00:00 2001 From: Minh Date: Thu, 15 Aug 2024 18:47:19 +0900 Subject: [PATCH 4/7] Increased threshold font size --- theory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theory.js b/theory.js index 7164b29..7e43d34 100644 --- a/theory.js +++ b/theory.js @@ -1350,7 +1350,7 @@ let createBlackholeMenu = () => ({ row: 0, column: 1, text: tmpThreshold.toString(), - fontSize: 14, + // fontSize: 14, keyboard: Keyboard.NUMERIC, horizontalTextAlignment: TextAlignment.END, onTextChanged: (ot, nt) => From 14121094380ef40cae6da286b6b5c796964c1613 Mon Sep 17 00:00:00 2001 From: Minh Date: Thu, 15 Aug 2024 18:53:22 +0900 Subject: [PATCH 5/7] Made the pub mult formula even fancier --- theory.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/theory.js b/theory.js index 7e43d34..c3287ef 100644 --- a/theory.js +++ b/theory.js @@ -1,14 +1,9 @@ import { BigNumber } from '../api/BigNumber'; -import { ConstantCost, CustomCost, ExponentialCost, FirstFreeCost, FreeCost, StepwiseCost } from '../api/Costs'; +import { ConstantCost, ExponentialCost, FirstFreeCost, StepwiseCost } from '../api/Costs'; import { Localization } from '../api/Localization'; import { QuaternaryEntry, theory } from '../api/Theory'; import { Utils } from '../api/Utils'; import { Vector3 } from '../api/Vector3'; -import { ui } from '../api/ui/UI'; -import { Color } from '../api/ui/properties/Color'; -import { LayoutOptions } from '../api/ui/properties/LayoutOptions'; -import { TextAlignment } from '../api/ui/properties/TextAlignment'; -import { Thickness } from '../api/ui/properties/Thickness'; var id = 'riemann_zeta_f'; var getName = (language) => @@ -172,7 +167,8 @@ const pubExp = pubPower / tauRate; const pubMult = BigNumber.TWO; var getPublicationMultiplier = (tau) => tau.pow(pubExp) * pubMult; var getPublicationMultiplierFormula = (symbol) => -`${pubMult.toString(0)}\\times{${symbol}}^{${pubPower}\\times${1 / tauRate}}`; +`${pubMult.toString(0)}\\times{${symbol}}^{{${pubPower * 100}}/ +{${100 * tauRate}}}`; const milestoneCost = new CustomCost((level) => { From 2a6a2312b238cd909f42cf54e1fa9df5a6c0b5cd Mon Sep 17 00:00:00 2001 From: Minh Date: Sat, 17 Aug 2024 13:26:16 +0900 Subject: [PATCH 6/7] Added zh & es translations (15~16 Aug) --- theory.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/theory.js b/theory.js index c3287ef..a50bfde 100644 --- a/theory.js +++ b/theory.js @@ -224,6 +224,7 @@ const locStrings = menuBlackhole: '黑洞设置', blackholeThreshold: '释放黑洞的条件:', blackholeCopyt: '使用现在的 t 值', + save: '保存', rotationLock: [ '解锁图形', @@ -248,6 +249,7 @@ const locStrings = menuBlackhole: '黑洞設定', blackholeThreshold: '釋放黑洞的條件:', blackholeCopyt: '利用現在的 t 值', + save: '儲存', rotationLock: [ '解鎖圖形', @@ -272,6 +274,7 @@ const locStrings = menuBlackhole: 'Configuraciones del Agujero Negro', blackholeThreshold: 'Desata el Agujero Negro en: ', blackholeCopyt: 'Usar t actual', + save: 'Guardar', rotationLock: [ 'Desbloquear gráfica', From 02f61bba37b3733857628ab149cbad82709b1c92 Mon Sep 17 00:00:00 2001 From: Minh Date: Sat, 17 Aug 2024 13:34:38 +0900 Subject: [PATCH 7/7] Made 1/derivRes a const --- theory.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/theory.js b/theory.js index a50bfde..0a5c764 100644 --- a/theory.js +++ b/theory.js @@ -110,6 +110,7 @@ const scale = 4; // All balance parameters are aggregated for ease of access const derivRes = 100000; +const derivResInv = 1 / derivRes; const resolution = 1/4; // const getBlackholeSpeed = (z) => Math.min(z**2 + 0.004, resolution); @@ -1226,7 +1227,7 @@ var tick = (elapsedTime, multiplier) => if(derivMs.level) { - let tmpZ = zeta(t + 1 / derivRes); + let tmpZ = zeta(t + derivResInv); let dr = tmpZ[0] - zResult[0]; let di = tmpZ[1] - zResult[1]; dTerm = BigNumber.from(Math.sqrt(dr*dr + di*di) * derivRes); @@ -1255,7 +1256,7 @@ var tick = (elapsedTime, multiplier) => // Calculate bhzTerm zResult = zeta(t); - let tmpZ = zeta(t + 1 / derivRes); + let tmpZ = zeta(t + derivResInv); let dr = tmpZ[0] - zResult[0]; let di = tmpZ[1] - zResult[1]; bhdTerm = BigNumber.from(Math.sqrt(dr*dr + di*di) *