ÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÀ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌÀ¬ÀÀÀ¬ÀÀÀ¬ÀÀÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÌ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌ̬ÀÀÀ¬ÀÀÀ¬ÀÀ¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî >Ê<33330303003300303333333330333033000003330333333303000333300030033033000003333303000330003333300000000333330333303300030333000330330330303030333330300333030300333030330033300003033033300303330330303030330333033033030033003300300300030033333300330000000033033033033303330330333303000330330300003333000300000030003003003003003300330330003033030000030030300033000300300000303033000003300030333300030033033330030303330300003000033030030030300000300033030003003030030303330333330003300330003333030030333033033330333033003030033033033303003033000033333300003330003033003033330303300333030300030333300033030000330333030303300330303300033000030330033003030333333030333033003030333030030300303030030030300003330300303300030030300333300003333300033033030333300003030303030333030003303300330333003333000303330303033300003000300330000300003003033030303303¾ -- title: Bitcoin Mining Simulator -- author: Jesse Cochran and ChatGPT -- desc: An idle/incremental Bitcoin mining game. -- script: lua -- Idle/Incremental Bitcoin Mining Simulator for TIC-80 -- Author: Jesse Cochran and ChatGPT -- Constants local WIDTH, HEIGHT = 240, 136 local INITIAL_BTC = 0 local INITIAL_MINING_RATE = 0.1 -- BTC per second local FPS = 60 local MINER_UPGRADE_COST = 10 local MINER_RATE_INCREASE = 0.2 local CLICK_REWARD = 0.5 -- BTC per click local FARM_UPGRADE_COST = 50 local FARM_RATE_INCREASE = 1.0 local DATA_CENTER_COST = 200 local DATA_CENTER_RATE_INCREASE = 5.0 local COST_MULTIPLIER = 1.2 -- Cost increase factor for upgrades -- Game state local btc = INITIAL_BTC local mining_rate = INITIAL_MINING_RATE local miner_level = 1 local farm_level = 0 local data_center_level = 0 local timer = 0 -- Draw centered text function function draw_centered_text(text, y, color) local text_width = print(text, 0, -10) print(text, (WIDTH - text_width) // 2, y, color) end -- Update function function update() -- Increment the timer timer = timer + 1 -- Increment Bitcoin based on mining rate if timer >= FPS then btc = btc + mining_rate timer = 0 end -- Handle input for upgrades if btnp(4) then -- Z key for miner upgrade if btc >= MINER_UPGRADE_COST then btc = btc - MINER_UPGRADE_COST miner_level = miner_level + 1 mining_rate = mining_rate + MINER_RATE_INCREASE MINER_UPGRADE_COST = MINER_UPGRADE_COST * COST_MULTIPLIER end end if btnp(5) then -- X key for manual mining btc = btc + CLICK_REWARD end if btnp(6) then -- A key for farm upgrade if btc >= FARM_UPGRADE_COST then btc = btc - FARM_UPGRADE_COST farm_level = farm_level + 1 mining_rate = mining_rate + FARM_RATE_INCREASE FARM_UPGRADE_COST = FARM_UPGRADE_COST * COST_MULTIPLIER end end if btnp(7) then -- S key for data center upgrade if btc >= DATA_CENTER_COST then btc = btc - DATA_CENTER_COST data_center_level = data_center_level + 1 mining_rate = mining_rate + DATA_CENTER_RATE_INCREASE DATA_CENTER_COST = DATA_CENTER_COST * COST_MULTIPLIER end end end -- Draw function function draw() cls(0) -- Clear the screen with a black background -- Title draw_centered_text("Bitcoin Mining Simulator", 10, 3) -- Display BTC balance draw_centered_text("BTC: " .. string.format("%.2f", btc), 20, 3) -- Display mining rate draw_centered_text("Rate: " .. string.format("%.2f", mining_rate) .. " BTC/s", 35, 3) -- Display miner level draw_centered_text("Miner Lv: " .. miner_level, 50, 3) -- Display farm level draw_centered_text("Farm Lv: " .. farm_level, 65, 3) -- Display data center level draw_centered_text("Data Center Lv: " .. data_center_level, 80, 3) -- Display upgrade instructions draw_centered_text("Z: Miner (" .. string.format("%.2f", MINER_UPGRADE_COST) .. ")", 95, 3) draw_centered_text("A: Farm (" .. string.format("%.2f", FARM_UPGRADE_COST) .. ")", 105, 3) draw_centered_text("S: Center (" .. string.format("%.2f", DATA_CENTER_COST) .. ")", 115, 3) -- Display manual click instructions draw_centered_text("X: Mine BTC (" .. string.format("+%.2f", CLICK_REWARD) .. ")", 125, 3) end -- TIC function (main loop) function TIC() update() draw() end