Skip to content

Commit 2110b42

Browse files
Parse drop
1 parent 2ce6d1d commit 2110b42

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

post.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ const testPgnCrazyhouse = `[Event "Casual Crazyhouse game"]
315315
1. d4 d5 2. Nf3 { D02 Queen's Pawn Game: Zukertort Variation } Bf5 3. e3 e6 4. Bd3 Bxd3 5. Qxd3 Nf6 6. B@g5 B@a6 7. Qd2 Ne4 8. Bxd8 Nxd2 9. Kxd2 Bb4+ 10. Nc3 Q@e2# { Black wins by checkmate. } 0-1`
316316

317317
//console.log("test", parsePgnFull(testPgnRacingKings))
318-
console.log("test", parsePgnFull(testPgnCrazyhouse))
318+
//console.log("test", parsePgnFull(testPgnCrazyhouse))
319319

320320
if(typeof module != "undefined"){
321321
module.exports = {

src/main/scala/ChessApp.scala

+15-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,21 @@ object ChessApp {
129129
}
130130
}
131131
case None => {
132-
errors :+= ("ill formatted uci " + uci)
132+
format.Uci(uci) match {
133+
case Some(drop) => {
134+
g(drop) match {
135+
case cats.data.Validated.Valid((ng, _)) => {
136+
g = ng
137+
}
138+
case cats.data.Validated.Invalid(why) => {
139+
errors :+= (uci + " invalid drop " + why)
140+
}
141+
}
142+
}
143+
case None => {
144+
errors :+= ("ill formatted uci " + uci)
145+
}
146+
}
133147
}
134148
}
135149
})

0 commit comments

Comments
 (0)