Skip to content

Instantly share code, notes, and snippets.

@machkouroke
Last active April 14, 2023 15:48
Show Gist options
  • Save machkouroke/ee16ceac909ecd794caec10e80dbf5c2 to your computer and use it in GitHub Desktop.
Save machkouroke/ee16ceac909ecd794caec10e80dbf5c2 to your computer and use it in GitHub Desktop.
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