diff --git a/rustsweeper/src/main.rs b/rustsweeper/src/main.rs
index ff143ef..fbe89de 100644
--- a/rustsweeper/src/main.rs
+++ b/rustsweeper/src/main.rs
@@ -1,7 +1,6 @@
 use std::io::{stdin,stdout,Write};
 use rand::Rng;
 use colored::*;
-use colored::Color::TrueColor;
 use console::Term;
 
 fn output_board(board: &Vec<Vec<i64>>, state: &Vec<Vec<char>>, x_hovered: i64, y_hovered: i64) {
@@ -218,6 +217,21 @@ fn uncover(board: &Vec<Vec<i64>>, state: &mut Vec<Vec<char>>, x_hovered: usize,
             }
 }
 
+fn detect_win(state: &Vec<Vec<char>>, number_of_nails: i64) {
+    let mut number_of_covered_cells: i64 = 0;
+    for y in 0..state.len() {
+        for x in 0..state[y].len() {
+            if state[y][x] != 'u' {
+                number_of_covered_cells = number_of_covered_cells + 1;
+            }
+        }
+    }
+    if number_of_covered_cells == number_of_nails {
+        println!("Congratulations, you won!!!");
+        std::process::exit(0);
+    }
+}
+
 fn main() {
     let stdout = Term::buffered_stdout();
 
@@ -276,6 +290,7 @@ fn main() {
         }
         if alive {
             output_board(&board, &state, x_hovered, y_hovered);
+            detect_win(&state, number_of_nails);
         }
         else if alive == false {
             println!("GAME OVER!\nYou got Tetanus!");