Beta
Clicker Game Solver [EASY ver.]
Description:
This clicker game is destroying my thumbs!
I'm way too lazy to play this...
That's it: from now on, I refuse to click the screen any more than strictly necessary.
Rules
- Your starting balance is
0
cash. Your startingcpc
isup
. - A single click gains you
cpc
cash. - You may spend
cpc^3
cash to upgrade. This increases yourcpc
byup
and can be done any number of times. - Upgrading requires a click!
Task
- Function parameters are non-negative integers
up
andgoal
. - Return the minimum number of clicks required to reach the cash
goal
, as an integer. If this is impossible, return-1
. - Spent cash does not compound to the
goal
: thegoal
is reached when your current balance is at least as much as thegoal
.
Examples
clicker_solver(up = 2, goal = 6) --> 3
- Click
3
times, gaining6
cash.
clicker_solver(up = 2, goal = 24) --> 11
- Click
4
times, gaining8
cash. - Buy upgrade (this entails a click):
cpc
increases to4
, no cash left. - Click
6
times, gaining24
cash.
clicker_solver(up = 5, goal = 3030) --> 329
- Click
25
times, gaining125
cash. - Buy upgrade (this entails a click):
cpc
increases to10
, no cash left. - Click
100
times, gaining1000
cash. - Buy upgrade (this entails a click):
cpc
increases to15
, no cash left. - Click
202
times, gaining3030
cash.
Alternative solution: instead of buying the second upgrade, click 203
more times.
Performance
- Approx.
600
cases from the test suite also evaluate performance:up
ranges from2
to40
andgoal
goes up to10^10
! - The reference solution executes with
O(log n)
taking less than1s
.
Game Solvers
Games
Mathematics
NumPy
Performance
Puzzles
Simulation
Similar Kata:
Stats:
Created | Feb 27, 2025 |
Published | Mar 4, 2025 |
Warriors Trained | 34 |
Total Skips | 7 |
Total Code Submissions | 100 |
Total Times Completed | 8 |
Python Completions | 8 |
Total Stars | 1 |
% of votes with a positive feedback rating | 100% of 5 |
Total "Very Satisfied" Votes | 5 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 4 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |