Questions tagged [cryptarithmetic-puzzle]

A cryptarithmetic puzzle is an equation with words whose letters represent decimals digits.

56 questions
8
votes
6 answers

Faster implementation of verbal arithmetic in Prolog

I already made a working generalized verbal arithmetic solver in Prolog but it's too slow. It takes 8 minutes just to run the simple expression S E N D + M O R E = M O N E Y. Can someone help me make it run faster? /*…
user974036
  • 101
  • 1
  • 5
7
votes
2 answers

Cryptogram Puzzle with Prolog CLPFD

I recently found a small game on the Google Play app store called Cryptogram. There are dozens of apps similar to this one. The idea is to match the number to the colors such that all of the equations sound true. I was able to get through problems…
bananafacts
  • 173
  • 6
6
votes
7 answers

A more efficient approach to Verbal arithmetic / Alphametics?

Perhaps most of you know the Send + More = Money. Well, I'm currently learning java and one of the exercises is I have to solve HES + THE = BEST. Now, so far I can/should use if-for-while-do loops, nothing else. Although I'm sure there are different…
6
votes
3 answers

Making a cryptaritmetic solver in C++

I am planning out a C++ program that takes 3 strings that represent a cryptarithmetic puzzle. For example, given TWO, TWO, and FOUR, the program would find digit substitutions for each letter such that the mathematical expression TWO + TWO…
norman
  • 4,280
  • 10
  • 38
  • 72
6
votes
2 answers

Solving a Crypt-Arithmetic Puzzle with Relational Database

Say you are given the crypt-arithmetic puzzle: SEND + MORE = MONEY The goal is to substitute numbers (0-9) for letters, so that the addition works out. I understand how to approach the problem mathematically, but I am not sure how to solve this…
wilco
  • 278
  • 2
  • 16
5
votes
5 answers

Efficient way of Solving Cryptarithms

Hi i came across this puzzle which is a subset of famous kind of word and numbers based puzzles called Cryptarithms. Say you have an expression as S E N D + M O R E = M O N E Y Now the interesting part there is that, each alphabet is representing…
Anirudh Goel
  • 4,304
  • 18
  • 72
  • 106
5
votes
1 answer

Get one of many possible solutions in Prolog

I'm trying to learn Prolog. I looked at this script: :- use_module(library(clpfd)). puzzle([S,E,N,D] + [M,O,R,E] = [M,O,N,E,Y]) :- Vars = [S,E,N,D,M,O,R,Y], Vars ins 0..9, all_different(Vars), S*1000 + E*100 + N*10 + D + M*1000 + O*100…
Jesse Aldridge
  • 7,134
  • 7
  • 41
  • 72
5
votes
4 answers

How to Solve Cryptarithmetic Puzzle in Prolog

I have to write a Prolog program for solving a cryptarithmetic puzzle. I need to write a function solve([A, M, P, D, Y]) which assigns the variables [A, M, P, D, Y] to values from 0 to 9 so that it satisfies the equation AM+PM=DAY. Each variable is…
codergirl
  • 53
  • 1
  • 4
4
votes
2 answers

Prolog Cryptarithmetic Puzzle

I have been asked to solve a Cryptarithmetic Puzzle using Prolog: GIVE * ME ------ MONEY The above is the puzzle, I cannot figure out where is the problem, the result always returns false. Plus I am not allowed to use any library in…
kyo
  • 43
  • 4
4
votes
1 answer

Using apply in core.logic Clojure (CLP) Cryptoarithmetic

(ns verbal-arithmetic (:require [clojure.core.logic :refer [all run* everyg lvar == membero fresh conde succeed fail conso resto]] [clojure.core.logic.fd :as fd])) (comment "Solving cryptarithmetic puzzle" " SEND + MORE ______ …
4
votes
2 answers

Prolog "singleton variable" warning

I'm new to Prolog and royally confused! I keep getting a "singleton variable for [WMAPDY]" warning. I read somewhere that sometimes that warning is useless. I also read that the program will not compile all the clauses because of the warning? …
NoobCoderChick
  • 616
  • 2
  • 18
  • 36
4
votes
1 answer

Cryptarithmetic puzzle (Prolog)

I was asked to write a Prolog code to solve the cryptarithmetic puzzle, using "generate and test". For example I get solve([R,O,B],[B,E,R,T],[N,O,R,E,S]) and I need to find an assign for the letters. So I wrote this code: sum(List1,List2,SumList)…
Ygandelsman
  • 383
  • 4
  • 15
3
votes
3 answers

Efficiency of Cryptarithmetic Algorithm solver decomposition

The problem is the following: Given "ABC+DEF=GHI" format string, where A,B,C etc. represent unique digits, find the expression that gives maximum GHI. Ex: Input string is AAB+AAB=AAB, then there's no solution. If it is instead AAA + BBB = AAA, a…
SenselessCoder
  • 1,135
  • 10
  • 23
3
votes
2 answers

Cryptarithmetic Multiplication Prolog

I have the grasp of the idea of crypt arithmetic and addition but I cannot figure out how to do a multiplication crypt arithmetic problem. It's simply TWO*SIX=TWELVE or something along those lines without the middle additional part of the…
user2318083
  • 557
  • 1
  • 7
  • 22
2
votes
1 answer

Prolog dot product with variables (constraint satisfaction)

I'm working on a prolog assignment and I'm currently very very close to the solution. So, the problem is a constraint satisfaction problem where I have to find values for a set of variables such that certain conditions are true. Specifically,…
Julie
  • 21
  • 1
1
2 3 4