Skip to content
This repository was archived by the owner on Jul 25, 2022. It is now read-only.

Commit 633f00f

Browse files
committed
Added PHP script to plot a random route.
1 parent 5e3aa10 commit 633f00f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

remote-website/robot-control.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
$image = imagecreatetruecolor(1000, 1000);
3+
$default_color = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
4+
5+
$positions = array();
6+
for ($i = 0; $i < 10; $i ++) {
7+
$positions[] = rand(0, 1000);
8+
}
9+
10+
$diameter = 10;
11+
$start_x = 0;
12+
$start_y = 0;
13+
14+
for ($i = 0; $i < count($positions); $i += 2) {
15+
$x = $positions[$i];
16+
$y = $positions[$i + 1];
17+
18+
imagefilledellipse($image, $x, $y, $diameter, $diameter, $default_color);
19+
imagestring($image, 3, $x + $diameter / 2, $y + $diameter / 2, sprintf("%u;%u", $x, $y), $default_color);
20+
imageline($image, $start_x, $start_y, $x, $y, $default_color);
21+
22+
$start_x = $x;
23+
$start_y = $y;
24+
}
25+
26+
// Flush the image
27+
header('Content-type: image/png');
28+
imagepng($image);
29+
imagedestroy($image);
30+
31+
?>

0 commit comments

Comments
 (0)