Recent

Author Topic: Large or huge sets  (Read 10228 times)

avk

  • Hero Member
  • *****
  • Posts: 752
Re: Large or huge sets
« Reply #60 on: September 22, 2022, 03:17:22 pm »
@strmckr, just curious, are you trying to make your own sudoku solver?

Thaddy

  • Hero Member
  • *****
  • Posts: 14380
  • Sensorship about opinions does not belong here.
Re: Large or huge sets
« Reply #61 on: September 22, 2022, 03:24:39 pm »
You are over-indexing: 0..80 should be 0..79. Programmers count from zero and not up until 81...
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

strmckr

  • Newbie
  • Posts: 6
Re: Large or huge sets
« Reply #62 on: September 22, 2022, 09:09:59 pm »
a typo in the description of function..

Sorry should read
   it as  0-80 in my code for the 81 cells


Quote
@strmckr, just curious, are you trying to make your own sudoku solver?
  not trying,  I have a pretty extensive solver
 I've had it posted  online In players and programers forums since roughly 07
HERE

(old version of my present code I have been rebuilding alot of since I learned some new stuff)

Been wanting t add p.o.m to it but it needs 46656 templates to function. My solvers set based so its never been able to go that high with how fps is programed with 256 limit.

« Last Edit: September 22, 2022, 09:26:37 pm by strmckr »

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Large or huge sets
« Reply #63 on: September 22, 2022, 10:00:48 pm »
not trying,  I have a pretty extensive solver

If I might be permitted an aside... a number of years ago I asked a question on a private conferencing system (CIX, in the UK) relating to a knight's tour on (I think) a 12x12 board. A gentleman called Stuart Vernon promptly posted a solution, but somebody pointed out that it wasn't /strictly/ correct since while it touched all squares the start and end positions were different. A few minutes later he posted a solution to meet that requirement.

At that point somebody remarked on his speed and asked whether he was doing it by hand, and he explained what he was doing. I forget his background, but he had a fully-subscribed copy of a high-end Constraint Logic Programming package (possibly ECLiPSe, when it was anything-but free), which he was using to design soduku problems for various clients: the twist being that each one had a carefully-calibrated level of difficulty :-)

MarkMLl
« Last Edit: September 22, 2022, 10:12:22 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

strmckr

  • Newbie
  • Posts: 6
Re: Large or huge sets
« Reply #64 on: September 22, 2022, 11:39:28 pm »
 Sounds like dlx with extra constraints. There is a few other ways to make it start and end on its own move
.
   I do have a code  that Can solve my own version of knight moves or be modified to solve chess restricted moves.  (  It is iterative and backtracking.)

  I call my piece Sinbad seen   here
« Last Edit: September 23, 2022, 12:08:50 am by strmckr »

avk

  • Hero Member
  • *****
  • Posts: 752
Re: Large or huge sets
« Reply #65 on: September 23, 2022, 01:27:02 pm »
As for me, at one time I was completely fascinated by how these problems are formulated in terms of graph theory.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Large or huge sets
« Reply #66 on: September 23, 2022, 03:40:34 pm »
Sounds like dlx with extra constraints. There is a few other ways to make it start and end on its own move.

More like that dlx is a specialised solver for one particular problem. I believe Stuart was paying several thousand pounds a year for ECLiPSe or whatever he had.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 14380
  • Sensorship about opinions does not belong here.
Re: Large or huge sets
« Reply #67 on: February 15, 2023, 02:59:14 pm »
Old thread, but anyway:
Since I got a bit bored with this discussion at the time, I did a write up how it actually works. Alas it is not possible - without using records - to have all operators for any size of ordinal, I will explain how it actually works, so you will be able to use "sets" on any ordinal:

SET operations in Pascal are typically represented as a "set of bits in a byte" and can be used to perform various mathematical operations.
A standard Pascal set has a maximum range of 0..255. And that is supported by build in operants.
Here I have written up an explanation of how sets are actually implemented at the low level.
There are four operations that form the core and I have tried to explain those below.
All other set operations can be derived from those four.
So, although set notation is restricted to byte, when you really understand how they work you can apply it to word, dword and qword.
Just by using boolean logic you can create your own sets. But not with operators..
But since their simple nature the generated code is inherently very fast.

Set Union (OR), notation +
The set union operation is used to combine the elements of two sets into one set. This operation is implemented in Pascal by using the OR operator.

For example:

SetA = [1, 2, 3]
SetB = [4, 5, 6]
SetC = SetA OR SetB
This would result in SetC = [1, 2, 3, 4, 5, 6]
With standard set notation it is done like this: SetC:=SetA+SetB

Set Intersection (AND), notation *
The set intersection operation is used to find the elements that are common within two sets. This operation is implemented in Pascal by using the AND operator.

For example:

SetA = [1, 2, 3]
SetB = [2, 3, 4]
SetC = SetA AND SetB
This would result in SetC = [2, 3]
With standard set notation it is done like this: SetC:=SetA*SetB

Set Difference (NOT), notation -
The set difference operation is used to find the elements that are in the first set but not in the second set. This operation is implemented in Pascal by using the NOT operator.

For example:

SetA = [1, 2, 3]
SetB = [2, 3, 4]
SetC = SetA NOT SetB or actually SetA and (SetA xor SetB)
This would result in SetC = [1]
With standard set notation it is done like this: SetC:=SetA-SetB

Set Symmetric Difference (XOR), notation ><
The set symmetric difference operation is used to find the elements that are either in the first set but not in the second set, or in the second set but not in the first set. This operation is implemented in Pascal by using the XOR operator.

For example:

SetA = [1, 2, 3]
SetB = [2, 3, 4]
SetC = SetA XOR SetB
This would result in SetC = [1, 4]
With standard set notation it is done like this: SetC:=SetA><SetB

In Boolean logic, each operation is represented by the following equations:

Set Union: SetC = SetA OR SetB, notation +
Set Intersection: SetC = SetA AND SetB, notation *
Set Difference: SetC = SetA NOT SetB, notation -
Set Symmetric Difference: SetC = SetA XOR SetB, notation ><

As I wrote, all other set operations can be derived from the above.

Hope this helps, it is not rocket science.

And NO, apart from in, you can't create full sets of operator overloads, otherwise I would have done so.
« Last Edit: February 15, 2023, 06:33:04 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018