I have used a custom rule that I manually implemented in a couple of my puzzles, where the value of one line is equal to twice the value of another line. The value of a line is determined by concatenating the digits along the line, starting from a designated starting point. I'll link these puzzles at the bottom of the post is interested to see how they play out.
I really enjoy how this rule works, but I want to create a custom constraint so I don't have to manually determine if it works when creating a puzzle.
I have never used custom constraints before, I have never programmed in JAVA before, and it's been a few years since I've done programming in any other languages (python, C++, Matlab), so I'm probably going to spend some time bumbling around figuring out how to properly code custom constraints, but before I begin I'm hoping for a little bit of hope. Is creating a constraint that compares values between two sets of digits in sudokumaker possible?
The logic is fairly simple. As an exercise, I wrote up a quick and dirty coding for assigning values to one array of digits from a second array of digits. Obviously the coding as is wouldn't run in any program (and the indenting was lost when posting), but it's meant to show the logic when comparing values.
base_length = len(base)
product_length = len(product)
if product_length < base_length or product_length > (base_length+1)
Error
Else
while i<base_length
product[i] = 2*base[i]%10
if i>0
if base[i-1]>=5
product[i] = product[i]+1
i=i+1
if product_length = base_length+1
product[i]=1
Alternatively, would an easier path in sudokumaker be to create a single array that encompasses both lines, and set the relationship between items in the relay?
Puzzles that use this rule:
https://sudokupad.app/0um3eiw8n0
https://sudokupad.app/5mltexutgi