This code illustrates my blog, where I show an application which gives solutions in a math game.
The rules are
- There are given two sets of integers (each element > 0).
- Between elements in each set a math is performed (+, -, *, /) respecting mathematical operators precedence.
- So, two sets of expressions are formed.
- Order of elements can not be changed.
- Element can be joined to create new number.
- Each intermediate operation gives integer result. Division operation gives no remaining.
- Task is: Find pairs of expressions which give true equation.
Set 1: 1, 2, 1
Set 2: 1, 2
Results:
- 1 - 2 * 1 = 1 - 2 = -1
- 1 - 2 / 1 = 1 - 2 = -1
- 1 + 2 - 1 = 1 * 2 = 2
- 1 * 2 * 1 = 1 * 2 = 2
- 1 * 2 / 1 = 1 * 2 = 2
- 1 + 2 * 1 = 1 + 2 = 3
- 1 + 2 / 1 = 1 + 2 = 3
- 1 * 2 + 1 = 1 + 2 = 3
- 12 * 1 = 12 = 12
- 12 / 1 = 12 = 12
The application on Github is following my blog. I'm creating it in steps. So, it may not be running app, yet.
But you can play with running application here. Give Azure up to 4 minutes to recovery in case if app is detached.
Currently the app has no validation and in case of wrong input you may need to reload.