#!/usr/bin/env python
# -*- python-mode -*-
# -*- coding: UTF-8 -*-
###########################################################################
######################## Eureka latin hexameters #########################
###########################################################################
##
## o author: Richard Everson (R.M.Everson@exeter.ac.uk)
## o created: 2016-06-16 22:21:17+00:40
## o license: 

from random import choice
from string import upper, capitalize, join
from operator import mul

drums = [
    """decisive giant polite luminous common harmonious changeable 
    imaginary exotic fluffy scientific mechanical mischievous 
    draconian wise""".split(),

    """cats people perceptions societies cheesecakes insects numbers 
    pleasures rhythms dragons faces protests corruptions 
    enquirers machines""".split(),

    """craftily often never felicitously blushingly vividly tunefully 
    steadfastly languidly ceremoniously suavely seldom 
    frightfully now again""".split(),

    """wrought splashed scattered squeezed transported scrutinised 
    charmed thwarted treasured hypnotised misremembered elevated 
    diminished contemplated outran""".split(),

    """sleeping red befuddled salubrious demonic radical voluminous
    distant large ginger mercenary serious august angular elegant
    gorgeous wooden old""".split(),

    """elephants insomnia chairs penguins shadows cows radios cats
    fiddles carriages teddy-bears homes questions banks pickles""".split()
    ]



h = " ".join([ choice(drum) for drum in drums ]).upper().capitalize()
n = reduce(mul, [len(s) for s in drums])
m = int(n/10**6)
print """Content-Type: text/html



<html>
<head>
<title>Nonsense verse machine</title>
</head>
<body>

<h2>Nonsense verse machine</h2>

<table width="100%%" border=0 cellspacing=0 cellpadding=20
bgcolor="#ffffff">
<tr>
<td>

 <font size="5" color="blue"> %s <font color="black" size="3">
<p>
&nbsp;
</p>

 <table width="70%%" border=0 cellspacing=0 cellpadding=0>
 <tr>
 <td>
 <p>
 This is a randomly generated nonsense sentence.  It was generated by selecting words at random based on John Clark's Eureka machine for mechanically generating latin hexameters, which he completed in 1845.   
</p>

<p>
There are %d (more than %d million) possible verses.  
<a href="javascript:history.go(0)">Click get another one.</a>
</p>


""" % (h, n, m)

