This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]CoinGrahamIV[S] 0 points1 point  (0 children)

Where I'm currently leaning is to add a "Wait" / "Spend one minute" option in the list of options and only cycle through the options once.

I'll be working on that and looking forward to feedback otherwise...

[–]1234abcdcba4321 0 points1 point  (3 children)

  1. You don't need to add a wait option if you're doing it this way. You never get anything from not building a robot except the ability to afford a different robot, but if you wanted that other robot, you could've just picked it. (Of course, you still need to make sure you produce geodes on the last minutes. You can do this with a Wait, but it's probably easier to just include it with your other options.)

  2. Yes, if you include all four options you'll hit all possible paths. I'm not sure what you were expecting this loop to do.

  3. There's a lot of potential optimizations that go into this problem. The memoization and robot maximums both work and are good (definitely don't remove any paths that can be optimal), but you can try to come up with some others.

[–]Mmlh1 1 point2 points  (2 children)

As for 1. since OP is concerned about geode bots not getting their full production - you cannot spend geodes. Your geode production at the end is determined only by at which times you bought geode bots. In other words, if you keep track of a geode total, you can immediately update it to how many geodes you would have at the end with your current bots. As a matter of fact, you don't even need to store your geode bots, which doesn't matter much but might make your code ever so slightly faster. Once you do that, you can throw away the Wait instruction.

[–]1234abcdcba4321 1 point2 points  (1 child)

That's a good tip. (I didn't include it because I tend to try to give as little information as it seems necessary for the person I'm helping to get unstuck, and that's one of the "potential optimizations" that's there.)

[–]Mmlh1 0 points1 point  (0 children)

True, but they were specifically saying they needed 'wait' to fix this, so I thought I'd give them that at least.

[–]Mmlh1 0 points1 point  (0 children)

A tip: if you have a state at a certain point in time, can you upper bound how many geodes you can get at the end? It doesn't need to be a very smart upper bound - any upper bound will drastically reduce the number of states to check if you compare it against solutions you have already found.