1 USING: help.markup help.syntax math kernel ;
5 { $description "Starts the game!" }
11 "Commands: { + - * / rot swap q }\n"
14 "Commands: { + - * / rot swap q }\n"
17 "Commands: { + - * / rot swap q }\n"
20 "Commands: { + - * / swap q }\n"
26 HELP: 24-able ( -- vector )
27 { $values { "vector" "vector of 4 integers" } }
29 "Produces a vector with 4 integers. With the following condition: "
30 "If these integers were directly on the stack, one can process them into 24, "
31 "just using the provided commands and the 4 numbers. The Following are the "
33 { $link + } ", " { $link - } ", " { $link * } ", "
34 { $link / } ", " { $link swap } ", and " { $link rot } "."
38 "USING: 24-game kernel sequences prettyprint ;"
39 "24-able length 4 = ."
42 { $notes { $link 24-able? } " is used in " { $link 24-able } "." }
45 HELP: 24-able? ( quad -- t/f )
47 { "quad" "vector of 4 integers" }
51 "Tells if it is possible to win 24-game if it was initiated "
55 HELP: build-quad ( -- array )
57 { "array" "an array of 4 numbers" }
59 { $description "Builds an array of 4 random numbers." } ;
60 ARTICLE: "24-game" "The Game of 24"
61 "A classic math game, where one attempts to create 24, by applying "
62 "arithmetical operations and some shuffle words to a stack of 4 numbers. "
63 { $subsection play-game }
64 { $subsection 24-able }
65 { $subsection 24-able? }
66 { $subsection build-quad } ;