1. Chris Lee-Messer
  2. instructables

Commits

Chris Lee-Messer  committed 5262373

changed dotgame names to reflect highest place

  • Participants
  • Parent commits 11d3a9e
  • Branches default

Comments (0)

Files changed (4)

File dotgame.py

  • Ignore whitespace
-# the dot game
-# create a pdf for working on concepts of placeholders, units etc.
-from __future__ import division
-from reportlab.pdfgen import canvas
-from reportlab.lib.pagesizes import *
-import reportlab.lib.colors as colors
-
-
-def drawCentredBox(can,x,y,side):
-    p=can.beginPath()
-    s2 = side/2.0
-    p.moveTo(x-s2,y-s2)
-    p.lineTo(x+s2,y-s2)
-    p.lineTo(x+s2,y+s2)
-    p.lineTo(x-s2,y+s2)
-    p.close()
-    can.drawPath(p)
-
-
-#landscape
-pw,ph = letter
-landscape = ph,pw
-pagesize = landscape
-can = canvas.Canvas("wiki/dotgame.pdf", pagesize=landscape)
-
-# create a frame
-p = can.beginPath()
-
-
-p2i = 72.0 # 72pt per inch
-x0, y0 = 0.5*p2i, 0.5*p2i
-w, h = pagesize[0]-p2i, pagesize[1]-p2i
-c,d = x0+w, y0+h
-
-p.moveTo(x0,y0)
-p.lineTo(c, y0)
-p.lineTo(c,d)
-p.lineTo(x0,d)
-#p.lineTo(0,0)
-p.close()
-
-can.drawPath(p)
-
-
-# now try to do the little grids
-
-lgy0 = y0+2.0*p2i
-lgy1 = lgy0 + 4.0*p2i
-dy = (lgy1-lgy0)/10.0
-
-lgx0,lgx1 = x0,c
-can.setLineWidth(0.3)
-#p = can.beginPath()
-#p.moveTo(lgx0, lgy0)
-y = lgy0
-for ii in range(11):
-    can.line(lgx0, y, lgx1, y)
-    y += dy
-    print y
-
-# now do vertical lines
-print "frame width: %f" % w
-
-nplaces = 4
-nbox =40
-print "divide by nplaces and then by 10:", w/nplaces, w/float(nbox)
-boxwid = w/float(nbox)
-
-x = x0
-
-for ii in range(nbox):
-    print x
-    if not ii%10 and x != x0:
-        can.setLineWidth(5.0)
-    can.line(x,lgy0, x,lgy1)
-    if not ii%10:
-        can.setLineWidth(0.3)
-    x+= boxwid
-
-side = 1.25*p2i
-can.setFont('Helvetica', 24)
-x=x0+ 5.0*boxwid
-lgyline = lgy1+3.0
-can.setFillColor(colors.green)
-can.setStrokeColor(colors.green)
-can.drawCentredString(x, lgyline, "1000")
-drawCentredBox(can,x,y0+1.0*p2i,side)
-
-x+= 10*boxwid
-can.setFillColor(colors.red)
-can.setStrokeColor(colors.red)
-can.drawCentredString(x, lgyline, "100")
-drawCentredBox(can,x,y0+1.0*p2i,side)
-
-x+= 10*boxwid
-can.setFillColor(colors.blue)
-can.setStrokeColor(colors.blue)
-
-can.drawCentredString(x, lgyline, "10")
-drawCentredBox(can,x,y0+1.0*p2i,side)
-
-x+= 10*boxwid
-can.setFillColor(colors.green)
-can.setStrokeColor(colors.green)
-can.drawCentredString(x, lgyline, "1")
-drawCentredBox(can,x,y0+1.0*p2i,side)
-
-can.save()

File dotgame1000.py

View file
  • Ignore whitespace
