-
Notifications
You must be signed in to change notification settings - Fork 0
/
sim
executable file
·31 lines (24 loc) · 993 Bytes
/
sim
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
#!/usr/bin/env escript
%%! -smp enable -sname factorial -mnesia debug verbose -pa ebin/ jiffy/ebin/ +P 134217727
main([ConfFileName, OutputDir]) ->
%% still need to extract all of this in the ants_app
%% because need to set cell initial states easily
Conf = sim_config:from_file(ConfFileName),
Xmax = sim_config:xmax(Conf),
Ymax = sim_config:ymax(Conf),
NumAnts = sim_config:numants(Conf),
Runtime = sim_config:runtime(Conf),
io:format("Starting simulation ~p~n", [os:timestamp()]),
io:format("Xmax: ~p~n", [Xmax]),
io:format("Ymax: ~p~n", [Ymax]),
io:format("NumAnts: ~p~n", [NumAnts]),
io:format("Runtime: ~p~n", [Runtime]),
A = ants_app:start(ConfFileName, OutputDir),
io:format("Starting timer~n"),
timer:sleep(Runtime * 1000),
io:format("Time's up~n"),
ants_app:stop(A),
io:format("Simulation done ~p~n", [os:timestamp()]);
main(_) -> usage().
usage() ->
io:format("usage: sim ConfFileName OutputDir~n").