[Question]
  [
My electric garage door works like this:
* There is just one push button to control the door
* If the door is fully closed and I hit the button, the door starts to open. It takes 10 seconds to open fully
* If the door is fully open and I hit the button, the door starts to close. It takes 10 seconds to close fully
* If the door is part way through opening or closing and I hit the button, then the door stops and is left partially open.
* Whenever the door stops moving, either from automatic completion of an open or close action, or from manual interruption by pushing the button partway through an action, then the mechanism will reverse and remember its direction for the next action.
* If the button is pushed when the door is stopped but partially open, then the amount of time for it to complete its action will be a fraction of 10 seconds in proportion to the amount it needs to move to complete the action.
Assume the door is fully closed at the start.
An input list of integers will be given. These integers are the number of seconds I wait between successive pushes of the control button.
Output two things:
* a percentage indicating the state of the door once all button pushes are completed and the door has reached a steady state. Output of `%` symbol is optional.
* an unambiguous indication of what direction the door will travel on the next button push. This may be `up`/`down`, `U`/`D`, `+`/`-`, `1`/`0` or whatever you choose.
You may assume the door takes infinitesimally less than 10 seconds to complete an open or close action.
### Example inputs:
```
<empty list>  # button was pushed just once
20            # button was pushed twice with 20 seconds between
10
5
20 20
10 10
5 5
1 2 3
8 9 10 11
11 10 9 8 7
```
### Expected outputs corresponding to above inputs
```
100% D
0% U
0% U
50% D
100% D
100% D
0% U
100% D
0% U
20% U
```
### Worked example of the last test
* Door starts off closed. Button is pushed
* Wait 11 seconds. Door ends up fully opened. Button is pushed.
* Wait 10 seconds. Door ends up fully closed. Button is pushed.
* Wait 9 seconds. Button is pushed. Door stops at 90% open.
* Wait 8 seconds. Button is pushed. Door starts to close.
* Wait 7 seconds. Button is pushed. Door stops at 20% open. Next direction will be up.
  
[Answer]
# Lua, ~~258~~ ~~248~~ 242 bytes
```
u,s,p=1>0,0>1,0;io.read():gsub("%d+",function(a)if(not s)then p=u and p+a or p-a;if(p>=10 or p<=0)then s,p=1>0,p>0 and 10 or 0;end;u,s=not u,not s else s=0>1;end end)if(not s)then p=u and 10 or 0;u=not u;end;print(10*p.."% "..(u and"U"or"D"))
```
### Ungolfed
```
u,s,p=true,false,0;                          -- Up direction, Stopped, Position
io.read():gsub("%d+",function(t)             -- For each number in input
    if(not s)then                            -- If door wasn't stopped
        p=u and p+t or p-t;                  -- Position = Moving up ? +t : -t
        if(p>=10 or p<=0)then                -- If door fully opened or closed
            s,p=true,p>0 and 10 or 0;        -- Then door stopped at 0 or 10
        end 
        u,s=not u,not s;                     -- Toggle direction and toggle stopped
    else 
        s=false;                             -- If stopped, nothing happened, un-stop.
    end 
end)
-------------------- Done pressing the button --------------------
if(not s)then                                -- If left off moving
    p=u and 10 or 0;                         -- Finish movement
    u=not u;                                 -- Toggle direction
end 
print(10*p.."% "..(u and"U"or"D"))           -- Output answer
```
~~I don't see how your test cases can be right...~~
```
20 20 -- Initial push, after 20, garage is at 100, push to start it down, after 20, garage is at 0, push to start it up, garage finishes up.
10 10 -- Same as above
1 2 3 -- 0 U Moving, wait 1, 1 D Stopped, wait 2, 0 U stopped, wait 3, 100 D stopped
```
 OP Fixed
[Answer]
# Pyth, ~~50~~ ~~45~~ 39 bytes
6 bytes thanks to Sp3000.
```
J1,*Tu@S[0T+?|!%GTZ+=Z0*H~_J~Z1G)1+QT0J
```
[Test suite.](http://pyth.herokuapp.com/?code=J1%2C*Tu%40S%5B0T%2B%3F%7C!%25GTZ%2B%3DZ0*H%7E_J%7EZ1G%291%2BQT0J&test_suite=1&test_suite_input=%5B%5D%0A%5B20%5D%0A%5B10%5D%0A%5B5%5D%0A%5B20%2C20%5D%0A%5B10%2C10%5D%0A%5B5%2C5%5D%0A%5B1%2C2%2C3%5D%0A%5B8%2C9%2C10%2C11%5D%0A%5B11%2C10%2C9%2C8%2C7%5D&debug=0)
[Answer]
## JavaScript (ES6), ~~109~~ 106 bytes
```
a=>a.map(e=>(s^=1)?(r-=e*(d=-d))>9?(s=0,r=10):r<1?(r=s=0):r:r,r=s=0,d=1)&&(s?r:5*++d)*10+(d-s?"% D":"% U")
```
[Answer]
# Ruby, 152 bytes
```
->v{u,s,a=!!1,!0,0;v.map{|w|!s ?(a=u ? a+w : a-w;a>=10 ?(s,a=!!1,10):a<=0 ?(s,a=!!1,0):0;u,s=!u,!s):s=!0};!s ?(a=(u=!u)?0:10):0;p"#{10*a}% #{u ??U:?D}"}
```
**Test cases:**
```
f=->v{u,s,a=!!1,!0,0;v.map{|w|!s ?(a=u ? a+w : a-w;a>=10 ?(s,a=!!1,10):a<=0 ?(s,a=!!1,0):0;u,s=!u,!s):s=!0};!s ?(a=(u=!u)?0:10):0;p"#{10*a}% #{u ??U:?D}"}
f[[]]            # => "100% D"
f[[20]]          # => "0% U"
f[[10]]          # => "0% U"
f[[5]]           # => "50% D"
f[[20,20]]       # => "100% D"
f[[10,10]]       # => "100% D"
f[[5,5]]         # => "0% U"
f[[1,2,3]]       # => "100% D"
f[[8,9,10,11]]   # => "0% U"
f[[11,10,9,8,7]] # => "20% U"
```
[Answer]
# Python 3.5, ~~193~~ ~~187~~ ~~185~~ ~~181~~ ~~175~~ ~~173~~ 172 bytes:
```
def G(*p):
 O=100;y=0;l=10;z,v='UG'
 for g in[*p,O]:
  if v=='G':Q=O*g//10;y=min(max(0,[Q,y-Q][z=='D']),O);l=min(10,g);z='UD'[z=='U']
  v='GS'[(O>y>0)*(v!='S')]
 print(y,z)
```
Takes input in the form of comma separated numbers, for instance `1,2,3,4,5` or even `1.2,3.4,7.8,9.2`. Outputs whether the door in the next step is going up or down with `U` or `D`, respectively. Will golf more over time.
[Try It Online! (Ideone)](http://ideone.com/erHCRB) (Here the input is taken in the form of a list consisting of comma separated numbers, e.g. `[1,2,3,4,5]`.)
[Answer]
# PHP, ~~128~~ 120 bytes
```
$d=$argv[]=10;
foreach($argv as$a)
  if($r){$p=min(max($p+$a*$d,0),100);$r=$p<1||99<$p;$d=-$d;}else$r=1;
echo"$p% ".DU[$d>0];
```
The code is wrapped here to fit in the code box. Put everything on a single line, put the PHP open marker in front of it and save it into a file. Or run it from the command line using `php -d error_reporting=0 -r '...the code...' [arguments]`.
The ungolfed source code, the test suite and examples of usage can be found on [github](https://github.com/axiac/code-golf/blob/master/is-the-electric-garage-door-open.php).
]