Wir sind die Flo: Unterschied zwischen den Versionen

aus dem Wiki des Entropia e.V., CCC Karlsruhe
(→‎Bewertung: wartungsfreundlich!)
Zeile 111: Zeile 111:
</pre>
</pre>
=== Bewertung ===
=== Bewertung ===
Bewertungsrichtlinien 0.1
Bewertungsrichtlinien 0.2


* Zeilenzahl (100-x) relativ Referenzimplementierung: 100-100 = '''0'''
* Zeilenzahl (100-x) relativ Referenzimplementierung: 100-100 = '''0'''
Zeile 117: Zeile 117:
* Bonus (100) Foto/Icon-Auswahl der Flos : '''0'''
* Bonus (100) Foto/Icon-Auswahl der Flos : '''0'''
* Bonus (100) Feature Rückberechnung (aus römischer Notierung): '''0'''
* Bonus (100) Feature Rückberechnung (aus römischer Notierung): '''0'''
* Faktor Anzahl Programmiersprachen: *1 = 10
* Bonus (20)  Wartungsfreundlichkeit: '''20'''
* Faktor Anzahl Programmiersprachen: *1 = 30


* Summe: '''10'''
* Summe: '''30'''

Version vom 4. April 2012, 08:43 Uhr

Specs 0.1

Wir-sind-die-flo.png
  • Flos auswählen => Flozählung berechnen, z.B. Dividuum(Flo0) + Flowhase(Flo3) = 2^0 + 2^3 = 9
  • Flozählung korrekt anzeigen in einer Dialogbox mit OK-Button, in römischen Zahlen (Namespace!), also FLOIX.
  • Codegflo nach Neingeists Bewertungsskala

Referenzimplementierung 0.1 in Python

#!/usr/bin/python

import pygtk
pygtk.require('2.0')
import gtk

flos = [
        "dividuum", 
        "syb", 
        "fiji", 
        "flowhase", 
        "florolf", 
        "piratenflo"
       ]

class WirSindDieFlo:

  flobutts = []

  def format_roman(self, case, counter):
    ones = ['i', 'x', 'c', 'm']
    fives = ['v', 'l', 'd']
    label, index = '', 0
    # This will die of IndexError when counter is too big
    while counter > 0:
        counter, x = divmod(counter, 10)
        if x == 9:
            label = ones[index] + ones[index+1] + label
        elif x == 4:
            label = ones[index] + fives[index] + label
        else:
            if x >= 5:
                s = fives[index]
                x = x-5
            else:
                s = ''
            s = s + ones[index]*x
            label = s + label
        index = index + 1
    if case == 'I':
        return label.upper()
    return label

  def floberechnungscallback(self, widget, data=None):
    i = 0
    flozaehlung = 0

    for flobutt in self.flobutts:
      if flobutt.get_active():
        flozaehlung += pow(2, i)
      i += 1

    diaflog = gtk.Dialog("Wir sind die Flo!",
                         None,
                         gtk.DIALOG_DESTROY_WITH_PARENT,
                         (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
    flolabel = gtk.Label("Wir sind die FLO" 
                         + self.format_roman("I", flozaehlung)
                         + ".")
    flolabel.show()
    diaflog.vbox.pack_start(flolabel)
    diaflog.show()
    diaflog.run()
    diaflog.destroy()

  def delete_event(self, widget, data=None):
    gtk.main_quit()
    return False

  def __init__(self):
    self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
    self.window.set_title("Wir sind die Flo?")
    self.window.set_border_width(20)
    self.window.connect("delete_event", self.delete_event)

    vbox = gtk.VBox(True, 2)
    self.window.add(vbox)

    for flo in flos:
      cbut = gtk.CheckButton(flo)
      vbox.pack_start(cbut)
      cbut.show()

      self.flobutts.append(cbut)

    but = gtk.Button("Wir sind die Flo?")
    but.connect("clicked", self.floberechnungscallback,)
    vbox.pack_start(but)
    but.show()

    vbox.show()
    self.window.show()

def main():
  gtk.main()
  return 0

if __name__ == "__main__":
  WirSindDieFlo()
  main()

Bewertung

Bewertungsrichtlinien 0.2

  • Zeilenzahl (100-x) relativ Referenzimplementierung: 100-100 = 0
  • Bonus (10) kein Overflo: 10
  • Bonus (100) Foto/Icon-Auswahl der Flos : 0
  • Bonus (100) Feature Rückberechnung (aus römischer Notierung): 0
  • Bonus (20) Wartungsfreundlichkeit: 20
  • Faktor Anzahl Programmiersprachen: *1 = 30
  • Summe: 30