5 ms·
I thought the game was cool so I built a little version of it here: https://blaise.gg/number_game/index.html https://blaise.gg/number_game/index.html
by sour-taste 3y ago
I thought the game was cool so I built a little version of it here:
https://blaise.gg/number_game/index.html https://blaise.gg/number_game/index.html
- Bewelge 3y agoThought the same, you beat me to it! Really like the tree-like view, might steal that idea later :-) https://bewelge.github.io/aNumberGame/ https://bewelge.github.io/aNumberGame/ (does not format well on mobile) Code: https://github.com/Bewelge/aNumberGame https://github.com/Bewelge/aNumberGame
- madcaptenor 3y agoI like that all possible moves are shown at once. Would it be possible to have the sequence be other than [7, 5, 3]?
- Bewelge 3y agoI added an url parameter so you can load it up with any sequence. Example for sequence 5,2,7 https://bewelge.github.io/aNumberGame?seq=5,2,7 https://bewelge.github.io/aNumberGame?seq=5,2,7
- madcaptenor 3y agoThanks!
- dangond 3y agoFun implementation! There's currently a bug that allows the same number to appear twice after a combination step (I was able to perform 2,3,7,5->5,7,5)
- madcaptenor 3y agoRan into this as well: I did [8, 1, 4] -> [5, 3, 1, 4] -> [5, 3, 5].
- sour-taste 3y agoShould be fixed, thanks for the report.
- glenjamin 3y agoThis is neat, but your implementation does seem to allow duplicates sometimes
- sour-taste 3y agoShould be fixed now, sorry for trouble.
- minikomi 3y agoJumping in with my janky version: http://poyo.co/list-of-integers/ http://poyo.co/list-of-integers/
- fragmede 3y agoI really like the visual aspect of your implementation
- b3orn 3y agoInteresting, it appears I've encountered an impossible combination of numbers: [2, 5, 1, 3] The only possible move is to add 1 and 3. Can't ever split a 2 as that would result in [1, 1], can't split the 5 because that would be [4, 1] or [3, 2], can't split the 3, as that would be [2, 1] or [1, 2], can't add the 5 to anything as that would be larger than 5.
- deleted 3y ago[deleted]
- kleiba 3y agoCouldn't you split 3 into [4,-1] ?
- b3orn 3y agoNone of the implementations support negative numbers, but the rules say integer which includes negative numbers, so that should be a legal move.
- Tao3300 3y agoNegative numbers would break the game by making the number of possible splits infinite. E.g. 1 could split into [-2, 3], [-3, 4], [-4, 5], etc. It also violates Rule 1 because one of the splits is larger than the original number.
- basil-rash 3y agoRules say you can’t ever produce a number greater than the original largest number, so the possibilities will always be finite. (fixed number of ways to make a list of distinct integers that sum to N such that all values are <=M).
- kleiba 3y agoYou're right in the first sentence, but you're second sentence if we're talking about splitting the largest original number itself that way.
- spywaregorilla 3y agoGave me [2,1] which is not possible
- jxding 3y agoIt does seem like [n,n+1] is always unsolvable!
- ahahahahah 3y ago[9,8] -> [6,3,8] -> [6,2,1,8] -> [6,2,9] -> [8,9]
- klyrs 3y agoIndeed, [n, n-1] [n-3, 3, n-1] [n-3, 2, 1, n-1] [n-3, 2, n] [n-1, n] Works for all n greater than... 6?
- klyrs 3y agoOptimizing self-response! That fails for six because n-3 and 3 co-occur. With a slight modification we can make it work for all n>5 [n, n-1] [2, n-2, n-1] [2, n-3, 1, n-1] [2, n-3, n] [n-1, n] edit: and it's not hard to show that n<6 are impossible, so the solution above is optimal in that sense.
- deleted 3y ago[deleted]
- adotbacon 3y agoYeah, the [n,n+1] is only a problem when there isn't enough wiggle room between the numbers. ex: [2,3] and [3,4] [3,4] --> [1,2,4] --> 4 can't split because 2/2 and 3/1 are invalid --> 4 can't initially split because 2/2 and 3/1 are both invalid [5,6] --> [5,4,2] --> [5,1,3,2] --> [6,3,2] --> [6,5] [7,8] --> [7,3,5] --> [7,1,2,5] --> [8,2,5] --> [8,7] When you add more numbers, you need more wiggle room. So, [4,5,6] is problematic and probably [5,6,7]. [4,5,6] --> [3,1,5,6] --> 6 can't break into 3, nor 5/1. It can do 4/2, but then 5 can't split. 5 also can't split. --> [4,2,3,6] --> [4,2,3,1,5] --> [6,4,5] --> 4 can't split into 2/2. It can split to 3/1 but then 5 can't split --> 6 can't initially split at all because 3/3, 4/2, and 5/1 are invalid Even if [6,7,8] has a solution, I'm sure [6,7,8,9] does not.
- mywittyname 3y agoWould be nice if you allowed users to define their own puzzle. I had to set a break point at the right location and call startNew([..my array]) to do so.
- sour-taste 3y agoAdded, you can use ?numbers=1~2~3 to specify your puzzle. Like this: https://blaise.gg/number_game/index.html?numbers=1%7E4%7E6%7E5 https://blaise.gg/number_game/index.html?numbers=1%7E4%7E6%7...
- IshKebab 3y agoNice. It does let me make the same integer twice though.
- sour-taste 3y agoShould be fixed now, sorry for trouble.
- joelthelion 3y agoI think it would be more fun if you only displayed problems that are solvable.
- sour-taste 3y agoYeah, I would but finding such puzzles is kind of hard. Might look into it this weekend
- joelthelion 3y agoI'm sure we could write a brute force tester, and then you would only have to include a list in your webapp. Or harvest people's results
- raverbashing 3y agoCool! Though I say the rule about repeated numbers is a bummer. I can see things might get easier (also it might be a more procedurally easy problem to solve) if this is allowed Basically I don't think it's a "productive" complication
- two-star 3y agoWithout that rule, you could decompose everything into 1's, and then recompose from there. Not the most efficient solution, but a boring one that always exists.
- raverbashing 3y agoOk so how about allowing only non contiguous repeated numbers