Hi! This is my first post on the JGO forum (although I’ve been a silent and enthusiast reader for a while) and I’m no native English speaker, so please bear with me if I chose the wrong section to post this question or misspell a word or two. I’ll try to be as concise as possible.
In the videogame I’m writing I need an AI to solve this problem (roughly sketched) in several different stages of the gameplay:
R is an M x N matrix.
Some cells of R must be filled with a color (to choose among a predefined finite set).
These cells should be randomly chosen, but the resulting set of <cell, color> tuples has to satisfy the following constraints:
- A cell can be colored with only one color or left blank.
- If a, b, c are three cells of the same row so that a is adjacent to b and b is adjacent to c, then a, b and c cannot be filled with the same color (two cells are adjacent if they share and edge).
- Same as above, but applied to columns.
It’s a variant of the graph-coloring problem, which I would normally approach with Answer Set Programming, but unfortunately there’s no free/opensource solver with a Java binding to embed in my code. So, is there any free tool or library written in Java that lets me model and solve this problem in a convenient way?
Thanks for your attention.