rubylabs 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/randomlab.rb +143 -224
- data/lib/rubylabs.rb +262 -38
- data/lib/spherelab.rb +566 -209
- data/lib/tsplab.rb +308 -276
- data/test/sphere_test.rb +32 -0
- metadata +2 -22
- data/data/aafreq.txt +0 -20
- data/data/cars.txt +0 -50
- data/data/century.txt +0 -1
- data/data/colors.txt +0 -64
- data/data/earth.yaml +0 -15
- data/data/fruit.txt +0 -45
- data/data/hacodes.txt +0 -35
- data/data/hafreq.txt +0 -16
- data/data/hvfreq.txt +0 -5
- data/data/nbody.R +0 -23
- data/data/nbody.out +0 -731
- data/data/nbody.pdf +0 -3111
- data/data/nbody.png +0 -0
- data/data/nbody3d.pdf +0 -3201
- data/data/outer.pdf +0 -182785
- data/data/solarsystem.txt +0 -17
- data/data/suits.txt +0 -1
- data/data/wordlist.txt +0 -210653
- data/lib/sortlab.rb +0 -213
- data/lib/viewer.rb +0 -65
data/test/sphere_test.rb
CHANGED
@@ -125,5 +125,37 @@ class TestSpheres < Test::Unit::TestCase
|
|
125
125
|
assert_in_delta myfirst.z, mercury.position.z, 1e10
|
126
126
|
end
|
127
127
|
end
|
128
|
+
|
129
|
+
# Test the Turtle class by making a "turtle" and moving it in a square pattern.
|
130
|
+
|
131
|
+
def test_05_turtle
|
132
|
+
t = Turtle.new( :x => 0.0, :y => 0.0, :heading => 0.0, :speed => 10.0)
|
133
|
+
|
134
|
+
# move up 10 paces
|
135
|
+
t.advance(1)
|
136
|
+
assert_in_delta t.position.x, 0.0, 10*Float::EPSILON
|
137
|
+
assert_in_delta t.position.y, 10.0, 10*Float::EPSILON
|
138
|
+
|
139
|
+
# turn, move right 10 paces
|
140
|
+
t.turn(90)
|
141
|
+
assert_in_delta t.heading, 90.0, 10*Float::EPSILON
|
142
|
+
t.advance(1)
|
143
|
+
assert_in_delta t.position.x, 10.0, 10*Float::EPSILON
|
144
|
+
assert_in_delta t.position.y, 10.0, 10*Float::EPSILON
|
145
|
+
|
146
|
+
# turn, move down 10 paces
|
147
|
+
t.turn(90)
|
148
|
+
assert_in_delta t.heading, 180.0, 10*Float::EPSILON
|
149
|
+
t.advance(1)
|
150
|
+
assert_in_delta t.position.x, 10.0, 10*Float::EPSILON
|
151
|
+
assert_in_delta t.position.y, 0.0, 10*Float::EPSILON
|
152
|
+
|
153
|
+
# turn, move left 10 paces
|
154
|
+
t.turn(90)
|
155
|
+
assert_in_delta t.heading, 270.0, 10*Float::EPSILON
|
156
|
+
t.advance(1)
|
157
|
+
assert_in_delta t.position.x, 0.0, 10*Float::EPSILON
|
158
|
+
assert_in_delta t.position.y, 0.0, 10*Float::EPSILON
|
159
|
+
end
|
128
160
|
|
129
161
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubylabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- conery
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-23 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -39,16 +39,7 @@ files:
|
|
39
39
|
- bin/statistics2-0.53/statistics2.rb
|
40
40
|
- bin/statistics2-0.53/t-inv.rb
|
41
41
|
- bin/statistics2.rb
|
42
|
-
- data/aafreq.txt
|
43
|
-
- data/cars.txt
|
44
|
-
- data/century.txt
|
45
|
-
- data/colors.txt
|
46
|
-
- data/earth.yaml
|
47
42
|
- data/eliza/doctor.txt
|
48
|
-
- data/fruit.txt
|
49
|
-
- data/hacodes.txt
|
50
|
-
- data/hafreq.txt
|
51
|
-
- data/hvfreq.txt
|
52
43
|
- data/mars/chang1.txt
|
53
44
|
- data/mars/dwarf.txt
|
54
45
|
- data/mars/ferret.txt
|
@@ -62,16 +53,7 @@ files:
|
|
62
53
|
- data/mars/test_hello.txt
|
63
54
|
- data/mars/test_mult.txt
|
64
55
|
- data/mars/test_threads.txt
|
65
|
-
- data/nbody.R
|
66
|
-
- data/nbody.out
|
67
|
-
- data/nbody.pdf
|
68
|
-
- data/nbody.png
|
69
|
-
- data/nbody3d.pdf
|
70
|
-
- data/outer.pdf
|
71
56
|
- data/solar.dat
|
72
|
-
- data/solarsystem.txt
|
73
|
-
- data/suits.txt
|
74
|
-
- data/wordlist.txt
|
75
57
|
- lib/bitlab.rb
|
76
58
|
- lib/elizalab.rb
|
77
59
|
- lib/encryptionlab.rb
|
@@ -83,10 +65,8 @@ files:
|
|
83
65
|
- lib/recursionlab.rb
|
84
66
|
- lib/rubylabs.rb
|
85
67
|
- lib/sievelab.rb
|
86
|
-
- lib/sortlab.rb
|
87
68
|
- lib/spherelab.rb
|
88
69
|
- lib/tsplab.rb
|
89
|
-
- lib/viewer.rb
|
90
70
|
has_rdoc: true
|
91
71
|
homepage: http://github.com/conery/rubylabs
|
92
72
|
licenses: []
|
data/data/aafreq.txt
DELETED
data/data/cars.txt
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
acura
|
2
|
-
alfa romeo
|
3
|
-
aston martin
|
4
|
-
audi
|
5
|
-
bentley
|
6
|
-
bmw
|
7
|
-
bugatti
|
8
|
-
buick
|
9
|
-
cadillac
|
10
|
-
chevrolet
|
11
|
-
chrysler
|
12
|
-
citroen
|
13
|
-
dodge
|
14
|
-
ferrari
|
15
|
-
fiat
|
16
|
-
ford
|
17
|
-
honda
|
18
|
-
infiniti
|
19
|
-
isuzu
|
20
|
-
jaguar
|
21
|
-
jeep
|
22
|
-
kia
|
23
|
-
lamborghini
|
24
|
-
lancia
|
25
|
-
land rover
|
26
|
-
lexus
|
27
|
-
lincoln
|
28
|
-
lotus
|
29
|
-
maserati
|
30
|
-
mazda
|
31
|
-
mercedes-benz
|
32
|
-
mercury
|
33
|
-
mg
|
34
|
-
mini
|
35
|
-
mitsubishi
|
36
|
-
nissan
|
37
|
-
oldsmobile
|
38
|
-
opel
|
39
|
-
peugeot
|
40
|
-
pontiac
|
41
|
-
porsche
|
42
|
-
renault
|
43
|
-
rolls-royce
|
44
|
-
saturn
|
45
|
-
skoda
|
46
|
-
suzuki
|
47
|
-
tesla
|
48
|
-
toyota
|
49
|
-
vauxhall
|
50
|
-
volkswagen
|
data/data/century.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
The 19th Century (1801-1900).
|
data/data/colors.txt
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
almond
|
2
|
-
antique white
|
3
|
-
aquamarine
|
4
|
-
azure
|
5
|
-
beige
|
6
|
-
bisque
|
7
|
-
black
|
8
|
-
blue
|
9
|
-
brown
|
10
|
-
cadet blue
|
11
|
-
chartreuse
|
12
|
-
chocolate
|
13
|
-
coral
|
14
|
-
cornflower
|
15
|
-
cornsilk
|
16
|
-
cyan
|
17
|
-
dodger blue
|
18
|
-
firebrick
|
19
|
-
forest green
|
20
|
-
gold
|
21
|
-
goldenrod
|
22
|
-
gray
|
23
|
-
green
|
24
|
-
honeydew
|
25
|
-
hot pink
|
26
|
-
ivory
|
27
|
-
khaki
|
28
|
-
lavender
|
29
|
-
lemon
|
30
|
-
lime green
|
31
|
-
linen white
|
32
|
-
magenta
|
33
|
-
maroon
|
34
|
-
midnight
|
35
|
-
mint
|
36
|
-
moccasin
|
37
|
-
navy
|
38
|
-
olive
|
39
|
-
orange
|
40
|
-
orchid
|
41
|
-
pale green
|
42
|
-
papaya
|
43
|
-
peach
|
44
|
-
pink
|
45
|
-
plum
|
46
|
-
purple
|
47
|
-
red
|
48
|
-
royal blue
|
49
|
-
salmon
|
50
|
-
sea green
|
51
|
-
seashell
|
52
|
-
sienna
|
53
|
-
sky blue
|
54
|
-
snow white
|
55
|
-
spring green
|
56
|
-
steel
|
57
|
-
tan
|
58
|
-
thistle
|
59
|
-
turquoise
|
60
|
-
violet
|
61
|
-
wheat
|
62
|
-
white
|
63
|
-
yellow
|
64
|
-
yellow green
|
data/data/earth.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
--- !ruby/object:RubyLabs::SphereLab::Body
|
2
|
-
force: !ruby/object:RubyLabs::SphereLab::Vector
|
3
|
-
x: 0.0
|
4
|
-
y: 0.0
|
5
|
-
z: 0.0
|
6
|
-
mass: 5.976e+24
|
7
|
-
name: earth
|
8
|
-
position: !ruby/object:RubyLabs::SphereLab::Vector
|
9
|
-
x: -27000000000.0
|
10
|
-
y: 144000000000.0
|
11
|
-
z: 9686451
|
12
|
-
velocity: !ruby/object:RubyLabs::SphereLab::Vector
|
13
|
-
x: -29770.44
|
14
|
-
y: -5568.042
|
15
|
-
z: 0.3961261
|
data/data/fruit.txt
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
apple
|
2
|
-
apricot
|
3
|
-
avocado
|
4
|
-
banana
|
5
|
-
blackberry
|
6
|
-
blueberry
|
7
|
-
boysenberry
|
8
|
-
carob
|
9
|
-
cherry
|
10
|
-
chokecherry
|
11
|
-
clementine
|
12
|
-
cloudberry
|
13
|
-
cranberry
|
14
|
-
currant
|
15
|
-
date
|
16
|
-
elderberry
|
17
|
-
fig
|
18
|
-
gooseberry
|
19
|
-
grape
|
20
|
-
grapefruit
|
21
|
-
guava
|
22
|
-
huckleberry
|
23
|
-
kumquat
|
24
|
-
lemon
|
25
|
-
lime
|
26
|
-
lingonberry
|
27
|
-
loganberry
|
28
|
-
loquat
|
29
|
-
lychee
|
30
|
-
mandarin
|
31
|
-
mango
|
32
|
-
mulberry
|
33
|
-
orange
|
34
|
-
papaya
|
35
|
-
peach
|
36
|
-
pear
|
37
|
-
pineapple
|
38
|
-
plum
|
39
|
-
pomegranate
|
40
|
-
pomelo
|
41
|
-
quince
|
42
|
-
raspberry
|
43
|
-
strawberry
|
44
|
-
tangerine
|
45
|
-
watermelon
|
data/data/hacodes.txt
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# The binary numbers are Hawaiian words, encoded with a Huffman code based on the
|
2
|
-
# letter frequencies in hafreq.txt. The word next to a code is the English translation
|
3
|
-
# of the Hawaiian word -- after decoding a string of bits look for the word in a
|
4
|
-
# Hawaiian-English dictionary to see if the decoding is correct.
|
5
|
-
|
6
|
-
011010 rain
|
7
|
-
001010 sugarcane
|
8
|
-
0011111 carving
|
9
|
-
110011010 night
|
10
|
-
0011000110 duck
|
11
|
-
1100001010 chicken
|
12
|
-
1001110110 swordfish
|
13
|
-
111001101111 large
|
14
|
-
001010111010 leeward
|
15
|
-
110000100010110 island
|
16
|
-
1100001010111010 ocean
|
17
|
-
0001110101111101 octopus
|
18
|
-
0000101110101111 porch
|
19
|
-
1110110111101101 goose
|
20
|
-
0010110110000110 teacher
|
21
|
-
100000111101111111 royalty
|
22
|
-
00110000110001101111 beach
|
23
|
-
11000100001100000010 thankyou
|
24
|
-
11000100011011101111 wind
|
25
|
-
0001010100000010000110 friend
|
26
|
-
0011000110000111111000110 morning
|
27
|
-
0001100110011101000001111 happy
|
28
|
-
110001000110000111110011111 year
|
29
|
-
00010100111010001111111001110 hospitality
|
30
|
-
1100010000011110001111111101111 visitor
|
31
|
-
11000100010110100001111111101101 mother
|
32
|
-
00011000001000110000111110011111 pineapple
|
33
|
-
110001101111011010001011011101101 imp
|
34
|
-
0011011110011011000100001111111101101 daughter
|
35
|
-
000101101100001100001011011000011011100110001011011100110001011010110011011010011110 triggerfish
|
data/data/hafreq.txt
DELETED
data/data/nbody.R
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# Script from Ryan Kersh (CIS 555, WQ 2009)
|
2
|
-
f = read.table("nbody.out")
|
3
|
-
png("nbody.png", 800, 800)
|
4
|
-
par(pty="s")
|
5
|
-
m <- max(f$marsx, f$marsy)
|
6
|
-
# Make an initial empty plot to create a frame big enough to hold the largest
|
7
|
-
# orbit
|
8
|
-
plot(c(-m,m), c(-m,m), xlab="X", ylab="Y", main="Solar System", pch=" ")
|
9
|
-
lines(f$marsx, f$marsy, type="l", col=1)
|
10
|
-
lines(f$earthx, f$earthy, type="l", col=2)
|
11
|
-
lines(f$venusx, f$venusy, type="l", col=3)
|
12
|
-
lines(f$mercuryx, f$mercuryy, type="l", col=4)
|
13
|
-
points(0,0,pch=3)
|
14
|
-
dev.off()
|
15
|
-
|
16
|
-
pdf("inner.pdf")
|
17
|
-
s3d = scatterplot3d(f$marsx,f$marsy,f$marsz, zlim=c(10e11,-10e11), type="l")
|
18
|
-
s3d$points3d(f$earthx,f$earthy,f$earthz, col="blue", type="l")
|
19
|
-
s3d$points3d(f$venusx,f$venusy,f$venusz, col="red", type="l")
|
20
|
-
s3d$points3d(f$mercuryx,f$mercuryy,f$mercuryz, col="yellow", type="l")
|
21
|
-
s3d$points3d(0,0,0,pch=3)
|
22
|
-
dev.off()
|
23
|
-
|