+# the dot game
+# create a pdf for working on concepts of placeholders, units etc.
+from __future__ import division
+from reportlab.pdfgen import canvas
+from reportlab.lib.pagesizes import *
+import reportlab.lib.colors as colors
+
+
+def drawCentredBox(can,x,y,side):
+    p=can.beginPath()
+    s2 = side/2.0
+    p.moveTo(x-s2,y-s2)
+    p.lineTo(x+s2,y-s2)
+    p.lineTo(x+s2,y+s2)
+    p.lineTo(x-s2,y+s2)
+    p.close()
+    can.drawPath(p)
+
+
+#landscape
+pw,ph = letter
+landscape = ph,pw
+pagesize = landscape
+can = canvas.Canvas("wiki/dotgame1000.pdf", pagesize=landscape)
+
+# create a frame
+p = can.beginPath()
+
+
+p2i = 72.0 # 72pt per inch
+x0, y0 = 0.5*p2i, 0.5*p2i
+w, h = pagesize[0]-p2i, pagesize[1]-p2i
+c,d = x0+w, y0+h
+
+p.moveTo(x0,y0)
+p.lineTo(c, y0)
+p.lineTo(c,d)
+p.lineTo(x0,d)
+#p.lineTo(0,0)
+p.close()
+
+can.drawPath(p)
+
+
+# now try to do the little grids
+
+lgy0 = y0+2.0*p2i
+lgy1 = lgy0 + 4.0*p2i
+dy = (lgy1-lgy0)/10.0
+
+lgx0,lgx1 = x0,c
+can.setLineWidth(0.3)
+#p = can.beginPath()
+#p.moveTo(lgx0, lgy0)
+y = lgy0
+for ii in range(11):
+    can.line(lgx0, y, lgx1, y)
+    y += dy
+    print y
+
+# now do vertical lines
+print "frame width: %f" % w
+
+nplaces = 4
+nbox =40
+print "divide by nplaces and then by 10:", w/nplaces, w/float(nbox)
+boxwid = w/float(nbox)
+
+x = x0
+
+for ii in range(nbox):
+    print x
+    if not ii%10 and x != x0:
+        can.setLineWidth(5.0)
+    can.line(x,lgy0, x,lgy1)
+    if not ii%10:
+        can.setLineWidth(0.3)
+    x+= boxwid
+
+side = 1.25*p2i
+can.setFont('Helvetica', 24)
+x=x0+ 5.0*boxwid
+lgyline = lgy1+3.0
+can.setFillColor(colors.green)
+can.setStrokeColor(colors.green)
+can.drawCentredString(x, lgyline, "1000")
+drawCentredBox(can,x,y0+1.0*p2i,side)
+
+x+= 10*boxwid
+can.setFillColor(colors.red)
+can.setStrokeColor(colors.red)
+can.drawCentredString(x, lgyline, "100")
+drawCentredBox(can,x,y0+1.0*p2i,side)
+
+x+= 10*boxwid
+can.setFillColor(colors.blue)
+can.setStrokeColor(colors.blue)
+
+can.drawCentredString(x, lgyline, "10")
+drawCentredBox(can,x,y0+1.0*p2i,side)
+
+x+= 10*boxwid
+can.setFillColor(colors.green)
+can.setStrokeColor(colors.green)
+can.drawCentredString(x, lgyline, "1")
+drawCentredBox(can,x,y0+1.0*p2i,side)
+
+can.save()

File dotgame10000.py

View file
  • Ignore whitespace
+# the dot game
+# create a pdf for working on concepts of placeholders, units etc.
+from __future__ import division
+from reportlab.pdfgen import canvas
+from reportlab.lib.pagesizes import *
+import reportlab.lib.colors as colors
+
+
+def drawCentredBox(can,x,y,side):
+    p=can.beginPath()
+    s2 = side/2.0
+    p.moveTo(x-s2,y-s2)
+    p.lineTo(x+s2,y-s2)
+    p.lineTo(x+s2,y+s2)
+    p.lineTo(x-s2,y+s2)
+    p.close()
+    can.drawPath(p)
+
+
+#landscape
+pw,ph = letter
+landscape = ph,pw
+pagesize = landscape
+can = canvas.Canvas("wiki/dotgame10000.pdf", pagesize=landscape)
+
+# create a frame
+p = can.beginPath()
+
+
+p2i = 72.0 # 72pt per inch
+x0, y0 = 0.5*p2i, 0.5*p2i
+w, h = pagesize[0]-p2i, pagesize[1]-p2i
+c,d = x0+w, y0+h
+
+p.moveTo(x0,y0)
+p.lineTo(c, y0)
+p.lineTo(c,d)
+p.lineTo(x0,d)
+#p.lineTo(0,0)
+p.close()
+
+can.drawPath(p)
+
+
+# now try to do the little grids
+
+lgy0 = y0+2.0*p2i
+lgy1 = lgy0 + 4.0*p2i
+dy = (lgy1-lgy0)/10.0
+
+lgx0,lgx1 = x0,c
+can.setLineWidth(0.4)
+#p = can.beginPath()
+#p.moveTo(lgx0, lgy0)
+y = lgy0
+for ii in range(11):
+    can.line(lgx0, y, lgx1, y)
+    y += dy
+    print y
+
+# now do vertical lines
+print "frame width: %f" % w
+
+nplaces = 5
+nbox = nplaces*10
+print "divide by nplaces and then by 10:", w/nplaces, w/float(nbox)
+boxwid = w/float(nbox)
+
+x = x0
+
+for ii in range(nbox):
+    print x
+    if not ii%10 and x != x0:
+        can.setLineWidth(5.0)
+    can.line(x,lgy0, x,lgy1)
+    if not ii%10:
+        can.setLineWidth(0.4)
+    x+= boxwid
+
+side = 1.25*p2i
+can.setFont('Helvetica', 24)
+x=x0+ 5.0*boxwid
+lgyline = lgy1+3.0
+
+can.setFillColor(colors.blue)
+can.setStrokeColor(colors.blue)
+can.drawCentredString(x, lgyline, "10000")
+drawCentredBox(can,x,y0+1.0*p2i,side)
+x+= 10*boxwid
+
+
+can.setFillColor(colors.green)
+can.setStrokeColor(colors.green)
+can.drawCentredString(x, lgyline, "1000")
+drawCentredBox(can,x,y0+1.0*p2i,side)
+
+x+= 10*boxwid
+can.setFillColor(colors.red)
+can.setStrokeColor(colors.red)
+can.drawCentredString(x, lgyline, "100")
+drawCentredBox(can,x,y0+1.0*p2i,side)
+
+x+= 10*boxwid
+can.setFillColor(colors.blue)
+can.setStrokeColor(colors.blue)
+
+can.drawCentredString(x, lgyline, "10")
+drawCentredBox(can,x,y0+1.0*p2i,side)
+
+x+= 10*boxwid
+can.setFillColor(colors.green)
+can.setStrokeColor(colors.green)
+can.drawCentredString(x, lgyline, "1")
+drawCentredBox(can,x,y0+1.0*p2i,side)
+
+can.save()

