Scout
scout
Read a scouted opponent's screen: the loot on offer and whether it can be skipped.
The scout screen only stands for 30 seconds before the game forces the battle to start and takes the 下一個 button away, and every skipped opponent would cost another call. Position, font and size are fixed by the 1600x900 layout, so the digits are matched against templates here instead of going through Gemini.
Functions:
| Name | Description |
|---|---|
idle_disconnected |
Whether the idle-disconnect dialog is covering the game. |
attack_menu_open |
Whether the 多人遊戲 menu is up with its 尋找對戰目標 button. |
card_groups |
Card centres in the battle row, split into the groups the game lays them out in. |
counted_cards |
Which of these cards show an |
card_count |
The |
deploy_refused |
Whether the game is refusing drops for landing inside the boundary. |
army_strength |
Trained and total army size off the 我的軍隊 screen, or None if not on it. |
freeze_cards |
Which of these spell cards hold freeze, the one spell worth holding back. |
live_cards |
Which of these card-row positions still have something left to deploy. |
read_scout |
The opponent on screen, or None when this screenshot shows no opponent at all. |
read_stock |
The village's own storages, or None when this screenshot is not showing them. |
TEMPLATES
TEMPLATES = {
"0": 169458624884574198223902366912354106996856,
"1": 696897621703158864378983005318264707480702,
"2": 85070591100230874204667429307332765417471,
"3": 675798784304908372152790311370407663366400,
"4": 168945205701540461368970269115296407121948,
"5": 694855254858101058867581815848550986670464,
"6": 85068595901120556248302502939962514078974,
"7": 1393795285959803196907656693197004320768480,
"8": 82346336943585891544677200489837789444606,
"9": 694854598050314149851625745496530502547952,
}
idle_disconnected
Whether the idle-disconnect dialog is covering the game.
Source code in src/ai_coc/parsers/scout.py
attack_menu_open
Whether the 多人遊戲 menu is up with its 尋找對戰目標 button.
The attack loop opens with taps that only mean anything on the home village. An agent job that finished somewhere else would otherwise send them into whatever screen was left showing.
Source code in src/ai_coc/parsers/scout.py
card_groups
Card centres in the battle row, split into the groups the game lays them out in.
How many cards fall in each group depends on the army, so callers are meant to read the first group as the main troops and the rest as one-off drops, rather than trying to name which group is which.
Only valid on a full row. A spent card greys out below the detection floor and the row fragments, at which point the battlefield visible past its ends reads as a card too.
Source code in src/ai_coc/parsers/scout.py
counted_cards
Which of these cards show an xN count, which is to say troops or spells.
Heroes and the siege machine are the ones without it, which is what lets the attack loop drop those and leave spells alone.
Source code in src/ai_coc/parsers/scout.py
card_count
The xN on one card, or None when the artwork behind it swallows the digits.
Lets a one-off drop be tapped as many times as the card actually holds
instead of a fixed guess. A pale illustration merges into the count, and
that shows up as an x glyph of the wrong width, so it reports the failure.
Source code in src/ai_coc/parsers/scout.py
deploy_refused
Whether the game is refusing drops for landing inside the boundary.
Source code in src/ai_coc/parsers/scout.py
army_strength
Trained and total army size off the 我的軍隊 screen, or None if not on it.
Checked before the attack is confirmed, because the search fee is charged after that and an army still being trained is not worth paying it for.
Source code in src/ai_coc/parsers/scout.py
freeze_cards
Which of these spell cards hold freeze, the one spell worth holding back.
Source code in src/ai_coc/parsers/scout.py
live_cards
Which of these card-row positions still have something left to deploy.
Lets the attack loop keep emptying only the cards that are not done yet, rather than guessing a tap count that a bulk troop card would outlast.
Source code in src/ai_coc/parsers/scout.py
read_scout
The opponent on screen, or None when this screenshot shows no opponent at all.
Tapping 下一個 leaves the game on 正在搜尋對手 for a moment, and that screen has no digits where the panel would be, so a failed read is how the caller learns to keep waiting rather than a separate screen classifier.
Source code in src/ai_coc/parsers/scout.py
read_stock
The village's own storages, or None when this screenshot is not showing them.
Anything other than the home village reads as None, as does a home village with a panel over the bars, so a caller is meant to treat it as "not now" rather than as an empty village. Three rows all resolving into digits is itself the evidence that the home screen is up.