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

10
LINES

< > BotCompany Repo | #1017400 // ai_parseTree_makeTotalWeights - also sorts children

JavaX fragment (include)

1  
svoid ai_parseTree_makeTotalWeights(PTElement e, double weight) {
2  
  ping();
3  
  e.totalWeight = weight*e.weight;
4  
  
5  
  for (PTElement child : unnull(e.children))
6  
    ai_parseTree_makeTotalWeights(child, e.totalWeight);
7  
    
8  
  if (!e instanceof ChoosePart)
9  
    sortInPlaceByCalculatedFieldDesc(e.children, ai_parseTree_sortingFunction());
10  
}

Author comment

Began life as a copy of #1017398

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017400
Snippet name: ai_parseTree_makeTotalWeights - also sorts children
Eternal ID of this version: #1017400/15
Text MD5: c5a42e545eaeb91752f5906fa407c48f
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-13 16:57:51
Source code size: 345 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 345 / 403
Version history: 14 change(s)
Referenced in: [show references]