Skip to content

Commit

Permalink
Maybe this is best order
Browse files Browse the repository at this point in the history
  • Loading branch information
rooklift committed Feb 8, 2024
1 parent ced19b3 commit 16135fa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions files/src/renderer/40_position.js
Original file line number Diff line number Diff line change
Expand Up @@ -747,14 +747,20 @@ const position_prototype = {

parse_pgn: function(s) { // Returns a UCI move and an error message.

// Replace fruity dash characters with proper ASCII dash "-"

for (let n of [8208, 8210, 8211, 8212, 8213, 8722]) {
s = ReplaceAll(s, String.fromCodePoint(n), "-");
}

// If the string contains any dots it'll be something like "1.e4" or "...e4" or whatnot...

let lio = s.lastIndexOf(".");
if (lio !== -1) {
s = s.slice(lio + 1);
}

// At this point, if s was actually a UCI string (which it would never be in real PGN) we can return it.
// At this point, if s is actually a UCI string (which it won't be in real PGN) we can return it.
// This is a hack to allow pasting of stuff from non-PGN sources I guess...

if (s.length === 4 || (s.length === 5 && ["q", "r", "b", "n"].includes(s[4]))) {
Expand All @@ -770,12 +776,6 @@ const position_prototype = {
}
}

// Replace fruity dash characters with proper ASCII dash "-"

for (let n of [8208, 8210, 8211, 8212, 8213, 8722]) {
s = ReplaceAll(s, String.fromCodePoint(n), "-");
}

// Delete things we don't need...

s = ReplaceAll(s, "x", "");
Expand Down

0 comments on commit 16135fa

Please sign in to comment.