Enemy Bunching and Harder Puzzles

I have been trying some of the hard puzzles and am having trouble with the puzzles that require enemy bunching (such as Thor vs Giants and Code vs Zombies). I was just hoping that someone would be able to share some good sources and tutorials that I could have look at. Also any sources that would help me learn more advanced algorithms and principles needed for the harder puzzles would be much appreciated :slightly_smiling:

I also realize that the answer to my problems may be to learn how to write more “general” algorithms instead of hard coding strategies, a source on how to learn this would be amazing :smiley:

Thanks in advance!

2 Likes

I am slowly reaching your point (not there yet, but soooooon), and I am interested to know the answer.

I think that you need to focus about learning how barycenter works (here a french description of it). If you’re not french, just look it up on google and you’ll have a good start to calculate where is the centerpoint of all those giants :wink:

Sorry, couldn’t not. From back in terminale, and now there is even a player calld Barry (with one r too much)

Thanks for your reply @CvxFous :slightly_smiling:
But I have looked at a few sources and dont quite understand. For bodies of no (or uniform and equal) mass would this not just be the average co-ordinate ((sum of X, sum of Y)/number of giants)? if so I have already implemented this in Thor vs Giants and it only lets me achieve a 50% score.
Oh and @Naity, I understand and it is ok :stuck_out_tongue:

You have many many possible appoaches for a problem like this. And it will be hard to explain all in details but we can give you some hints.

Bruteforce

It is how i have solved Thor vs Giants. I just bruteforce all possibilities for the next 5 turns and i keep the best solution. You don’t have to how to bunch giants or something like that. Just do the best solution for the next 5 turns. But i would be pretty hard to do that in Code Vs Zombie since you have too many possibilities for just one turn.

Monte Carlo

It’s a little like bruteforce but you use that when you can’t test all possibilities because you don’t have the time for that. You test random solutions for 100ms (or more if you have the time) and you keep the best solution. It works pretty well for Code Vs Zombie (i’m pretty sure that the strategy of all the top 10 of the puzzle, including me). It could works for Thor vs Giants too. Just run random solutions for the next 10 turns and keep the best.

Heuristic

An heuristic strategy is a formula/algorithm which the result is “if you do that for this turns, you will win”. That’s where the link of CvxFous is useful. But a working heuristic is sometime hard to code. For Thor Vs Giants for example, you have to know when you can strike or not. Because if you waste a strike on too less giants, you will lose after.

5 Likes

Thanks for your reply @Magus :slightly_smiling:
I do find this very helpful. I assume you mean that I should take these approaches by implementing game trees, minimax, alpha-beta and progressive deepening (things I all just found on Google and know very little about :stuck_out_tongue: ). If so could you please give me any good sources to learn about those? :slightly_smiling: I have been searching myself but cant seem to find ones explaining the implementation as well as the theory.
Thanks again :smiley:

The first time i implemented minimax and alphabeta was for CodingGame (my current works doesn’t require at all to know such algorithms since i’m a web developper).

I used the pseudo code on wikipedia for both:


For progressive deepening i don’t know a pseudo code out there sorry.

1 Like

Thanks again for the reply :slightly_smiling:
The links are quite helpful and I have also stumbled upon a few YouTube videos that helped very much :smiley:

CS 61B Lecture 16: Game Trees
CS 61B Lecture 17: Encapsulation - Havent watched it yet but it is the follow up to the very helpful Lecture 16
Search: Games, Minimax, and Alpha-Beta