0 | KEY(1) ON: ON KEY(1) GOSUB afrondschoonscherm |
---|

1 | KEY(2) ON: ON KEY(2) GOSUB andermode |
---|

2 | KEY(3) ON: ON KEY(3) GOSUB nieuwecoordinaten |
---|

3 | KEY(4) ON: ON KEY(4) GOSUB windowgrootte |
---|

4 | KEY(5) ON: ON KEY(5) GOSUB sterktezwaartekracht |
---|

5 | KEY(6) ON: ON KEY(6) GOSUB nieuwaantaldeeltjes |
---|

6 | KEY(7) ON: ON KEY(7) GOSUB lijnmetwis |
---|

7 | KEY(8) ON: ON KEY(8) GOSUB lijnzonderwis |
---|

8 | KEY(9) ON: ON KEY(9) GOSUB willekeuroud |
---|

9 | KEY(10) ON: ON KEY(10) GOSUB willekeurnieuw |
---|

10 | |
---|

11 | |
---|

12 | DIM x(100, 103), y(100, 103), z(100, 103), xfz(100), yfz(100), zfz(100) |
---|

13 | DIM x2d(200), y2d(200) |
---|

14 | |
---|

15 | SCREEN 12, 0: CLS |
---|

16 | xyz = 100 |
---|

17 | mfz = .1 |
---|

18 | aantal = 3 |
---|

19 | scherm = 1 |
---|

20 | begincord = 1 |
---|

21 | lijn = 0 |
---|

22 | willoud = 100 |
---|

23 | willnieuw = 1 |
---|

24 | wg = 3 * willoud |
---|

25 | afrond = 0 |
---|

26 | |
---|

27 | WINDOW (-wg, wg)-(wg, -wg) |
---|

28 | |
---|

29 | prog = 1 |
---|

30 | |
---|

31 | WHILE prog > 0 |
---|

32 | |
---|

33 | CLS |
---|

34 | |
---|

35 | FOR tel = 0 TO aantal - 1 |
---|

36 | x(tel, 0) = (RND(1) * 2 * willoud) - willoud: x(tel, 1) = x(tel, 0) + (RND(1) * 2 * willnieuw) - willnieuw |
---|

37 | y(tel, 0) = (RND(1) * 2 * willoud) - willoud: y(tel, 1) = y(tel, 0) + (RND(1) * 2 * willnieuw) - willnieuw |
---|

38 | z(tel, 0) = (RND(1) * 2 * willoud) - willoud: z(tel, 1) = z(tel, 0) + (RND(1) * 2 * willnieuw) - willnieuw |
---|

39 | NEXT tel |
---|

40 | |
---|

41 | IF begincord = 1 THEN GOSUB bcord |
---|

42 | |
---|

43 | GOSUB status |
---|

44 | |
---|

45 | prog = 2 |
---|

46 | |
---|

47 | WHILE prog > 1 |
---|

48 | |
---|

49 | FOR tel1 = 0 TO aantal - 1 |
---|

50 | x(tel1, 2) = x(tel1, 1) - x(tel1, 0) |
---|

51 | y(tel1, 2) = y(tel1, 1) - y(tel1, 0) |
---|

52 | z(tel1, 2) = z(tel1, 1) - z(tel1, 0) |
---|

53 | FOR tel2 = tel1 TO aantal - 1 |
---|

54 | x(tel1, 3 + tel1) = x(tel2, 1) - x(tel1, 1) |
---|

55 | y(tel1, 3 + tel1) = y(tel2, 1) - y(tel1, 1) |
---|

56 | z(tel1, 3 + tel1) = z(tel2, 1) - z(tel1, 1) |
---|

57 | x(tel2, 3 + tel2) = -x(tel1, 3 + tel1) |
---|

58 | y(tel2, 3 + tel2) = -y(tel1, 3 + tel1) |
---|

59 | z(tel2, 3 + tel2) = -z(tel1, 3 + tel1) |
---|

60 | x(tel1, 3 + aantal + tel1) = ABS(x(tel1, 3 + tel1)) |
---|

61 | y(tel1, 3 + aantal + tel1) = ABS(y(tel1, 3 + tel1)) |
---|

62 | z(tel1, 3 + aantal + tel1) = ABS(z(tel1, 3 + tel1)) |
---|

63 | x(tel2, 3 + aantal + tel2) = ABS(x(tel2, 3 + tel2)) |
---|

64 | y(tel2, 3 + aantal + tel2) = ABS(y(tel2, 3 + tel2)) |
---|

65 | z(tel2, 3 + aantal + tel2) = ABS(z(tel2, 3 + tel2)) |
---|

66 | NEXT tel2 |
---|

67 | NEXT tel1 |
---|

68 | |
---|

69 | FOR tel1 = 0 TO aantal - 1 |
---|

