Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1024687 // chessPieceImagesFromAGIBlue

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4262L/28K).

1  
// returns [<image id, piece name>]
2  
// returns light & dark squares
3  
static LPairS chessPieceImagesFromAGIBlue() {
4  
  ret mapPairsA parseImageSnippetURL(filter(p -> isURL(p.a) && ai_chessPiecesSet().contains(p.b),
5  
    agiBlue_pagesAndValuesForKey(agiBlue_chessPieceImagesSlice(), "is")));
6  
}
7  
8  
// returns only light or dark squares
9  
static LPairS chessPieceImagesFromAGIBlue(Bool lightSquares) {
10  
  if (lightSquares == null) ret chessPieceImagesFromAGIBlue();
11  
  LPairS raw = agiBlue_pagesAndValuesForKey(agiBlue_chessPieceImagesSlice(), "is");
12  
  LPairS squares = agiBlue_pagesAndValuesForKey(agiBlue_chessPieceImagesSlice(), "was on square");
13  
  Set<S> set = asSet(pairsA(filter(squares, p -> lightSquares == chess_isLightSquare(p.b))));
14  
  LPairS filtered = filter(raw, p -> set.contains(p.a));
15  
  ret mapPairsA parseImageSnippetURL(filtered);
16  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024687
Snippet name: chessPieceImagesFromAGIBlue
Eternal ID of this version: #1024687/6
Text MD5: b23a281a39761dd2a9a6e7702e088851
Transpilation MD5: 2950f1c555de16c47b2651c9819348ff
Author: stefan
Category: javax / agi.blue
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-29 17:41:04
Source code size: 852 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 252 / 371
Version history: 5 change(s)
Referenced in: [show references]