Fastest Gun in the West
Snails, 71 bytes
Try it online.
A
\/a=\)2w\V={\\u\(}c=\/b={\\c\(2}u!{(nb|.|.n.)=^o=^O=^0^ }{nb|.|.n.}^
Mathematica, 170 bytes
Catch@BlockMap[b="O"|"o"|"0";MatchQ[#,p=Characters@{" (X) ","(X\\ /X)"," (XVX) "," \\X/ "}/." "->_/."X"->$;p/.$->b|"X"|" "]&&Throw@Count[Pick[#,p,$],b,2]&,#,{4,7},1]&
Takes an array of strings/chars. Returns the number of bullets.
JavaScript, 215 211 209 bytes
Thanks to Shaggy for -4 bytes!
f=
i=>[...i].map((_,x)=>eval(String.raw`a=i.match(/(\n|^).{${x}}..\(${Z='([oO0 ])'}\).*\n.{${x}}\(${Z}\\.\/${Z}\).*\n.{${x}}.\(${Z}V${Z}\).*\n.{${x}}..\\${Z}\//);a&&alert(a.filter(i=>/^[oO0]$/.test(i)).length)`))
tests = [[" (0) ( )\n(o\\ /o( \\ / )\n (oVo) ( V )\n \\o/ \\ /",0],["----------------------------\n////////////////////////////\n////////////////////////////\n/////////////(o)////////////\n///////////(0\\// )//////////\n////////////( Vo)///////////\n/////////////\\ /////////////\n////////////////////////////\n----------------------------",3],["()()()()()()()()()()()()()()()()\\)/)()()()()()()()()()()()()\n()()()()()()()()()()()()()()()()(V)()()()()()()()()()()()()(\n()()()()()()()(\\0/)()()()()()()()()()()()()()()()()()()()()(\n()()()()()()()()()()()()()()()()()()()()()()()( )()()()()()(\n()()()()()()(o)()()()()()()()(00)()()()()()(( \\(/0)()()()()(\n()()()()()()()()()()()()()()()()()()()()()()(( V )()()()()()\n()()()()()()()()()()()()()()()()()()()()()()()\\O/()()()()()(",2],["------(0)---\n||||(0\\|/0)\n-----(0V0)--\n||||||\\0/\n-------_------\n|||||||-|\n------|-|\n|||||||-|\n------|-|",6],["00ooOO(0)/\\\\/V\n\n ( )\n( \\\\/ )\n ( V )\n \\\\ /\n\n00OOoo()()()())))",0],[" (\\) (0)\n(0\\\\/0) ( \\0/ )\n (0V0) ( V )\n \\\\0/ \\ /",1]]
alert = x => i = x;
tests.forEach((t, index) => {
i = 'Not Found'
f(t[0]);
document.getElementById('a').textContent += t[0] + '\n\n' + i + '\n\n';
if (i != t[1]) {
document.getElementById('a').textContent += 'Failed test ' + index + '! Expected ' + t[1] + '\n\n';
document.getElementById('a').style = 'color: red'
}
})
<pre id="a"></pre>
Basically, tries to match a gun n
characters after a line break, for n
from 0
to the length of the string.