70 | xfz(tel1) = 0 |
---|

71 | yfz(tel1) = 0 |
---|

72 | zfz(tel1) = 0 |
---|

73 | FOR tel2 = 0 TO aantal - 1 |
---|

74 | IF x(tel1, 3 + aantal + tel2) > 0 THEN xfz(tel1) = xfz(tel1) + x(tel1, 3 + tel2) * mfz / x(tel1, 3 + aantal + tel2) |
---|

75 | IF y(tel1, 3 + aantal + tel2) > 0 THEN yfz(tel1) = yfz(tel1) + y(tel1, 3 + tel2) * mfz / y(tel1, 3 + aantal + tel2) |
---|

76 | IF z(tel1, 3 + aantal + tel2) > 0 THEN zfz(tel1) = zfz(tel1) + z(tel1, 3 + tel2) * mfz / z(tel1, 3 + aantal + tel2) |
---|

77 | NEXT tel2 |
---|

78 | x(tel1, 0) = x(tel1, 1) |
---|

79 | IF afrond = 0 THEN x(tel1, 1) = x(tel1, 0) + x(tel1, 2) + xfz(tel1) ELSE x(tel1, 1) = INT(x(tel1, 0) + x(tel1, 2) + xfz(tel1)) |
---|

80 | y(tel1, 0) = y(tel1, 1) |
---|

81 | IF afrond = 0 THEN y(tel1, 1) = y(tel1, 0) + y(tel1, 2) + yfz(tel1) ELSE y(tel1, 1) = INT(y(tel1, 0) + y(tel1, 2) + yfz(tel1)) |
---|

82 | z(tel1, 0) = z(tel1, 1) |
---|

83 | IF afrond = 0 THEN z(tel1, 1) = z(tel1, 0) + z(tel1, 2) + zfz(tel1) ELSE z(tel1, 1) = INT(z(tel1, 0) + z(tel1, 2) + zfz(tel1)) |
---|

84 | NEXT tel1 |
---|

85 | |
---|

86 | midx = 0 |
---|

87 | midy = 0 |
---|

88 | midz = 0 |
---|

89 | |
---|

90 | FOR tel = 0 TO aantal - 1 |
---|

91 | midx = midx + x(tel, 1) |
---|

92 | midy = midy + y(tel, 1) |
---|

93 | midz = midz + z(tel, 1) |
---|

94 | NEXT tel |
---|

95 | |
---|

96 | midx = midx / aantal |
---|

97 | midy = midy / aantal |
---|

98 | midz = midz / aantal |
---|

99 | |
---|

100 | |
---|

101 | w2dx = midy - midx * .5 |
---|

102 | w2dy = midz - midx * .5 |
---|

103 | |
---|

104 | IF lijn = 2 THEN GOSUB wislijn: |
---|

105 | |
---|

106 | FOR tel = 0 TO aantal - 1 |
---|

107 | x2d(tel) = y(tel, 1) - x(tel, 1) * .5 |
---|

108 | y2d(tel) = z(tel, 1) - x(tel, 1) * .5 |
---|

109 | NEXT tel |
---|

110 | |
---|

111 | WINDOW (-wg + w2dx, wg + w2dy)-(wg + w2dx, -wg + w2dy) |
---|

112 | |
---|

113 | IF lijn = 0 THEN GOSUB tekenpunt: ELSE GOSUB tekenlijn: |
---|

114 | |
---|

115 | WEND |
---|

116 | WEND |
---|

117 | |
---|

118 | andermode: |
---|

119 | scherm = scherm + 1 |
---|

120 | IF scherm > 2 THEN scherm = 0 |
---|

121 | IF scherm = 0 THEN SCREEN 9, 0: WIDTH 80, 43: COLOR 1, 10 |
---|

122 | IF scherm = 1 THEN SCREEN 12: WIDTH 80, 60 |
---|

123 | IF scherm = 2 THEN SCREEN 13 |
---|

124 | GOSUB status |
---|

125 | RETURN |
---|

126 | |
---|

127 | afrondschoonscherm: |
---|

128 | IF afrond = 0 THEN afrond = 1 ELSE afrond = 0 |
---|

129 | GOSUB status |
---|

130 | RETURN |
---|

131 | |
---|

132 | nieuwecoordinaten: |
---|

133 | prog = 1 |
---|

134 | CLS |
---|

135 | RETURN |
---|

136 | |
---|

137 | sterktezwaartekracht: |
---|

138 | PRINT "Mate van zwaartekracht is:"; mfz |
---|

139 | INPUT "Nieuwe mate:", mfz |
---|

140 | GOSUB status |
---|

141 | RETURN |
---|

142 | |
---|

143 | nieuwaantaldeeltjes: |
---|

144 | PRINT "Aantal deeltjes is:"; aantal |
---|

145 | INPUT "Nieuw aantal:", aantal |
---|

