-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rkt
52 lines (46 loc) · 2.08 KB
/
main.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#lang racket/base
(require "joueur/run.rkt"
racket/cmdline
racket/hash)
(define args (make-hash '((server . "localhost")
(port . "3000")
(player-name . "")
(player-id . 0)
(password . "")
(session-name . "*")
(game-settings . "")
(ai-settings . "")
(print-io . #f)
(game-name . ""))))
(run (command-line
#:program "Racket Client"
#:once-each
[("-s" "--server") server
"the url to the server you want to connect to e.g. localhost:3000"
(hash-set! args 'server server)]
[("-p" "--port") port
"the port to connect to on the server. Can be defined on the server arg via server:port"
(hash-set! args 'port port)]
[("-n" "--name") player-name
"the name you want to use as your AI's player name"
(hash-set! args 'player-name player-name)]
[("-i" "--index") player-id
"the player number you want to be, with 0 being the first player"
(hash-set! args 'player-id player-id)]
[("-w" "--password") password
"the password required for authentication on official servers"
(hash-set! args 'password password)]
[("-r" "--session") session-name
"the requested game session you want to play on the server"
(hash-set! args 'session-name session-name)]
[("-g" "--gameSettings") game-settings
"Any settings for the game server to force. Must be url params formatted (key=value&otherKey=otherValue)"
(hash-set! args 'game-settings game-settings)]
[("-a" "--aiSettings") ai-settings
"Any settings for the AI. Must be url params formatted (key=value&otherKey=otherValue)"
(hash-set! args 'ai-settings ai-settings)]
[("-d" "--printIO") "(debugging) print IO through the TCP socket to the terminal"
(hash-set! args 'print-io #t)]
#:args (game-name)
(hash-set! args 'game-name game-name)
args))