@@ -297,7 +297,7 @@ spriteutils.createRenderable(0, function (screen2) {
297297} )
298298spriteutils . createRenderable ( 0 , function ( screen2 ) {
299299 if ( controller . B . isPressed ( ) ) {
300- images . print ( screen2 , "Raw H /S: " + hash_per_sec , sprite_upgrades_button . left , sprite_upgrades_button . top - 15 , 1 )
300+ images . print ( screen2 , "T /S: " + ticks_per_second + "/" + max_ticks_per_second , sprite_upgrades_button . left , sprite_upgrades_button . top - 15 , 1 )
301301 } else {
302302 images . print ( screen2 , "H/S: " + average_hash_per_sec , sprite_upgrades_button . left , sprite_upgrades_button . top - 15 , 1 )
303303 }
@@ -503,11 +503,15 @@ let computer_price = 0
503503let computer_count = 0
504504let local_menu_options : string [ ] = [ ]
505505let average_hash_per_sec = 0
506- let hash_per_sec = 0
506+ let ticks_per_second = 0
507+ let max_ticks_per_second = 0
507508let debug = false
508509debug = false
510+ max_ticks_per_second = 20
511+ let raw_tick_count = 0
512+ ticks_per_second = 0
509513let hash_count_per_sec = 0
510- hash_per_sec = 0
514+ let hash_per_sec = 0
511515average_hash_per_sec = 0
512516set_default_save ( )
513517make_cursor ( )
@@ -526,27 +530,28 @@ game.onUpdateInterval(1000, function () {
526530 hash_count_per_sec = 0
527531 average_hash_per_sec += hash_per_sec
528532 average_hash_per_sec = spriteutils . roundWithPrecision ( average_hash_per_sec / 2 , 2 )
533+ ticks_per_second = raw_tick_count
534+ raw_tick_count = 0
529535} )
530536forever ( function ( ) {
531- for ( let index = 0 ; index <= autoclicker_count - 1 ; index ++ ) {
532- timer . throttle ( "autoclicker_click_" + index , autoclicker_speed , function ( ) {
533- computer_click ( )
534- } )
535- }
536- } )
537- forever ( function ( ) {
538- for ( let index = 0 ; index <= computer_count - 1 ; index ++ ) {
539- timer . throttle ( "computer_mine_" + index , computer_speed , function ( ) {
540- check_for_magic_number ( randint ( 0 , max_height ) )
541- hash_count_per_sec += 1
542- } )
543- }
544- } )
545- forever ( function ( ) {
546- for ( let index = 0 ; index <= asic_count - 1 ; index ++ ) {
547- timer . throttle ( "asic_mine_" + index , asic_speed , function ( ) {
548- check_for_magic_number ( randint ( 0 , max_height ) )
549- hash_count_per_sec += 1
550- } )
551- }
537+ timer . throttle ( "tick" , 1000 / max_ticks_per_second , function ( ) {
538+ for ( let index = 0 ; index <= autoclicker_count - 1 ; index ++ ) {
539+ timer . throttle ( "autoclicker_click_" + index , autoclicker_speed , function ( ) {
540+ computer_click ( )
541+ } )
542+ }
543+ for ( let index = 0 ; index <= computer_count - 1 ; index ++ ) {
544+ timer . throttle ( "computer_mine_" + index , computer_speed , function ( ) {
545+ check_for_magic_number ( randint ( 0 , max_height ) )
546+ hash_count_per_sec += 1
547+ } )
548+ }
549+ for ( let index = 0 ; index <= asic_count - 1 ; index ++ ) {
550+ timer . throttle ( "asic_mine_" + index , asic_speed , function ( ) {
551+ check_for_magic_number ( randint ( 0 , max_height ) )
552+ hash_count_per_sec += 1
553+ } )
554+ }
555+ raw_tick_count += 1
556+ } )
552557} )
0 commit comments