arnaud-m / cryptator

A constraint-based cryptarithm solver
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

[QUALITY] Add more tests based on crossword puzzles #91

Closed arnaud-m closed 1 year ago

arnaud-m commented 1 year ago

Is your feature request related to a problem? Please describe. Add more tests with subtractions, multiplications, and divisions.

Describe the solution you'd like Define tests based on crossword puzzles with various operations. The Alphametics page presents a number of crossword puzzles.

Additionally, these crossword puzzles must be checked because some of them have multiple solutions.

arnaud-m commented 1 year ago

I have written a small R script to format the crossword puzzle:

  FormatCrossword <- function(text) {
     x <- scan( text = text, what = character())
     y <- c(
       paste(x[ 1:5], collapse = ""),
       paste(x[ 9:13], collapse = ""),
       paste(x[ 15:19], collapse = ""),
       paste(x[ c(1, 6, 9, 4, 15)], collapse = ""),
       paste(x[ c(3, 7, 11, 4, 17)], collapse = ""),
       paste(x[ c(5, 8, 13, 4, 19)], collapse = "")
     )
     paste(y, collapse = " && ")
  }

One must still substitute the division sign : by /.

arnaud-m commented 1 year ago

There are two typographic mistakes in the crossword list.

Typo 1

ABB  :   C  =  DB
  *      +      -
  E  *   A  =   C
-----------------
 FC  :  GA  =   B

ABB * E = FCmust be replaced by ABB / E = FC (see the solution).

Typo 2

 HEB + EUS  =  LFS
 -     -       :
WUB :  EH  =   US
-----------------
EHB - ESU  =   RA

EUS - EH = ESU must be replaced by EUS + EH = ESU (see the solution)