Demo entry 6626019

123123

   

Submitted by anonymous on Jun 23, 2017 at 04:49
Language: Python. Code size: 549 Bytes.

class lift:
    def __init__(self,height):
        self.height = height
        self.now = 0    #当前楼层
        self.direction = 0   #运动方向 上为1 下为-1 停留为0
        self.button = [set(),set()]    #按键状态字典 记录每一层楼上下按钮是否被按下
        self.target ={k:[] for k in range(height)}     #记录电梯中乘客的目的楼层
        self.waiting_up = {k:[] for k in range(height)}     #每层楼等候区 []中为等候人员目标楼层
        self.waiting_down = {k:[] for k in range(height)}     #每层楼等候区 []中为等候人员目标楼层
        self.number = 0
        self.info = ''
self.pad = lambda s: s + ( 11- len(s)) * ' '

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).