146 | IF aantal < 1 THEN aantal = 1 |
---|

147 | IF aantal > 50 THEN aantal = 50 |
---|

148 | CLS |
---|

149 | prog = 1 |
---|

150 | RETURN |
---|

151 | |
---|

152 | windowgrootte: |
---|

153 | PRINT "Windowgrootte is:"; wg |
---|

154 | INPUT "Nieuwe grootte:", wg |
---|

155 | IF wg < 10 THEN wg = 10 |
---|

156 | IF wg > 500 THEN wg = 500 |
---|

157 | GOSUB status: |
---|

158 | RETURN |
---|

159 | |
---|

160 | willekeuroud: |
---|

161 | PRINT "Randomize oude cordinaat is:"; willoud |
---|

162 | INPUT "Nieuwe randomize factor:"; willoud |
---|

163 | IF willoud < 1 THEN willoud = 1 |
---|

164 | IF willoud > 10000 THEN willoud = 10000 |
---|

165 | wg = 3 * willoud |
---|

166 | CLS |
---|

167 | prog = 1 |
---|

168 | RETURN |
---|

169 | |
---|

170 | willekeurnieuw: |
---|

171 | PRINT "Randomize nieuwe cordinaat is:"; willnieuw |
---|

172 | INPUT "Nieuwe randomize factor:"; willnieuw |
---|

173 | IF willnieuw < .0000001 THEN willoud = .0000001 |
---|

174 | IF willnieuw > 1000 THEN willnieuw = 1000 |
---|

175 | CLS |
---|

176 | prog = 1 |
---|

177 | RETURN |
---|

178 | |
---|

179 | |
---|

180 | lijnzonderwis: |
---|

181 | IF lijn = 1 THEN lijn = 0 ELSE lijn = 1 |
---|

182 | CLS |
---|

183 | IF lijn = 0 THEN GOSUB status: |
---|

184 | RETURN |
---|

185 | |
---|

186 | lijnmetwis: |
---|

187 | IF lijn = 2 THEN lijn = 0 ELSE lijn = 2 |
---|

188 | CLS |
---|

189 | IF lijn = 0 THEN GOSUB status: |
---|

190 | RETURN |
---|

191 | |
---|

192 | |
---|

193 | bcord: |
---|

194 | begincord = 0 |
---|

195 | x(0, 0) = xyz: x(0, 1) = xyz |
---|

196 | y(0, 0) = 0: y(0, 1) = -.9 |
---|

197 | z(0, 0) = 0: z(0, 1) = .9 |
---|

198 | x(1, 0) = 0: x(1, 1) = .9 |
---|

199 | y(1, 0) = xyz: y(1, 1) = xyz |
---|

200 | z(1, 0) = 0: z(1, 1) = -.9 |
---|

201 | x(2, 0) = 0: x(2, 1) = -.9 |
---|

202 | y(2, 0) = 0: y(2, 1) = .9 |
---|

203 | z(2, 0) = xyz: z(2, 1) = xyz |
---|

204 | |
---|

205 | RETURN |
---|

206 | |
---|

207 | tekenpunt: |
---|

208 | |
---|

209 | FOR tel = 0 TO aantal - 1 |
---|

210 | PSET (x2d(tel), y2d(tel)), 7 + tel |
---|

211 | NEXT tel |
---|

212 | RETURN |
---|

213 | |
---|

214 | tekenlijn: |
---|

215 | FOR tel1 = 0 TO aantal - 1 |
---|

216 | FOR tel2 = tel1 TO aantal - 1 |
---|

217 | LINE (x2d(tel1), y2d(tel1))-(x2d(tel2), y2d(tel2)), 2 + tel1 + tel2 |
---|

218 | NEXT tel2 |
---|

219 | NEXT tel1 |
---|

220 | RETURN |
---|

221 | |
---|

222 | wislijn: |
---|

223 | CLS |
---|

224 | RETURN |
---|

225 | |
---|

226 | status: |
---|

227 | CLS |
---|

228 | IF scherm = 0 THEN PRINT "EGA (16k)" |
---|

229 | IF scherm = 1 THEN PRINT "VGA (16k)" |
---|

230 | IF scherm < 2 THEN PRINT "Window-grootte :"; wg |
---|

231 | IF scherm < 2 THEN PRINT "Sterkte Fzwaarte:"; mfz |
---|

232 | IF scherm < 2 THEN PRINT "Aantal 1db's :"; aantal |
---|

233 | IF scherm < 2 THEN PRINT "r_oud :"; willoud |
---|

234 | IF scherm < 2 THEN PRINT "r_nieuw :"; willnieuw |
---|

235 | IF scherm < 2 THEN PRINT "Afronding c_oud :"; afrond |
---|

236 | RETURN |
---|

237 | |
---|

238 | |
---|