Last active
April 14, 2023 15:48
-
-
Save machkouroke/ee16ceac909ecd794caec10e80dbf5c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Plots | |
include("Chromosone.jl") | |
function plot_chromosome(solution::Chromosone, n::Int64=8)::Plots.Plot | |
board = zeros(n, n) | |
for i in 1:n | |
for j in 1:n | |
if (i + j) % 2 == 0 | |
board[i, j] = 1 | |
end | |
end | |
end | |
p = heatmap(board, aspect_ratio=:equal, legend=false, color=:blues, size=(400, 400)) | |
for queen in solution.queens | |
c = :white | |
annotate!(queen.y, queen.x, '♛', color=c, halign=:center, valign=:middle, font=font(100)) | |
end | |
return p | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment