Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Question: Custom constraint comparing lines possible?
#1
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 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 as is, 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
Zitieren


Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  How do you make curved lines when making a sudoku game Merdock 0 241 22.10.2026, 04:48
Letzter Beitrag: Merdock
  help with coding a constraint MOORESUDOKU90 1 769 25.05.2026, 05:34
Letzter Beitrag: MOORESUDOKU90
  Penpa+ to sodukopad adding knights move constraint astr0creep 2 6.052 02.07.2025, 05:40
Letzter Beitrag: eap314
  Use of a "skip cell" constraint in puzzle setting psams 0 6.975 16.07.2024, 19:59
Letzter Beitrag: psams
  Question regarding ruleset - KNT chaos construction 14_15_16 3 6.227 16.06.2024, 19:12
Letzter Beitrag: Joe Average

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste