Sie sind vermutlich noch nicht im Forum angemeldet - Klicken Sie hier um sich kostenlos anzumelden Impressum 
Sie können sich hier anmelden
Dieses Thema hat 1 Antworten
und wurde 354 mal aufgerufen
 More languages
Raman Offline




Beiträge: 167

18.09.2020 21:15
Exotic dictionary - Scrabble with perfect squares, triangular numbers, perfect cubes, perfect powers Zitat · Antworten

Exotic dictionary - Scrabble with perfect squares

2 points: 4 ×10, 6 ×10
3 points: 0 ×10, 1 ×10, 2 ×10
4 points: 5 ×10, 8 ×10, 9 ×10
5 points: 3 ×10, 7 ×10

That is ideally played with 7 or 8 tiles in rack for obtaining within best results, but players can change this number freely enough depending upon their own wishes and depending upon their own tastes.




square.py

1
2
3
4
5
6
7
8
9
10
11
12
13
 
print "[Header]"
print "Version=100000"
print "Author=Raman Viswanathan <raman22feb1988@gmail.com>"
print "StandardCategory=1 digit"
print "Licence=GNU General Public License, v3"
print "Comment=Squares"
print "[Replace]"
print "[Categories]"
for j in range(1, 11):
print str(j) + "=" + str(j + 1) + " digits"
print "[Words]"
for i in range(1, 316228):
print str(i ** 2) + "=" + str(i) + "\xc2\xb2" + (";" + str(len(str(i ** 2)) - 1), "") [i <= 3]
 


triangular.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
m = ["\xe2\x81\xb0", "\xc2\xb9", "\xc2\xb2", "\xc2\xb3", "\xe2\x81\xb4", "\xe2\x81\xb5", "\xe2\x81\xb6", "\xe2\x81\xb7", "\xe2\x81\xb8", "\xe2\x81\xb9"]
n = ["\xe2\x82\x80", "\xe2\x82\x81", "\xe2\x82\x82", "\xe2\x82\x83", "\xe2\x82\x84", "\xe2\x82\x85", "\xe2\x82\x86", "\xe2\x82\x87", "\xe2\x82\x88", "\xe2\x82\x89"]
def superscript(s):
a = ""
for c in s:
a += m[ord(c) - 48]
return a
def subscript(t):
b = ""
for d in t:
b += n[ord(d) - 48]
return b
print "[Header]"
print "Version=100000"
print "Author=Raman Viswanathan <raman22feb1988@gmail.com>"
print "StandardCategory=1 digit"
print "Licence=GNU General Public License, v3"
print "Comment=Triangular Numbers"
print "[Replace]"
print "[Categories]"
for j in range(1, 11):
print str(j) + "=" + str(j + 1) + " digits"
print "[Words]"
for i in range(2, 447215):
print str((i * (i - 1)) / 2) + "=" + superscript(str(i)) + "C" + n[2] + (";" + str(len(str((i * (i - 1)) / 2)) - 1), "") [i <= 4]
 


cube.py

1
2
3
4
5
6
7
8
9
10
11
12
13
 
print "[Header]"
print "Version=100000"
print "Author=Raman Viswanathan <raman22feb1988@gmail.com>"
print "StandardCategory=1 digit"
print "Licence=GNU General Public License, v3"
print "Comment=Cubes"
print "[Replace]"
print "[Categories]"
for j in range(1, 15):
print str(j) + "=" + str(j + 1) + " digits"
print "[Words]"
for i in range(1, 100000):
print str(i ** 3) + "=" + str(i) + "\xc2\xb3" + (";" + str(len(str(i ** 3)) - 1), "") [i <= 2]
 

Raman Offline




Beiträge: 167

19.09.2020 19:13
#2 RE: Exotic dictionary - Scrabble with perfect squares, triangular numbers, perfect cubes, perfect powers Zitat · Antworten

Usage: python power.py > power.dic (Python 2.7)

power.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
m = ["\xe2\x81\xb0", "\xc2\xb9", "\xc2\xb2", "\xc2\xb3", "\xe2\x81\xb4", "\xe2\x81\xb5", "\xe2\x81\xb6", "\xe2\x81\xb7", "\xe2\x81\xb8", "\xe2\x81\xb9"]
n = ["\xe2\x82\x80", "\xe2\x82\x81", "\xe2\x82\x82", "\xe2\x82\x83", "\xe2\x82\x84", "\xe2\x82\x85", "\xe2\x82\x86", "\xe2\x82\x87", "\xe2\x82\x88", "\xe2\x82\x89"]
def superscript(s):
a = ""
for c in s:
a += m[ord(c) - 48]
return a
def subscript(t):
b = ""
for d in t:
b += n[ord(d) - 48]
return b
print "[Header]"
print "Version=100000"
print "Author=Raman Viswanathan <raman22feb1988@gmail.com>"
print "StandardCategory=1 digit"
print "Licence=GNU General Public License, v3"
print "Release=20.09.20"
print "Comment=This dictionary contains all numbers which are perfect powers of any integer \xe2\x89\xa5 2"
print "[Replace]"
print "[Categories]"
for j in range(1, 11):
print str(j) + "=" + str(j + 1) + " digits"
print "[Words]"
k = {}
for i in range(2, 316228):
z = i ** 2
y = 2
while z < 10 ** 11:
if z not in k:
k[z] = (i, y)
z *= i
y += 1
x = []
for (key, value) in k.items():
x.append((key, value[0], value[1]))
l = sorted(x)
for item in l:
print str(item[0]) + "=" + str(item[1]) + superscript(str(item[2])) + (";" + str(len(str(item[0])) - 1), "") [item[0] <= 9]
 

 Sprung  
Xobor Forum Software von Xobor.de
Einfach ein Forum erstellen
Datenschutz