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

10
LINES

< > BotCompany Repo | #1014955 // varyPoint (varyPt)

JavaX fragment (include)

1  
static Pt varyPoint(Pt p, int w, int h) {
2  
  ret tossACoin() ? randomPoint(w, h) : varyPoint(p, 10);
3  
}
4  
5  
static Pt varyPoint(Pt p, int range) {
6  
  range = max(range, 1);
7  
  ret new Pt(
8  
    random_incl(p.x-range, p.x+range),
9  
    random_incl(p.y-range, p.y+range));
10  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1014955
Snippet name: varyPoint (varyPt)
Eternal ID of this version: #1014955/3
Text MD5: 3de8e23dba7181560f787bb92d76516f
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-13 05:36:57
Source code size: 272 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 362 / 418
Version history: 2 change(s)
Referenced in: [show references]