implemented "acht-damen algorithmus", seperated javascript from html, made a simple check function.

This commit is contained in:
2026-03-29 17:54:11 +02:00
parent 81d689c1ba
commit 79cf3240e1
5 changed files with 236 additions and 144 deletions
+12 -1
View File
@@ -1,5 +1,6 @@
from flask import Blueprint, jsonify, render_template, request
from flask_login import login_required, current_user
import random
main_bp = Blueprint("main", __name__)
@@ -61,4 +62,14 @@ def solve():
board[row] = -1
backtrack(0)
return jsonify(solutions)
return jsonify(solutions)
@main_bp.route("/solve_rooks")
def solve_rooks_route():
return jsonify(solve_rooks(8))
def solve_rooks(n=8):
solution = list(range(n))
random.shuffle(solution)
return solution