Maybe
(setq a (getreal "\n Select a: "))
(setq b (getreal "\n Select b: "))
(setq c (getreal "\n Select c: "))
(setq d (getreal "\n Select d: "))
(setq lst (list a b c d))
......
^_^
Maybe
(setq a (getreal "\n Select a: "))
(setq b (getreal "\n Select b: "))
(setq c (getreal "\n Select c: "))
(setq d (getreal "\n Select d: "))
(setq lst (list a b c d))
......
^_^
I'm thinking it needs to be 4 randomly choosen (by computer) cards out of a deck of playing cards, whose options are constantly changing to cards already delt...
Sorry i don't understand the rule math24 .
Can u tell me ?
(defun RFL:MATH24 (NUMLIST / A B C D FCTN FCTN1 FCTN2 FCTN3 FCTN4 RES STR)
(defun FCTN (STR) (eval (read STR)))
(foreach A '(0 1 2 3)
(foreach B '(0 1 2 3)
(if (/= A B)
(foreach C '(0 1 2 3)
(if (and (/= C B) (/= C A))
(foreach D '(0 1 2 3)
(if (and (/= D C) (/= D B) (/= D A))
(foreach FCTN3 (list "+" "-" "*" "/")
(foreach FCTN2 (list "+" "-" "*" "/")
(foreach FCTN1 (list "+" "-" "*" "/")
(setq STR (strcat "(" FCTN1 " " (rtos (nth A NUMLIST)) " (" FCTN2 " " (rtos (nth B NUMLIST)) " (" FCTN3 " " (rtos (nth C NUMLIST)) " " (rtos (nth D NUMLIST)) ")))"))
(setq RES (vl-catch-all-apply 'FCTN (list STR)))
(if (and (not (vl-catch-all-error-p RES)) (= RES 24)) (print STR))
)
)
)
)
)
)
)
)
)
)
(print "Done!")
)
"(* 2.0 (+ 3.0 (+ 4.0 5.0)))"
"(* 2.0 (+ 3.0 (+ 5.0 4.0)))"
"(* 2.0 (+ 4.0 (+ 3.0 5.0)))"
"(* 2.0 (+ 4.0 (+ 5.0 3.0)))"
"(* 2.0 (+ 5.0 (+ 3.0 4.0)))"
"(* 2.0 (+ 5.0 (+ 4.0 3.0)))"
"(* 4.0 (- 3.0 (- 2.0 5.0)))"
"(* 4.0 (+ 3.0 (- 5.0 2.0)))"
"(* 4.0 (- 5.0 (- 2.0 3.0)))"
"(* 4.0 (+ 5.0 (- 3.0 2.0)))"
"Done!"