Skip to content

Commit

Permalink
Merge pull request #7 from Nervonment/v0.3.x
Browse files Browse the repository at this point in the history
adjust difficulty
  • Loading branch information
Nervonment authored Jun 7, 2024
2 parents 164ded3 + d4e9a5b commit 811d7a3
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 142 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
args: "--target aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-20.04" # for Tauri v1 you could replace this with ubuntu-20.04.
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""
Expand All @@ -35,7 +35,7 @@ jobs:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04' # This must match the platform value defined above.
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sudoxide",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
111 changes: 27 additions & 84 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 12 additions & 30 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use std::sync::{Arc, Mutex};

use serde::Serialize;
use std::sync::{Arc, Mutex};
use sudoku::{
game::generator::random_sudoku_puzzle_phishing,
neo::{
generator::random_sudoku_puzzle,
judge::judge_sudoku as judge,
puzzle::{SudokuPuzzleFull, SudokuPuzzleSimple},
solver::{StochasticSolver, TechniquesSolver},
generator::{
random_sudoku_puzzle_easy, random_sudoku_puzzle_extraeasy, random_sudoku_puzzle_extrahard,
random_sudoku_puzzle_hard, random_sudoku_puzzle_normal, random_sudoku_puzzle_ultimate,
},
judge::judge_sudoku as judge,
};
use tauri::State;

Expand Down Expand Up @@ -52,33 +49,18 @@ struct SettingsState(Arc<Mutex<Settings>>);
async fn get_sudoku_puzzle(settings: State<'_, SettingsState>) -> Result<[[i8; 9]; 9], ()> {
let difficulty = settings.0.lock().unwrap().difficulty;
Ok(match difficulty {
0 => random_sudoku_puzzle::<
StochasticSolver<SudokuPuzzleSimple>,
TechniquesSolver<SudokuPuzzleFull>,
>(30, 0, 50),
1 => random_sudoku_puzzle::<
StochasticSolver<SudokuPuzzleSimple>,
TechniquesSolver<SudokuPuzzleFull>,
>(50, 50, 90),
2 => random_sudoku_puzzle::<
StochasticSolver<SudokuPuzzleSimple>,
TechniquesSolver<SudokuPuzzleFull>,
>(55, 90, 200),
3 => random_sudoku_puzzle::<
StochasticSolver<SudokuPuzzleSimple>,
TechniquesSolver<SudokuPuzzleFull>,
>(50, 200, 1000),
4 => random_sudoku_puzzle::<
StochasticSolver<SudokuPuzzleSimple>,
TechniquesSolver<SudokuPuzzleFull>,
>(45, 800, 10000),
_ => random_sudoku_puzzle_phishing(),
0 => random_sudoku_puzzle_extraeasy().0,
1 => random_sudoku_puzzle_easy().0,
2 => random_sudoku_puzzle_normal().0,
3 => random_sudoku_puzzle_hard().0,
4 => random_sudoku_puzzle_extrahard().0,
_ => random_sudoku_puzzle_ultimate().0,
})
}

#[tauri::command]
async fn judge_sudoku(board: [[i8; 9]; 9]) -> (bool, [[bool; 9]; 9]) {
let res = judge(&board);
let res = judge(&sudoku::Grid(board));
(res.1, res.2)
}

Expand Down
4 changes: 2 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "Sudoxide",
"version": "0.2.0"
"version": "0.2.1"
},
"tauri": {
"allowlist": {
Expand Down Expand Up @@ -65,7 +65,7 @@
"updater": {
"active": true,
"endpoints": [
"https://nervonment.github.io/sudoxide/versions/update.json"
"https://nervonment.github.io/sudoxide_versions/update.json"
],
"dialog": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDQyNEU5RDgyQjQxODE2NDkKUldSSkZoaTBncDFPUW9KdEtMMTRsUVptUG9BUGtDUXdnd0QwdkRoays2YkZLVjdBWG1LODlmNVEK",
Expand Down
23 changes: 0 additions & 23 deletions versions/update.json

This file was deleted.

0 comments on commit 811d7a3

Please sign in to comment.