Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ceddral
fahrradwurstmond
Commits
9412e7b0
Commit
9412e7b0
authored
Sep 17, 2021
by
ceddral
Browse files
pieces: change encoding to distinguish specials
pennants, inns, cathedrals
parent
3fbcacbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
board.go
View file @
9412e7b0
...
...
@@ -45,6 +45,14 @@ const (
fTower
FType
=
't'
)
type
FSpecial
byte
const
(
fPennant
FSpecial
=
'p'
fInn
FSpecial
=
'i'
fCathedral
FSpecial
=
'c'
)
type
Field
struct
{
preRendered
[]
byte
t
FType
...
...
@@ -57,6 +65,7 @@ type Field struct {
type
Piece
struct
{
f
[][][]
Field
// 'graphic' representation [rotation][row][col]
fieldIdToType
map
[
byte
]
FType
fieldIdToSpecial
map
[
byte
][]
FSpecial
copies
int
}
...
...
@@ -515,10 +524,13 @@ func readpieces(filename string) (pieces []Piece, err error) {
}
row
=
0
curPiece
.
fieldIdToType
=
make
(
map
[
byte
]
FType
)
curPiece
.
fieldIdToSpecial
=
make
(
map
[
byte
][]
FSpecial
)
meta
:=
strings
.
Split
(
s
.
Text
(),
" "
)
curPiece
.
fieldIdToType
[
'X'
]
=
fFarm
for
i
,
c
:=
range
[]
byte
(
meta
[
0
])
{
curPiece
.
fieldIdToType
[
byte
(
i
)
+
'0'
]
=
FType
(
c
)
id
:=
byte
(
i
)
+
'0'
curPiece
.
fieldIdToType
[
id
]
=
FType
(
c
)
curPiece
.
fieldIdToSpecial
[
id
]
=
make
([]
FSpecial
,
0
)
}
curPiece
.
copies
,
err
=
strconv
.
Atoi
(
meta
[
1
])
if
err
!=
nil
{
...
...
@@ -541,7 +553,16 @@ func readpieces(filename string) (pieces []Piece, err error) {
}
fields
[
x
]
.
preRendered
=
tg
.
RenderBlock
(
fg
,
typeBG
[
fields
[
x
]
.
t
],
fields
[
x
]
.
c
,
^
tg
.
TermUnderline
,
^
tg
.
TermBold
)
}
else
{
fields
[
x
]
.
placeable
=
c
!=
'_'
&&
c
!=
'*'
if
c
==
'_'
{
continue
}
id
:=
fields
[
x
]
.
id
if
c
==
id
{
fields
[
x
]
.
placeable
=
true
continue
}
sm
:=
curPiece
.
fieldIdToSpecial
sm
[
id
]
=
append
(
sm
[
id
],
FSpecial
(
c
))
}
}
rotation
++
...
...
pieces.base
View file @
9412e7b0
...
...
@@ -11,17 +11,17 @@ bm 4
00100 + __1__00100 + __1__00100 + __1__00100 + __1__
00000 _____00000 _____00000 _0___00000 ___0_
r 1
00000*
*
____00000 _____00000 _____00000 *____
*
00000*
p
____00000 _____00000 _____00000 *____
p
00000 __0__00000 __0__00000 __0__00000 __0__
00000 _____00000*
*
____00000 *____
*
00000 _____
00000 _____00000*
p
____00000 *____
p
00000 _____
br 5
01110 __1__10000 _____00000 _____00001 _____
00000 ___0_11000 1_0__00000 _0___00011 __0_1
00000 _____10000 _____01110 __1__00001 _____
rbb 2
01110 __1__10002 * __
*
__02220 __2__20001 __0__
00000 *0___
*
11022 1___200000*
*
___022011 2___1
02220 __2__10002 __0__01110 __1__20001 * __
*
__
01110 __1__10002 * __
p
__02220 __2__20001 __0__
00000 *0___
p
11022 1___200000*
p
___022011 2___1
02220 __2__10002 __0__01110 __1__20001 * __
p
__
brb 1
01112 _____12221 __2__21110 __1__10001 __0__
00122 0___211111 1____22100 2___011111 ____1
...
...
@@ -47,33 +47,33 @@ bwbrwbw 3
44X33--| _4__311X66--v--_1_6_33X44 |--3__4_66X11--^--_6_1_
55623 | 5_6__00455 | 0_4_532100 | _21_023332 __3_2
rb 2
00001*
*
____01111 _____11110 _____10000 *____
*
00001*
p
____01111 _____11110 _____10000 *____
p
00111 _0_1_00111 _0_1_11100 _1_0_11100 _1_0_
01111 _____00001*
*
____10000 *____
*
11110 _____
01111 _____00001*
p
____10000 *____
p
11110 _____
rb 3
00001 _____01111 _____11110 _____10000 _____
00111 _0_1_00111 _0_1_11100 _1_0_11100 _1_0_
01111 _____00001 _____10000 _____11110 _____
rbwb 2
00001*
*
___101233 | ____333210 | 3____10000 *1___
*
00001*
p
___101233 | ____333210 | 3____10000 *1___
p
00222 .--_0_2_00222 '--_0_2_22200--' _2_0_22200--. _2_0_
01233 | ____300001*
*
___110000 *1___
*
33210 | 3____
01233 | ____300001*
p
___110000 *1___
p
33210 | 3____
rbwb 3
00001 ____101233 | ____333210 | 3____10000 1____
00222 .--_0_2_00222 '--_0_2_22200--' _2_0_22200--. _2_0_
01233 | ____300001 ____110000 1____33210 | 3____
rb 1
00000*
*
__0_00001 _0___01110 __1__10000 *____
*
00000*
p
__0_00001 _0___01110 __1__10000 *____
p
00000 _____00011 ____100000 _____11000 1____
01110 __1__00001*
*
____00000 *_0__
*
10000 ___0_
01110 __1__00001*
p
____00000 *_0__
p
10000 ___0_
rb 3
00000 ___0_00001 _0___01110 __1__10000 _____
00000 _____00011 ____100000 _____11000 1____
01110 __1__00001 _____00000 _0___10000 ___0_
rbwb 2
00000*
*
__0_00003 _0__303210 | _321_10000 *1___
*
00000*
p
__0_00003 _0__303210 | _321_10000 *1___
p
00000 _____00022 --____200000 _____22000-- 2____
01230 | _123_00001*
*
___100000 *_0__
*
30000 3__0_
01230 | _123_00001*
p
___100000 *_0__
p
30000 3__0_
rbwb 1
00000 ___0_00003 _0__303210 | _321_10000 1____
00000 _____00022 --____200000 _____22000-- 2____
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment