Nelze vybrat více než 25 témat
Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
|
- interface Source
- method next() as word
- end interface
-
- class Counter implements Source
- private word value
- private word[4] seen
-
- public method init(start as word)
- self.value = start
- end method
-
- public method next() as word
- self.value = self.value + 1
- return self.value
- end method
-
- public method twice() as Counter
- return self
- end method
-
- public method fill(n as word)
- var i as word
- var k as integer
- for i = 0 to 3 step 1
- seen[i] = self.next()
- end for
- for k = 3 to 0 step -1
- if seen[k] = 0
- return
- else
- if k > 1 and not (k = 2)
- seen[k] = seen[k - 1]
- end if
- end if
- end for
- while value < n
- value = value + 1
- end while
- end method
- end class
-
- program Main
- var c as Counter
- var s as Source
- var w as word
- c = new Counter((1 + 2) * 3)
- c.fill(c.next())
- c.twice().twice().fill(w)
- s = c
- w = s.next()
- print "done"
- print 'x'
- print true
- print w
- if s <> null
- delete s
- end if
- end program
|