-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdll_globals
85 lines (75 loc) · 1.42 KB
/
dll_globals
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
#! /bin/bash
# version for About screen
version="____v1.3.1"
# version for Main menu screen
version_menu="v1.3.1"
letters="a b c d e f g h j k"
True=1
False=0
InitVars()
{
Current="AI" # who is current player, human or AI.
Player1="Human" # "Human"
Player2="AI" # "AI"
P1Shots=0 # qtty of shots in Player 1
P2Shots=0 #
P1Hits=0 # qtty of hits in Player 1
P2Hits=0 #
P1Ships_down=0 # qtty of ships of player 1 on the bottom.
P2Ships_down=0 #
Now_Shooting=2 # if "1", then shoot in Player1.
Shot="a0" #
Last_Shot="a0" # if 'a0' - last shot wasn't good,
# if any other e.g. b7 - last hitted ship.
Prev_Shot="a0" # Shot before last.
P1Last_Shot="a0"
P1Prev_Shot="a0"
P2Last_Shot="a0"
P2Prev_Shot="a0"
HotSeat="Yes"
First_Shot="true"
hit=1
BotMode="No"
P1AI_random_shots=0;
P2AI_random_shots=0;
level=4; #1, 2, 3, 4#
}
#################
#1 - empty #
#2 - ship #
#3 - round ship #
#4 - shotdone #
#5 - shiphitted #
#6 - shipdown #
#################
########################
SetMatrixValue()
{
player=$1
letter=$2
row=$3
value=$4
SetValue `eval echo "$player"$letter$row` $value
}
########################
GetMatrixValue()
{
player=$1
letter=$2
row=$3
GetValue `eval echo "$player"$letter$row`
}
########################
GetValue()
{
# $1 - variable name, not value.
echo `eval echo "$"$1`
}
########################
SetValue()
{
# $1 - variable name
# $2 - value
eval "$1"="$2"
}
########################