56
56
message_template = """[◕ _ ◕]^*
57
57
58
58
I attempted to generate a [chessboard layout]({unaligned_fen_img_link}) from the posted image,
59
- with a certainty of **{certainty:.4f }%**. *{pithy_message}*
59
+ with a certainty of **{certainty:.3f }%**. *{pithy_message}*
60
60
61
- * Link to [Lichess Analysis]({lichess_analysis})[^( Inverted)]({inverted_lichess_analysis}) - {to_play_full} to play
62
- * FEN: `{fen}`
61
+ White to play : [Analysis]({lichess_analysis_w}) | [Editor]({lichess_editor_w})
62
+
63
+ * `{fen_w}`
64
+
65
+ Black to play : [Analysis]({lichess_analysis_b}) | [Editor]({lichess_editor_b})
66
+
67
+ * `{fen_b}`
68
+
69
+ > ▼ Links for when pieces are inverted on the board:
70
+ >
71
+ > *White to play : [Analysis]({inverted_lichess_analysis_w}) | [Editor]({inverted_lichess_editor_w})*
72
+ >
73
+ > ^(`{inverted_fen_w}`)
74
+ >
75
+ > *Black to play : [Analysis]({inverted_lichess_analysis_b}) | [Editor]({inverted_lichess_editor_b})*
76
+ >
77
+ > ^(`{inverted_fen_b}`)
63
78
64
79
---
65
80
66
81
^(Yes I am a machine learning bot | )
67
82
[^(`How I work`)](http://github.com/Elucidation/tensorflow_chessbot 'Must go deeper')
68
- ^( | Reply with a corrected FEN or )[^(Editor)]({lichess_editor})
69
- ^(/)[^( Inverted)]({inverted_lichess_editor})^( to add to my next training dataset)
83
+ ^( | Reply with a corrected FEN to add to my next training dataset)
70
84
71
85
"""
72
86
@@ -90,21 +104,31 @@ def generateMessage(fen, certainty, side):
90
104
# Things that don't rely on black/white to play
91
105
# FEN image link is aligned with screenshot, not side to play
92
106
vals ['unaligned_fen_img_link' ] = 'http://www.fen-to-image.com/image/30/%s.png' % fen
93
- vals ['certainty' ] = certainty * 100 # to percentage
107
+ vals ['certainty' ] = certainty * 100.0 # to percentage
94
108
vals ['pithy_message' ] = getPithyMessage (certainty )
95
109
96
- vals ['to_play_full' ] = 'White'
97
110
if side == 'b' :
98
111
# Flip FEN if black to play, assumes image is flipped
99
- vals ['to_play_full' ] = 'Black'
100
112
fen = invert (fen )
101
113
114
+ inverted_fen = invert (fen )
115
+
102
116
# Fill out template and return
103
- vals ['fen' ] = fen
104
- vals ['lichess_analysis' ] = 'http://www.lichess.org/analysis/%s_%s' % (fen , side )
105
- vals ['lichess_editor' ] = 'http://www.lichess.org/editor/%s_%s' % (fen , side )
106
- vals ['inverted_lichess_analysis' ] = 'http://www.lichess.org/analysis/%s_%s' % (invert (fen ), side )
107
- vals ['inverted_lichess_editor' ] = 'http://www.lichess.org/editor/%s_%s' % (invert (fen ), side )
117
+ vals ['fen_w' ] = "%s w - -" % fen
118
+ vals ['fen_b' ] = "%s b - -" % fen
119
+ vals ['inverted_fen_w' ] = "%s w - -" % inverted_fen
120
+ vals ['inverted_fen_b' ] = "%s b - -" % inverted_fen
121
+
122
+ vals ['lichess_analysis_w' ] = 'http://www.lichess.org/analysis/%s_w' % (fen )
123
+ vals ['lichess_analysis_b' ] = 'http://www.lichess.org/analysis/%s_b' % (fen )
124
+ vals ['lichess_editor_w' ] = 'http://www.lichess.org/editor/%s_w' % (fen )
125
+ vals ['lichess_editor_b' ] = 'http://www.lichess.org/editor/%s_b' % (fen )
126
+
127
+ vals ['inverted_lichess_analysis_w' ] = 'http://www.lichess.org/analysis/%s_w' % (inverted_fen )
128
+ vals ['inverted_lichess_analysis_b' ] = 'http://www.lichess.org/analysis/%s_b' % (inverted_fen )
129
+ vals ['inverted_lichess_editor_w' ] = 'http://www.lichess.org/editor/%s_w' % (inverted_fen )
130
+ vals ['inverted_lichess_editor_b' ] = 'http://www.lichess.org/editor/%s_b' % (inverted_fen )
131
+
108
132
return message_template .format (** vals )
109
133
110
134
# Add a little message based on certainty of response
0 commit comments