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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
#!/bin/bash
# elimination script. Run it from the AA data directory.
# everytime.cfg needs to contain
# include everytime_trigger.cfg
# include everytime_fifo.cfg
# without the #, of course, where both files need to be fifos
# created with mkfifo.
set -x
function apply()
{
cat var/everytime_fifo_in.cfg > var/everytime_fifo.cfg
echo "" > var/everytime_fifo_in.cfg
}
function round_core()
{
multiplier=$1
limit=$2
echo TEAMS_MAX ${limit}
echo FORTRESS_CONQUERED_SCORE $(( 60 * ${multiplier} ))
echo SCORE_WIN 0
echo SCORE_SUICIDE $(( -30 * ${multiplier} ))
echo SCORE_KILL $(( 30 * ${multiplier} ))
echo SCORE_DIE 0
echo SP_SCORE_WIN 0
echo LIMIT_SCORE 1000000
echo SP_LIMIT_SCORE 1000000
echo LIMIT_ROUNDS 200
echo SP_LIMIT_ROUNDS 200
}
function round()
{
if test $3 = 1; then
echo SAY $2 players, score multiplier $1, elimination next round. >> var/everytime_fifo.cfg
else
echo SAY $2 players, score multiplier $1, $3 rounds to next elimination. >> var/everytime_fifo.cfg
fi
round_core $* >> var/everytime_fifo.cfg
echo "#nop" >> var/everytime_trigger.cfg
}
# minutes left to start of next tournament
function minutes()
{
onehour=$(( 62 - $( date +%M | sed -e s/^0// ) ))
test ${onehour} -ge 32 && onehour=$(( ${onehour} - 30 ))
echo ${onehour}
}
while true; do
start=$(minutes)
test ${start} -ge 27 && start=27
while test ${start} -ge $(minutes) ; do
echo "#NOP" >> var/everytime_trigger.cfg
# check for AIs
echo SAY $(minutes) minutes to next elimination tournament. >> var/everytime_fifo_in.cfg
if grep "Armagetron.*AI team" var/players.txt > /dev/null; then
#echo SAY AIS! >> var/everytime_fifo_in.cfg
echo include singleplayer.cfg >> var/everytime_fifo_in.cfg
else
#echo SAY NO AIS! >> var/everytime_fifo_in.cfg
echo include multiplayer.cfg >> var/everytime_fifo_in.cfg
fi
apply
done
echo SAY Starting elimination next round. >> var/everytime_trigger.cfg
echo include multiplayer.cfg >> var/everytime_fifo_in.cfg
echo LIMIT_ROUNDS 1 >> var/everytime_fifo_in.cfg
echo SP_LIMIT_ROUNDS 1 >> var/everytime_fifo_in.cfg
echo START_NEW_MATCH >> var/everytime_fifo_in.cfg
apply
echo "#NOP" >> var/everytime_trigger.cfg
players=$(wc -l var/players.txt | awk "{ print \$1 - 1; }" )
if ${players} == 4; then
players=$( | grep -v "AI team" var/players.txt | wc -l | awk "{ print \$1 - 1; }" )
fi
if test $players -gt 12; then
round 1 16 3
round 1 16 2
round 1 16 1
fi
if test $players -gt 8; then
round 3 12 3
round 3 12 2
round 3 12 1
fi
if test $players -gt 4; then
round 5 8 3
round 5 8 2
round 5 8 1
fi
if test $players -gt 2; then
round 11 4 4
round 11 4 3
round 11 4 2
round 11 4 1
fi
if test $players -gt 1; then
round 19 2 5
round 19 2 4
round 19 2 3
round 19 2 2
round 19 2 1
round_core 1 1 1 >> var/everytime_fifo.cfg
echo Say Victory Dance Time! >> var/everytime_fifo.cfg
echo "#NOP" >> var/everytime_trigger.cfg
round_core 1 16 1 >> var/everytime_fifo_in.cfg
echo LIMIT_ROUNDS 10 >> var/everytime_fifo_in.cfg
echo SP_LIMIT_ROUNDS 10 >> var/everytime_fifo_in.cfg
echo include autoexec.cfg >> var/everytime_fifo_in.cfg
fi
apply
done
|