@@ -4,28 +4,34 @@ import ArgumentParser
44/// Entry point for the command-line tool.
55@main
66struct GameGenerator : AsyncParsableCommand {
7- static let configuration = CommandConfiguration ( abstract: " Finds Fourtile games and streams the output as JSON, for use in the Fourtile web game. " ,
8- discussion: """
9- This game attempts to find as many Fourtile games as possible. Games are
10- streamed in JSON format to stdout or a file. Games are found using a randomized
11- heuristic, so there is no guarantee that every possible game will be found. This
12- is why games are streamed to stdout as they are found: Finding each next game
13- becomes computationally more expensive as more randomizations are required.
14-
15- It is the intention that the user will abort this script when the time to find
16- the next game becomes unreasonable, and the user is satisfied with the number
17- of games found. The only required step is then to clean up the end of the JSON
18- file.
19-
20- When writing games to a file, stdout is used to show a progress indicator, which
21- is normalized to the theoretical maximum number of possible games.
22- """ ,
23- version: " 1.0.0 " )
24-
25- @Option ( name: . shortAndLong, help: " The text file containing dictionary words. " , completion: . file( extensions: [ " txt " ] ) , transform: { URL ( fileURLWithPath: $0) } )
7+ static let configuration = CommandConfiguration (
8+ abstract: " Finds Fourtile games and streams the output as JSON, for use in the Fourtile web game. " ,
9+ discussion: """
10+ This game attempts to find as many Fourtile games as possible. Games are
11+ streamed in JSON format to stdout or a file. Games are found using a randomized
12+ heuristic, so there is no guarantee that every possible game will be found. This
13+ is why games are streamed to stdout as they are found: Finding each next game
14+ becomes computationally more expensive as more randomizations are required.
15+
16+ It is the intention that the user will abort this script when the time to find
17+ the next game becomes unreasonable, and the user is satisfied with the number
18+ of games found. The only required step is then to clean up the end of the JSON
19+ file.
20+
21+ When writing games to a file, stdout is used to show a progress indicator, which
22+ is normalized to the theoretical maximum number of possible games.
23+ """ ,
24+ version: " 1.0.0 " )
25+
26+ @Option ( name: . shortAndLong,
27+ help: " The text file containing dictionary words. " ,
28+ completion: . file( extensions: [ " txt " ] ) ,
29+ transform: { URL ( filePath: $0, directoryHint: . notDirectory) } )
2630 var dictionary : URL
2731
28- @Option ( name: . shortAndLong, help: " The JSON file to write game data to. " , transform: { URL ( fileURLWithPath: $0) } )
32+ @Option ( name: . shortAndLong,
33+ help: " The JSON file to write game data to. " ,
34+ transform: { URL ( filePath: $0, directoryHint: . notDirectory) } )
2935 var output : URL ? = nil
3036
3137 /// Entry point for the command line tool.
0 commit comments