September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,8 +0,0 @@
|
|||
MODE 8
|
||||
ORIGIN 640, 512
|
||||
FOR i% = 1 TO 1000
|
||||
x% = RND(31)-16
|
||||
y% = RND(31)-16
|
||||
r = SQR(x%^2 + y%^2)
|
||||
IF r >= 10 IF r <= 15 PLOT x%*2, y%*2
|
||||
NEXT
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
## Ring of random points 2/18/17 aev
|
||||
reset
|
||||
fn="RingRandPntsGnu";
|
||||
ttl="Ring of random points"
|
||||
ofn=fn.".png"; lim=1000;
|
||||
randgp(top) = floor(rand(0)*top)
|
||||
set terminal png font arial 12 size 640,640
|
||||
set output ofn
|
||||
set title ttl font "Arial:Bold,12"
|
||||
unset key;
|
||||
set size square
|
||||
set parametric
|
||||
set xrange [-20:20]; set yrange [-20:20];
|
||||
set style line 1 lt rgb "red"
|
||||
$rring << EOD
|
||||
EOD
|
||||
set print $rring append
|
||||
do for [i=1:lim] {
|
||||
x=randgp(30); y=randgp(30);
|
||||
r=sqrt(x**2+y**2);
|
||||
if (r>=10&&r<=15) \
|
||||
{print x," ",y; print -x," ",-y;print x," ",-y; print -x," ",y;}
|
||||
}
|
||||
plot [0:2*pi] sin(t)*10,cos(t)*10, sin(t)*15,cos(t)*15 ls 1,\
|
||||
$rring using 1:2 with points pt 7 ps 0.5 lc "black"
|
||||
set output
|
||||
unset print
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// version 1.1.3
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val r = java.util.Random()
|
||||
val points = Array(31) { CharArray(31) { ' ' } }
|
||||
var count = 0
|
||||
while (count < 100) {
|
||||
val x = r.nextInt(31) - 15
|
||||
val y = r.nextInt(31) - 15
|
||||
val h = x * x + y * y
|
||||
if (h in 100..225) {
|
||||
points[x + 15][y + 15] = 'o'
|
||||
count++
|
||||
}
|
||||
}
|
||||
for (i in 0..30) println(points[i].joinToString(""))
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
xy:=(0).walker(*).tweak(fcn{ // generate infinite random pairs (lazy)
|
||||
x:=(-15).random(16); y:=(-15).random(16);
|
||||
if(not (100<=(x*x + y*y)<=225)) Void.Skip else T(x,y)
|
||||
});
|
||||
|
||||
const N=31; // [-15..15] includes 0
|
||||
array:=(" ,"*N*N).split(",").copy(); // bunch of spaces (list)
|
||||
|
||||
xy.walk(100).apply2(fcn([(x,y)],array){array[x+15 + N*(y+15)]="*"},array);
|
||||
foreach n in ([0..30]){ array[n*N,30].concat().println(); }
|
||||
Loading…
Add table
Add a link
Reference in a new issue