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).

// returns [<image id, piece name>]
// returns light & dark squares
static LPairS chessPieceImagesFromAGIBlue() {
  ret mapPairsA parseImageSnippetURL(filter(p -> isURL(p.a) && ai_chessPiecesSet().contains(p.b),
    agiBlue_pagesAndValuesForKey(agiBlue_chessPieceImagesSlice(), "is")));
}

// returns only light or dark squares
static LPairS chessPieceImagesFromAGIBlue(Bool lightSquares) {
  if (lightSquares == null) ret chessPieceImagesFromAGIBlue();
  LPairS raw = agiBlue_pagesAndValuesForKey(agiBlue_chessPieceImagesSlice(), "is");
  LPairS squares = agiBlue_pagesAndValuesForKey(agiBlue_chessPieceImagesSlice(), "was on square");
  Set<S> set = asSet(pairsA(filter(squares, p -> lightSquares == chess_isLightSquare(p.b))));
  LPairS filtered = filter(raw, p -> set.contains(p.a));
  ret mapPairsA parseImageSnippetURL(filtered);
}

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: 251 / 368
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1024704 - agiBlue_imagesForChessPiece