summaryrefslogtreecommitdiff
path: root/src/shooting.rs
blob: c2ca56e6f586adb852d083597f0c71b1f72b226f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use actions::*;
use math::*;
use state::*;

pub fn shoot_randomly(state: &State) -> Action {
    let mut shot: Point;
    
    while {
        shot = Point::random(state.map_size);
        let ref target = state.opponent_map.cells[shot.x as usize][shot.y as usize];
        target.damaged || target.missed
    } {}

    
    Action::Shoot(shot)
}