I was too tired and put the wrong variables :(

This commit is contained in:
LinlyBoi
2023-05-10 08:14:48 +03:00
parent cfef9e6faf
commit 9b905b6148

View File

@@ -1,3 +1,5 @@
use std::fmt::{self, Display};
use raylib::{
prelude::{Color, MouseButton},
RaylibHandle,
@@ -59,7 +61,7 @@ pub struct MenuState {
pub selection: Selection,
pub strategy: Strategy,
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub enum Strategy {
MiniMax,
AlphaBeta,
@@ -91,11 +93,11 @@ impl MenuState {
}
Selection::Cooking => {
if rl.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
self.difficulty = 3;
self.strategy = Strategy::MiniMax;
self.selection = Selection::Done;
}
if rl.is_mouse_button_pressed(MouseButton::MOUSE_RIGHT_BUTTON) {
self.difficulty = 5;
self.strategy = Strategy::AlphaBeta;
self.selection = Selection::Done;
}
}
@@ -115,6 +117,16 @@ pub enum Selection {
Cooking,
Done,
}
impl Display for Strategy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let name: String;
match self {
Self::MiniMax => name = String::from("MiniMax"),
Self::AlphaBeta => name = String::from("AlphaBeta"),
};
write!(f, "{}", name)
}
}
fn get_circle_coords(x: i32, y: i32) -> (i32, i32) {
let mut returned: (i32, i32) = (0, 0);