Exemplo n.º 1
0
"""
Author: Jose L Balcazar, ORCID 0000-0003-4248-4528
Copyleft: MIT License (https://en.wikipedia.org/wiki/MIT_License)

Usage of Popeel: example (jul 2017).
"""

from popeel import Popeel

Popeel.set_task(8)  # set the task: please peel 8 potatoes

Popeel.peel_1_potato()  # main operation, peels one potato from the basket

Popeel.refill_basket(
)  # go to the main store and fetch some potatoes with the basket

Popeel.discard_basket()  # returns potatoes from the basket to the main store

Popeel.enough_potatoes()  # Boolean: task achieved?

Popeel.is_basket_empty()  # Boolean: is Popeel's basket out of potatoes?

Popeel.go_sleep()  # Popeel is asleep from that point on
Exemplo n.º 2
0
"""
Author: Jose L Balcazar, ORCID 0000-0003-4248-4528 (feb 2017)
Copyleft: MIT License (https://en.wikipedia.org/wiki/MIT_License)

Ignore this file if you want to contribute to Suverat.

One correct usage of Popeel.

Spoiler. 

Don't read this code.

Hidden in a different project (Suverat) and in some Dropbox so as to
avoid its visibility from the standard Popeel users.
"""

from popeel import Popeel

p = Popeel()
p.set_task(12)
while not p.enough_potatoes():
    if p.basket_is_empty():
        p.refill_basket()
    p.peel_1_potato()
p.discard_basket()
p.go_sleep()
Exemplo n.º 3
0
from popeel import Popeel
popeeler = Popeel()
popeeler.discard_basket()
popeeler.go_sleep()
Exemplo n.º 4
0
"""
Author: Jose L Balcazar, ORCID 0000-0003-4248-4528 (feb 2017)
Copyleft: MIT License (https://en.wikipedia.org/wiki/MIT_License)

Usage of Popeel with no instances: very simple (and wrong) example (jul 2017).
"""

from popeel import Popeel

Popeel.peel_1_potato()

Popeel.go_sleep()