PageSourceSearch

https://guess.fr/Bot.js

js guess.fr collected 2026-09-24 12:49:01 UTC 3,002 bytes, 94 lines download raw bytes

1class Bot {
2
3    constructor() {
4      $('#bot').html('Bot')
5
6      this.ready          = false;
7      this.name           = "";
8      this.txt            = "";
9      this.col            = "";
10      this.position       = createVector(random(200, window.innerWidth - 200), random(200, window.innerHeight - 200)); 
11      this.velocity       = createVector(0, -2);
12      this.acceleration   = createVector(0, 0);
13      this.mass           = 0.5;
14      this.maxspeed       = 2.5;
15      this.maxforce       = 0.1;  
16      this.lifespan       = floor(random(1000, 2000));
17		  this.attG 				  = 1;
18      this.attmass        = 200;	
19      this.attractor      = null
20
21      this.switchAttractor()
22
23      setTimeout(() => { this.switchAttractor() }, 3000)                          
24      setInterval(() => { this.sequence() }, 10)                
25    }
26  
27      /* --------------------- UPDATE, DISPLAY + MINIMAP ------------------------- */
28      
29      update() {
30        this.velocity.add(this.acceleration);
31        this.velocity.limit(this.maxspeed);
32        this.position.add(this.velocity);
33        this.acceleration.mult(0);
34      };
35  
36      display() {
37
38        $("#bot").css('transform', 'translate(' + this.position.x + 'px ,' + this.position.y + 'px)')
39        // this.div.style('transform:translate(' + this.position.x + 'px ,' + this.position.y + 'px)')
40       
41        if(this.attractor !== null) {      
42          if (((this.attractor.x - this.position.x) < 5) && ((this.attractor.y - this.position.y) < 5)) {
43            this.switchAttractor()
44          }
45        }
46      };
47  
48  
49      sequence() {
50          if (this.attractor !== null) {
51            var force = this.calculateAttraction(this.attractor, this.position);
52            this.applyForce(force);
53          }
54  
55          this.update();
56          this.display();
57      };
58  
59      switchAttractor() { 
60        this.maxspeed   = random(.5, 4);
61        var p           = $('#holder');
62        var w           = Math.floor(Math.random() * p.width())
63        var h           = Math.floor(Math.random() * p.height())
64        this.attractor  = createVector(w, h);
65
66        console.log(this.position)
67      };
68
69      applyForce(force) {
70        var f = p5.Vector.div(force,this.mass);
71        this.acceleration.add(f);
72      }
73
74
75      calculateAttraction = (att, bot) => {                                     
76        var force = p5.Vector.sub(this.attractor, this.position);     
77        var distance = force.mag();         
78        distance = constrain(distance, 5, 25);                                
79        force.normalize();                                        
80        var strength = (this.attG * this.attmass * this.mass) / (distance * distance); 
81        force.mult(strength);  
82        return force;   
83      };
84      
85      linear = (a, b, t) => {
86        return a + (b - a) * t;
87      };
88
89      choice = (somelist) => {
90        var i = Math.floor(Math.random() * somelist.length);
91        return somelist[i];
92      };
93  }
94  

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.