Change the Python module's name back to rlgall.

It is no longer an experimental variant.  Using a database as a backend
is a settled feature.
This commit is contained in:
John "Elwin" Edwards 2014-01-02 13:09:48 -05:00
parent b9081d194b
commit f272772dcb
9 changed files with 14 additions and 12 deletions

View file

@ -12,7 +12,7 @@ py/ contains various Python scripts.
py/recorder.py processes the log files and stores the data in a PostgreSQL py/recorder.py processes the log files and stores the data in a PostgreSQL
database. It should be run periodically by cron. database. It should be run periodically by cron.
py/rlgalldb.py is a module which recorder.py requires. It should be installed py/rlgall.py is a module which recorder.py requires. It should be installed
in /lib/python<x.y>/site-packages or the equivalent location. in /lib/python<x.y>/site-packages or the equivalent location.
web/ contains the static parts of the rlgallery.org website. Note that when web/ contains the static parts of the rlgallery.org website. Note that when

View file

@ -1,7 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
# cleandb.py: empty the database in an orderly fashion # cleandb.py: empty the database in an orderly fashion
import rlgalldb as rlgall import rlgall
import psycopg2 import psycopg2
dbconn = psycopg2.connect("dbname=rlg") dbconn = psycopg2.connect("dbname=rlg")

View file

@ -2,7 +2,7 @@
import os import os
import psycopg2 import psycopg2
import rlgalldb as rlgall import rlgall
# Contains a dir for everyone who registered # Contains a dir for everyone who registered
everydir = "/var/dgl/dgldir/ttyrec/" everydir = "/var/dgl/dgldir/ttyrec/"

View file

@ -1,4 +1,4 @@
# rlgalldb.py # rlgall.py
# Module for the Roguelike Gallery, using a postgres database # Module for the Roguelike Gallery, using a postgres database
# Requires Python 3.3 # Requires Python 3.3

View file

@ -1,7 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
# setupdb.py: initializes the database tables used by the rlg system. # setupdb.py: initializes the database tables used by the rlg system.
import rlgalldb as rlgall import rlgall
import psycopg2 import psycopg2
webuser = "webserver" webuser = "webserver"

10
py/stats.py Normal file → Executable file
View file

@ -1,6 +1,8 @@
#!/usr/bin/python3
import math import math
import psycopg2 import psycopg2
import rlgalldb as rlgall import rlgall
def makeExpPDF(lbd): def makeExpPDF(lbd):
def lpdf(x): def lpdf(x):
@ -22,13 +24,13 @@ for game in rlgall.gamelist:
total = sum(scores) total = sum(scores)
lbd = float(count) / total lbd = float(count) / total
cdf = makeExpCDF(lbd) cdf = makeExpCDF(lbd)
print "{0}: {1} games, average {2}".format(game.name, count, int(1/lbd)) print("{0}: {1} games, average {2}".format(game.name, count, int(1/lbd)))
for i in range(0, 10000, 1000): for i in range(0, 10000, 1000):
actual = len([ s for s in scores if i <= s < i + 1000 ]) actual = len([ s for s in scores if i <= s < i + 1000 ])
predicted = (cdf(i + 1000) - cdf(i)) * count predicted = (cdf(i + 1000) - cdf(i)) * count
print "{0:5}: {1:4} {2}".format(i, actual, predicted) print("{0:5}: {1:4} {2}".format(i, actual, predicted))
high = max(scores) high = max(scores)
print "Max: {0} {1}\n".format(high, 1 - cdf(high)) print("Max: {0} {1}\n".format(high, 1 - cdf(high)))
cur.close() cur.close()
conn.close() conn.close()

View file

@ -7,7 +7,7 @@ import time
import calendar import calendar
from datetime import datetime from datetime import datetime
import pytz import pytz
import rlgalldb as rlgall import rlgall
#import cgitb #import cgitb
#cgitb.enable() #cgitb.enable()

View file

@ -3,7 +3,7 @@
import sys import sys
import time import time
import rlgalldb as rlgall import rlgall
# It is assumed that sys.stdout uses UTF-8 encoding. If this is not the case, # It is assumed that sys.stdout uses UTF-8 encoding. If this is not the case,
# configure the Web server to set the LC_CTYPE environment variable to a UTF-8 # configure the Web server to set the LC_CTYPE environment variable to a UTF-8

View file

@ -2,7 +2,7 @@
import os import os
import sys import sys
import rlgalldb as rlgall import rlgall
playerdir = "/var/www/lighttpd/scoring/players/" playerdir = "/var/www/lighttpd/scoring/players/"
linkstr = '<li><a href="./{0}.html">{0}</a></li>\n' linkstr = '<li><a href="./{0}.html">{0}</a></li>\n'