Talk:24 game/Solve: Difference between revisions

(→‎Ruby and checking for 0?: Will the Ruby code allow zero as a digit in its checking routine?)
(→‎Use 3 3 8 8 in example runs?: added some comments.)
 
(14 intermediate revisions by 8 users not shown)
Line 27:
==Ruby and checking for 0?==
Hi, will the Ruby code allow zero as a digit in its checking routine? --[[User:Paddy3118|Paddy3118]] 04:36, 25 November 2009 (UTC)
:Yes. It will also allow numbers greater than 9. --[[User:Glennj|glennj]] 14:20, 26 November 2009 (UTC)
 
==Clojure, generality, and new to Wiki==
Hello! This is my first Wiki edit, firstly, so I'd appreciate any format-related advice.
 
I implemented the Clojure version this very late night - what it currently lacks for complete generality are backwards-div and backwards-sub in its operation list and formatting function to make the two tree patterns completely generic to the problem. If there was an elegant, terse way to prevent the application of these on the first pattern, it'd be much nicer.. otherwise much duplicity will result. I wonder if anyone has better symmetry-elimination? Suggestions?
--[[User:Geva|Geva]] 04:04, 5 December 2009 (UTC)
: I don't know Clojure, but you might try posting the code to the page anyway, and add [[Template:In progress]]. --[[User:Short Circuit|Michael Mol]] 07:59, 5 December 2009 (UTC)
 
: Hi Geva and welcome :-)
: On the formatting - The aim is to have something produce an expression that a player of 24 could understand how to make 24 out of the given digits. You give more than one way, and the solutions look good enough to convince a player to me. --[[User:Paddy3118|Paddy3118]] 10:18, 5 December 2009 (UTC)
 
== Use 1 1 2 7 in example runs? ==
Hi, After finding out that the digits 1 1 2 and 7 ''need'' the use of two sets of brackets for its (infix) solution (see above), maybe all examples might like to show how they handle this case? --[[User:Paddy3118|Paddy3118]] 06:22, 6 January 2010 (UTC)
 
: The OCaml solution fails on this example as well as 2 2 5 7. --[[User:Andrew Gacek|Andrew Gacek]] 05:32, 27 July 2010 (UTC)
 
== Negating the first number? ==
I was thinking about making a solution for this in ABAP, and I was wondering if a negated first number is valid?
 
E.g.
-6 + 6 * 6 - 6
 
I realise 6 + 6 + 6 + 6 is an alternative solution for this, but I'm curious nonetheless.
--[[User:Rjf89|Rjf89]] 00:28, 6 January 2011 (UTC)
 
: Sounds fine to me, although thats leads to the question: "Is there a set of digits where a leading minus is necessary"? I don't think it is necessary - but do think it is allowed. --[[User:Paddy3118|Paddy3118]] 06:04, 26 January 2011 (UTC)
 
:: This leads to another question: what operations may be considered part of an [http://www.webopedia.com/TERM/A/arithmetic_expression.html arithmetic expression]?
::: wp mentions ''"Addition, subtraction, multiplication, or division, and sometimes other operations"'' so there are probably variants that use a different mix of operators, but our game specifically mentions just those first four. --[[User:Paddy3118|Paddy3118]] 21:23, 27 January 2011 (UTC)
 
== Use 3 3 8 8 in example runs? ==
I have just updated the Python example to use precise rational arithmatic whenever a division is involved as the solution with the digits 3 3 8 and 8 of 8 / (3 - 8 / 3) does not evaluate to 24 when using floating point. You might have to switch too (although the task description does not mandate this)! --[[User:Paddy3118|Paddy3118]] 06:00, 26 January 2011 (UTC)
 
: I just noticed that my REXX program also suffered the same weakness.   I have corrected the comparison logic and added support to find solutions for such numbers   (that needed rational arithmetic or something similar).   I also agree that '''3388''' should be one of   ''those''   numbers to be tested for program validation.     -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 09:22, 1 January 2019 (UTC)