From 763653a32e62134a7e394c349d742636b0662a94 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Wed, 21 Feb 2018 08:54:25 -0600 Subject: -added all directions --- src/connection.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/connection.rs b/src/connection.rs index cfe642d..648e1e3 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -27,7 +27,7 @@ impl Connection { let index = match result { Some(index) => index, None => { - let mut ship = Ship::new(name); + let ship = Ship::new(name); ships.push(ship); ships.len() - 1 }, @@ -67,6 +67,11 @@ impl Connection { match self.buff_r.read_line(&mut data) { Ok(_result) => match data.as_bytes() { b"5\n" => ships[self.index].location.0 += 1, + b"0\n" => ships[self.index].location.0 -= 1, + b"8\n" => ships[self.index].location.1 += 1, + b"2\n" => ships[self.index].location.1 -= 1, + b"4\n" => ships[self.index].location.2 += 1, + b"6\n" => ships[self.index].location.2 -= 1, _ => (), }, Err(_error) => println!("b{}", _error) -- cgit v1.2.3