Codebuster is a very nice and interesting game. After full four weeks improving the full shepherd strategy (thx to Recar for showing the way), I think the game is not yet finished because new strategies will come for sure to beat it.
I think the best thing to do before doing the shepherd, is having a well improved strategy in searching ghosts and manage opponent, because Shepherd can have fatal issues if some errors are made. The point is that this strategy pays only at the end of the game, when a sufficient number of ghosts are collected. All you have to do before that is pushing ghosts in your base the faster you can. It is not so easy because other strategies are based on speed collect. So the game is a real course vs time to win it.
The shepherd logic is organized in 2 phases. The first consists in pushing all possible ghosts in your base. The second is busting all ghosts. To do that, the score is controled all the time to see if the game is winable or not, for example, when there are not enough pushable ghosts on the board. In this case, we have to abandon shepherd for another tactic until the score is reachable.
To identify the 2 phases, I use a simple flag (win == 0 or win == 2), based on the simple formula : my score (you have to calculate it… not easy) + my ghosts in hand (state == 1) + ghosts near my base (dist constant 1600 works well but 1000 is better) > total number of ghosts / 2.
(win == 1 is for the case my score and my ghosts in hand are enough to win, but it is never the case when shepherd strategy is active.)
Notice that time is limited (only 250 turns). So the game can be lost if you cannot kill all ghosts you have collected in your base before the end of the game. All the first part of the game must be focused on pushing ghosts, and nothing else. The difficult part of the strategy is to know what you can do to annoy your opponent without losing time to push your ghosts. The priority is the shepherd rule which consists principally in determining which ghosts are to push (inner) and which are not (outer). The rules here are very simple : push all ghosts you can. I tried few global limitations but that did’nt help more. But indeed every buster will have his own limitations… and knowing if a ghost is pushable or not is not so easy in fact…
While pushing, I can do some other fun actions :
- Always stun an opponent if he is busting a ghost : he will lose time and the ghost will be free to be pushed
- But wait before ghost is very weak : the opponent will lose more time
- Intercepting opponent when he has captured a ghost is a good thing too, because he will lose time and generally, the battle is on the good side of your shepherd perimeter. For real, in this strategy, all is on the good side (except your starting point). Even the opponent has to push “your” ghosts to approach them. It is the really really funny thing here
- Bust weak outer ghosts
- don’t bust outer ghosts if they are far or to tough (tougher than 3)
- If you captured a ghost, don’t go straight to your base (this would ruin the shepherd strategy), but go on pushing other ghosts
- But you can defend your capture ghost : dodge, come with other busters, and the best thing EJECT it in the shepherd perimeter (but I think I can improve my EJECT skills to pass ghost from buster to buster in some situations)
- A very good thing to do instead of RELEASE is to BUST another ghost (there are many) in your base, because you gain time for your future busting phase.
- Don’t bust inner ghosts (in the perimeter), prefer push them
- But you can bust them to save time for later, when pushing other ghosts doesn’t need to move, until endurance is 1
- If there is not enough ghosts possible for the shepherd, do the classic game (here I have to improve my exploring skill because it is very poor)
When the first part of the game is done (win == 2) the thing is to bust and bust and bust.
Here, the stunning rules are not the same because you have to do that just in time to keep charge and to avoid opponent to steal your ghosts.
If an opponent succeed in stealing a ghost, don’t go after him is better than go. If you have to do that, the win formula will say it :). A lot of good news here. If you captured a ghost and the opponent stuns you… 1 point for you. Idem if you stun him and he is in the 1600 limit. And if finally he managed to steal one ghost, he has to return it to his base, letting you time and a superiority in combat. So a lot of fun for you !
But sometimes, at the end, some game may be lost because time is out. You may lose too if the opponent is the best in combat and he got some great advance in score during the first phase. Or if you have a lot of tough ghosts to bust, and there is not enough time.
Other cool things you have to do with CodeBuster :
- Good exploration because when all other actions failed, this is the only one option left
- Counting score : this is not so easy because ghosts can disappear (captured by opponent, dropped in a base because of stun, …) The worst thing I saw was in my base : 3 busters of mine vs 2 enemy busters (the 3rd was stunned). When the ghost has been captured, there was this “neutral” turn where the ghost is floating between all busters, without changing any state for them Just on this turn, a buster of mine shot a STUN on opponent. No luck, it was the buster who had to collect the ghost (I think the rule of nearest buster collecting is not working because it was not the case). The ghost was dropped in my base and collapsed… no point in my score counter (how to get it ? it’s a complicate rule)… bad win flag… my busters go out to collect this ghost which disappeared… game lost… I think I could anticipate the capture, but this means using a lot of conditions for a very rare situation… perhaps the score would be worth in the input data…
- Evaluate enemy position : you can’t predict where enemy are when you don’t see them, but you can say if enemy cannot be at a point because you’ve seen them elsewhere some turns before and enemy could’nt have the time to go there.
- Radar and symetry : At the very beginning, with the symetry rule, some RADAR action can give mostly all ghost positions.
- Enemy position : At start, you can be sure of all the opponent positions (I needed time to figure that :))
- Calculate the best interception point for an enemy captured ghost
- In combat, let the enemy bust the ghost, and stun him at the end…
- In combat, go between ghost and the enemy buster… he will stun you… and the ghost will fly
- The bug was fixed, but till Silver league, you could RELEASE a ghost and BUST it with another buster, in the same turn. What about EJECT + BUST in the same turn ? No sorry, that cannot work.
- EJECT : I did’nt explore this new feature a lot yet, but I think this new Gold rule will be the key when we will have several shepherd players trying to push in opposite directions… :). The fact is that today, pushing ghosts without push resistance, is winning nearly all the time. Even the fast EJECT strategy (like Levatol) encounters some difficulties vs massive STUN and just let the ghosts go away. But what if the two players are pushing. I know that Recar was difficult to beat because of that, and I don’t have the good solution now…
And the good news is that my shepherd algorithm is very very simple. I didn’t try to optimize ways a lot, didn’t avoid opponent blocking, didn’t make a far deep evaluation of the game, etc… So all yet can be done !
Perhaps, in this game with no AI interest at first glance, the AI time is coming. And I’d like to see that, because the strategy I applied is only a “gamer” strategy, without lot of AI (next turn evaluation only). So the best thing in all of that is the great question : AI or Human?
Very good game and a lot of fun
Thanks to Codingame for all the work
edit : Combining Pushing and Eject was finally a good thing. Taohbi who used both the technics has reached the top now. It was a great challenge for me (I think for Taohbi too) to stay in the game against Levatol because he has improved his strategy with a good “attack other base and get back ghosts with EJECT” technic. So pushing ghosts is not sufficient now, and you have to :
- Optimize collect with EJECT at the beginning
- Choose a strategy : Push or Collect other ghosts (personnaly, I always push when I can win with that)
- Attack other base or defend your base
- Good combat skills and EJECT technics make the difference