From 7ea62870d0124cfd3492d3fe1c35a2163a5af806 Mon Sep 17 00:00:00 2001
From: Adrian Gunnar Lauterer <adrian@lauterer.it>
Date: Sun, 24 Mar 2024 07:09:28 +0100
Subject: [PATCH] patched crash from negative points

---
 src/azul.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/azul.rs b/src/azul.rs
index abb47aa..e7fa9ac 100644
--- a/src/azul.rs
+++ b/src/azul.rs
@@ -219,7 +219,7 @@ impl GameState {
                 }
             }
 
-            let negative = match player.floor.len() {
+            let   negative = match player.floor.len() {
                 0 => 0,
                 1 => 1,
                 2 => 2,
@@ -229,7 +229,8 @@ impl GameState {
                 6 => 11,
                 _ => 14,
             };
-            player.points -= negative;
+            // check if the absolute value of negative is less than the points
+            player.points = player.points.saturating_sub(negative);
 
             if player.floor.start == 1 {
                 self.starting_player = player_name.clone();