Cleanup and adjusting board colors
This commit is contained in:
parent
3d533d3e54
commit
9144681bad
@ -1,5 +1,4 @@
|
|||||||
use super::Board;
|
use super::Board;
|
||||||
use rand::random_range;
|
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
||||||
pub(super) fn initializeBoard(b: &mut Board) {
|
pub(super) fn initializeBoard(b: &mut Board) {
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
|
||||||
|
|
||||||
mod algo;
|
mod algo;
|
||||||
|
|
||||||
use eframe::egui;
|
use eframe::egui;
|
||||||
use eframe::egui::{CornerRadius, Frame, Ui};
|
use eframe::egui::{CornerRadius, Frame, Ui};
|
||||||
use eframe::emath::Numeric;
|
use eframe::emath::Numeric;
|
||||||
use eframe::epaint::{Color32, Pos2, Rect, RectShape, Rounding, Shape};
|
use eframe::epaint::{Color32, Pos2, Rect};
|
||||||
use rand::SeedableRng;
|
use rand::SeedableRng;
|
||||||
use std::ops::RangeInclusive;
|
use std::ops::RangeInclusive;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
@ -19,12 +18,7 @@ fn main() -> eframe::Result {
|
|||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"Annealing Simulation for Chess Queens Task",
|
"Annealing Simulation for Chess Queens Task",
|
||||||
options,
|
options,
|
||||||
Box::new(|cc| {
|
Box::new(|_cc| Ok(Box::<MyApp>::default())),
|
||||||
// This gives us image support:
|
|
||||||
// egui_extras::install_image_loaders(&cc.egui_ctx);
|
|
||||||
|
|
||||||
Ok(Box::<MyApp>::default())
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +127,8 @@ impl eframe::App for MyApp {
|
|||||||
.with_inner_size([
|
.with_inner_size([
|
||||||
10.0 * self.boardSize as f32,
|
10.0 * self.boardSize as f32,
|
||||||
10.0 * self.boardSize as f32,
|
10.0 * self.boardSize as f32,
|
||||||
]),
|
])
|
||||||
|
.with_resizable(false),
|
||||||
|ui, _| {
|
|ui, _| {
|
||||||
egui::CentralPanel::default()
|
egui::CentralPanel::default()
|
||||||
.frame(Frame::default().inner_margin(0.0))
|
.frame(Frame::default().inner_margin(0.0))
|
||||||
@ -142,7 +137,7 @@ impl eframe::App for MyApp {
|
|||||||
painter.rect_filled(
|
painter.rect_filled(
|
||||||
ui.available_rect_before_wrap(),
|
ui.available_rect_before_wrap(),
|
||||||
CornerRadius::from(0),
|
CornerRadius::from(0),
|
||||||
Color32::from_rgb(0, 0, 0),
|
Color32::from_rgb(50, 50, 150),
|
||||||
);
|
);
|
||||||
|
|
||||||
for y in 0..self.boardSize {
|
for y in 0..self.boardSize {
|
||||||
@ -157,7 +152,7 @@ impl eframe::App for MyApp {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
CornerRadius::from(0),
|
CornerRadius::from(0),
|
||||||
Color32::from_rgb(255, 255, 255),
|
Color32::from_rgb(200, 200, 255),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,8 +161,8 @@ impl eframe::App for MyApp {
|
|||||||
for i in 0..self.boardSize {
|
for i in 0..self.boardSize {
|
||||||
painter.circle_filled(
|
painter.circle_filled(
|
||||||
Pos2::new((10 * board[i] + 5) as f32, (10 * i + 5) as f32),
|
Pos2::new((10 * board[i] + 5) as f32, (10 * i + 5) as f32),
|
||||||
4.0,
|
3.0,
|
||||||
Color32::from_rgb(255, 0, 0),
|
Color32::from_rgb(255, 50, 0),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user