File dotgamedynamic.py

  • Ignore whitespace
-# the dot game
-# create a pdf for working on concepts of placeholders, units etc.
-from __future__ import division
-from reportlab.pdfgen import canvas
-from reportlab.lib.pagesizes import *
-import reportlab.lib.colors as colors
-
-
-def drawCentredBox(can,x,y,side):
-    p=can.beginPath()
-    s2 = side/2.0
-    p.moveTo(x-s2,y-s2)
-    p.lineTo(x+s2,y-s2)
-    p.lineTo(x+s2,y+s2)
-    p.lineTo(x-s2,y+s2)
-    p.close()
-    can.drawPath(p)
-
-
-#landscape
-pw,ph = letter
-landscape = ph,pw
-pagesize = landscape
-can = canvas.Canvas("wiki/dotgamedynamic.pdf", pagesize=landscape)
-
-# create a frame
-p = can.beginPath()
-
-
-p2i = 72.0 # 72pt per inch
-x0, y0 = 0.5*p2i, 0.5*p2i
-w, h = pagesize[0]-p2i, pagesize[1]-p2i
-c,d = x0+w, y0+h
-
-p.moveTo(x0,y0)
-p.lineTo(c, y0)
-p.lineTo(c,d)
-p.lineTo(x0,d)
-#p.lineTo(0,0)
-p.close()
-
-can.drawPath(p)
-
-
-# now try to do the little grids
-
-lgy0 = y0+2.0*p2i
-lgy1 = lgy0 + 4.0*p2i
-dy = (lgy1-lgy0)/10.0
-
-lgx0,lgx1 = x0,c
-can.setLineWidth(0.4)
-#p = can.beginPath()
-#p.moveTo(lgx0, lgy0)
-y = lgy0
-for ii in range(11):
-    can.line(lgx0, y, lgx1, y)
-    y += dy
-    print y
-
-# now do vertical lines
-print "frame width: %f" % w
-
-nplaces = 5
-nbox = nplaces*10
-print "divide by nplaces and then by 10:", w/nplaces, w/float(nbox)
-boxwid = w/float(nbox)
-
-x = x0
-
-for ii in range(nbox):
-    print x
-    if not ii%10 and x != x0:
-        can.setLineWidth(5.0)
-    can.line(x,lgy0, x,lgy1)
-    if not ii%10:
-        can.setLineWidth(0.4)
-    x+= boxwid
-
-side = 1.25*p2i
-can.setFont('Helvetica', 24)
-x=x0+ 5.0*boxwid
-lgyline = lgy1+3.0
-
-can.setFillColor(colors.blue)
-can.setStrokeColor(colors.blue)
-can.drawCentredString(x, lgyline, "10000")
-drawCentredBox(can,x,y0+1.0*p2i,side)
-x+= 10*boxwid
-
-
-can.setFillColor(colors.green)
-can.setStrokeColor(colors.green)
-can.drawCentredString(x, lgyline, "1000")
-drawCentredBox(can,x,y0+1.0*p2i,side)
-
-x+= 10*boxwid
-can.setFillColor(colors.red)
-can.setStrokeColor(colors.red)
-can.drawCentredString(x, lgyline, "100")
-drawCentredBox(can,x,y0+1.0*p2i,side)
-
-x+= 10*boxwid
-can.setFillColor(colors.blue)
-can.setStrokeColor(colors.blue)
-
-can.drawCentredString(x, lgyline, "10")
-drawCentredBox(can,x,y0+1.0*p2i,side)
-
-x+= 10*boxwid
-can.setFillColor(colors.green)
-can.setStrokeColor(colors.green)
-can.drawCentredString(x, lgyline, "1")
-drawCentredBox(can,x,y0+1.0*p2i,side)
-
-can.save()