Solving the DMC Challenge “CrackTheCode” with JavaSolver

The Sep-2019 DMC Challenge “CrackTheCode” is a simple puzzle. We need to crack a 3 digit code based on these hints:

682 – one number is correct and in the correct position
645 – one number is correct but in the wrong position
206 – two numbers are correct but in the wrong positions
738 – nothing is correct
780 – one number is correct but in the wrong position.

It is easy to solve it using common sense in Sudoku-like style by removing impossible numbers as we consider all constraints one by one.  But after looking at the solution provided by Alex Fleischer who applied IBM CPLEX, I could not resist a temptation to do it with a free open-sourced JavaSolver. Here is my solution:

Here are the execution results:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.