Skip to content

Commit 860618c

Browse files
(#2) fix X not being recognized as a direction character
1 parent 7408913 commit 860618c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

snake-ex.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -334,16 +334,20 @@ snakeEx.isClosure = function(token)
334334
{
335335
return token.type == this.TOK_SPECIAL && (token.token=='*'||token.token=='?'||token.token=='+'||token.token=='%');
336336
}
337+
338+
/// true if the specified string describes a direction or set of directions
337339
snakeEx.isDirection = function(str)
338340
{
339341
for (var c = 0; c < str.length; c++)
340342
{
341343
var ch = str.charAt(c);
342-
if (ch !== 'R' && ch !=='L' && ch != 'F' && ch != 'B' && ch != 'P' && ch != 'T')
344+
if (ch !== 'R' && ch !=='L' && ch != 'F' && ch != 'B' && ch != 'P' && ch != 'T' && ch != 'X')
343345
return false
344346
}
345347
return true;
346348
}
349+
350+
/// true if the specified special character describes a direction
347351
snakeEx.isSpecialDirection = function(str)
348352
{
349353
return str == '*' || str == '+' || str == '.'|| str == '!';

0 commit comments

Comments
 (0)