mirror of https://github.com/falsovsky/z80.git
Update stargen - so it doesnt use repeated x or y's
This commit is contained in:
parent
1c111bd999
commit
f85c692db6
|
@ -4,19 +4,30 @@
|
||||||
import sys
|
import sys
|
||||||
import random
|
import random
|
||||||
|
|
||||||
random.seed()
|
|
||||||
|
|
||||||
NumStars = 10
|
NumStars = 10
|
||||||
|
xlist = []
|
||||||
|
ylist = []
|
||||||
|
|
||||||
f = open('starrnd.asm', 'w')
|
f = open('starrnd.asm', 'w')
|
||||||
|
|
||||||
|
for x in range(NumStars):
|
||||||
|
random.seed()
|
||||||
|
x = random.randint(0,256 - 1)
|
||||||
|
while(x in xlist):
|
||||||
|
x = random.randint(0,256 - 1)
|
||||||
|
xlist.append(x)
|
||||||
|
|
||||||
|
y = random.randint(0,192 - 1)
|
||||||
|
while(y in ylist):
|
||||||
|
y = random.randint(0,192 - 1)
|
||||||
|
ylist.append(y)
|
||||||
|
|
||||||
|
xlist.sort()
|
||||||
|
ylist.sort()
|
||||||
|
|
||||||
f.write("StarRnd\n")
|
f.write("StarRnd\n")
|
||||||
|
|
||||||
for x in range(NumStars):
|
for idx in range(NumStars):
|
||||||
x = random.randint(0,256 - 1)
|
f.write("\t\tdb %i, %i\n" % (xlist[idx], ylist[idx]))
|
||||||
y = random.randint(0,192 - 1)
|
|
||||||
z = random.randint(0,10)
|
|
||||||
#f.write("\t\tdb %i, %i, %i\n" % (x, y, z))
|
|
||||||
f.write("\t\tdb %i, %i\n" % (x, y))
|
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
Loading…
Reference in New Issue