text:
Can you outgolf me? (Cops section)
Cops section
The robbers section can be found here.
Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.

Challenge
Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4, so that is not allowed), and when given n (using STDIN/function arguments/etc.), compute a(n) where a is an OEIS sequence of your choice. One of those programs is shorter than the other. You only need to submit the longer program of the two. The other one needs to be saved in case of not being cracked after 7 days. Your submission is cracked when your program has been outgolfed (whether it is by 1 byte or more).
For example, if the task you chose was to perform 2 × n, this could be a valid submission (in Python 2):

Python 2, 16 bytes, score = 15 / 16 = 0.9375
print(2*input())

Computes A005843, (offset = 0).

If your submission has been cracked, then you need to state that in your header like so:

Python 2, 16 bytes, score = 15 / 16 = 0.9375, [cracked] + link
print(2*input())

Computes A005843, (offset = 0).

Offset
This can be found on every OEIS page. For example, for A005843, the offset is 0,2. We only need to use the first one, which is 0. This means that the function is defined for all numbers ≥ 0.
In other words, the function OEIS(n) starts with n = 0. Your program needs to work for all cases given by OEIS.
More information can be found here.

Scoring
The score you get for your submission is equal to the following formula:
Score = Length (in bytes) of secret code ÷ Length (in bytes) of public code
The example above has the score 15 ÷ 16 = 0.9375.
The submission with the lowest score wins. Only submissions that have posted their solution will be eligible for winning.

Rules

The task you need to do is an OEIS sequence of your choice.
Given n, output OEIS(n). Deviation is not allowed, so you need to produce the exact same sequence (when given n, you need to output OEIS(n)).
Submissions that are not cracked within a period of 7 days are considered safe after the solution has been posted (submissions older than 7 days that do not have their solution posted are still vulnerable in being cracked).
In your submission, you need to post the following things: language name, byte count, full code, so no pastebin links etc. (to prevent answers like Unary), OEIS sequence, score with lengths of both programs and additionally, the encoding that is used.
Note: the same sequence cannot be posted twice in the same language. (For example, if the sequence A005843 has been done in Pyth, you cannot use Pyth again for that same sequence.)
Input and output are both in decimal (base 10)

Leaderboard

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/Sites/codegolf/all.css?v=7509797c03ea">

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

Note
This challenge is finished. The final winner is feersum with his Seed answer. Congratulations! :).
You can still submit new cops, but be aware that they are no longer competing.

Do I understand the rules right that if I come up with a 30-byte program and post a 40-byte program, someone who writes a 39-byte program couns as cracking it?

@xnor Yes, that is correct

@Andan That seems unfortunate. Say I write a golf with multiple clever tricks that improve on the obvious formula. If I post the obvious formula, anyone can find one improvement and win. Or, I have to tip my hand and give away all the improvements but one. Would you consider changing this, if it's not too late? Sorry for not thinking of this in this sandbox, I only noticed when trying the challenge in earnest.

@xnor Hmm, that would cause a big problem with the scoring mechanism. You can then make an arbitirarily large submission and an almost impossible short one, and win the challenge.

@Adnan You could solve that by defining score = len(secret code)/min {len(public code), len(shortest code posted by robbers)}.

@AndersKaseorg The score doesn't count if a robber has cracked your submission.

@Adnan The context is xnor’s suggestion to make the score count if the robbers beat your public score but do not match your secret score. I’m proposing a way to make that work while avoiding the problem you’re concerned about.

If someone cracks my submission, but hasn't found the shortest possible program (the intended solution), can I update the post with a shorter version?

@xsot I'm going to say no, because that would fall under the last rule of the challenge.

@AndersKaseorg I'm pretty sure that goes against the rules of a [tag:cops-and-robbers] challenge. That means that you can easily win the challenge by simply submitting a lot of entries.

Yeah, finally another Cooooops and Rooooobbbbbers challenge.

If you can golf it any further (public or a secret) could you change the answer?

@muddyfish In chat, we have decided that you can golf your private answer before you reveal it. Your public answer must remain the same.

@DerpfacePython For all terms given at OEIS when you press on list after the sequence. (Like this)

Would it be acceptable to use my new language, Woefully?

@DestructibleWatermelon You can use it, however it won't be competing since the language postdates the challenge.

._. well, does the person who cracks it get points?

@DestructibleWatermelon Yes, the cracker does receive the points.

Seed, 5861 bytes, score = 5012 / 5861 = 0.85
The sequence is primes (A000040) with offset 1. a(1) = 2, a(2) = 3, a(3) = 5 etc.
106 [encoded data, 5857 characters]

The Befunge-98 programs were tested with this interpreter.
Solution:
62 [encoded data, 5009 characters]

This would take centuries to crack o_____O

The Right Language for the Challenge ™

Jelly, 5 bytes, score 0.8 (4 / 5) [cracked!]
R²SÆ½

Computes A127721.
Try it online!

Here's the solution:
RÆḊḞ

implicitly take input n
R: list from [1, 2, ..., n]
ÆḊ: In our case, this will actually return the square root of the sum of squares (which may be useful in future golfing)!
Ḟ: floor the result.

The documentation for ÆḊ reads:

ÆḊ: Determinant, extended to non-square matrices.

The key is extended to non-square matrices. The "determinant" of a non-square matrix is usually undefined, but one reasonable definition is sqrt(det(A A^T)) (which for a square matrix reduces to |det(A)|). In our case, A A^T is a 1 x 1 matrix containing the sum of squares. The square root of the determinant of that gives us exactly what we need to shave off the last byte!

Welcome to Programming Puzzles and Code Golf!

Just out of curiosity, is this actually possible in 4 bytes? I've been stuck on this for hours :p.

@Adnan, yes it's possible. Glad to hear you're finding it challenging!

Cracked.

@jimmy23013, yup, nicely done!

Retina, 28 bytes, score = 0.9286... (26/28), cracked by feersum
.+
$*
^$|^((^|\3)(^.|\1))*.$

Computes A192687, (offset = 0).
Try it online! (The first line enables a linefeed-separated test suite.)
This is the difference between Hofstadter's male and female sequences. (Relevant PPCG challenge.)
This was my original code:
.+
$*
^((^.|\3)(\1)|){2,}$

This answer was a bit of a gamble anyway, because the actual solution is based on a regex I announced to be the shortest known Fibonacci-testing regex in chat a few months ago. Luckily, no one seemed to remember that. :)

Cracked

Stack Cats, 14 bytes, score = 13 / 14 = 0.929 [cracked]
That's 10 bytes of code, plus 4 for the arguments  -nm.
Computes A017053. In case OEIS is down, that's a(n) = 7n + 6, starting at n = 0.
![_-_:-_-_

The full code (usable without -m argument) is ![_-_:-_-_-_-:_-_]!
The hidden solution was
!]|{_+:}_

Cracked

Hexagony, 91 bytes, Score = 0.725274725 (66/91) [Cracked]
Computes A000045 (Fibonacci sequence, offset 0).
I won't be too surprised if someone manages to beat this and my more golfed version, although it should be hard.
Edit: Holy cow, @MartinEnder whipped me with a 33 byte solution.
Golfed (91):
?\]~<~.{>'"/(@{\''1<{!1>{{1}/}{'\1</={}/_\'0"/>+(}\/}(+'+'%=<>=%"=+("\/+"(+}+<>{{}=~\.....|

Formatted:
      ? \ ] ~ < ~
     . { > ' " / (
    @ { \ ' ' 1 < {
   ! 1 > { { 1 } / }
  { ' \ 1 < / = { } /
 _ \ ' 0 " / > + ( } \
  / } ( + ' + ' % = <
   > = % " = + ( " \
    / + " ( + } + <
     > { { } = ~ \
      . . . . . |

Try it online!
I'm not going to post an explanation for this, it's too horrible...
Golfed (66):
?{1}]0@._.>\>+{./'++.!.|.*'}..\}{\=++.../'"<_}\"+<./{(/\=*"=/>{=+"

Formatted:
      ? { 1 } ] 0
     @ . _ . > \ >
    + { . / ' + + .
   ! . | . * ' } . .
  \ } { \ = + + . . .
 / ' " < _ } \ " + < .
  / { ( / \ = * " = /
   > { = + " . . . .
    . . . . . . . .
     . . . . . . .
      . . . . . .

Colored:

Try it online!
Explanation:
The memory layout I used looks a little like this:
   |
   a
   |
  / \
b+a  b
/     \
      |
    input

The initialization (in black) sets a=0 and b=1. Then, the main loop:

goes from a to the input cell - '"
decrements the input - (
adds b and a - {{=+
moves it "out of the way" - "+{=*
sets a to b - '+
moves a "out of the way" - '+}=*
moves b+a back to its original position - "=+
sets b to b+a - "+
moves a back to its original position - }+

Once the input cell reaches 0, the MP moves to a, prints, and exits.
What I could have done to save more bytes is to use &, which just sets the current cell to either its left or right neighbor. I also could have had a bit better flow control, but it's okay as it stands.

Cracked. Thanks for getting me to write a Fibonacci program. Not sure why I haven't done that before. :)

Actually, what I'm using & for is to move the input around the a/b/a+b edges so that they swap their roles on the next iteration. That I way, I don't need to move a, b and a+b around at all.

@MartinEnder Sorry, I wrote that part before looking at what your program actually did. Your solution is much more clever

M, 10 bytes, score 0.6 (6 / 10) [cracked]
R‘ạḤc’*@RP

A tad cheaty since M and Jelly are quite similar, but allowed by the rules. This version is based on @LeakyNun's crack to my Jelly answer.
This calculates sequence A068943. Try it online!
Intended solution
The following code works in M/Jelly.
R¹¡PÐL

I actually had a 4-byte solution to which I added some fluff to make it seem more difficult to crack by using brute force.
R¡FP

Try it online!
This is the one I'm going to explain.
R¡FP  Main link. Argument: n

 ¡    Execute the left to the left n times, updating the return value.
R       Range; map each integer k to [1, ..., k].
      This does the following for the first values of n.
        1 → [1]
        2 → [1,2]   → [[1],[1,2]]
        3 → [1,2,3] → [[1],[1,2],[1,2,3]] → [[[1]],[[1],[1,2]],[[1],[1,2],[1,2,3]]]
  F   Flatten the resulting, nested array.
   P  Take the product of the reulting array of integers.

Cracked! It was fun!

Snowman, 50 bytes, score = 0.9 (45 / 50) [cracked by Lynn]
((}#NDe`nOnO|`2nMNdE0nR2aGaZ::nM;aF;aM:nS;aF,nM*))

This is a subroutine that takes a number as its argument and returns another number.
Computes A122649 (offset = 1).
Try it online!

What is the calling convention for so-called "subroutines"?

Cracked!

Haskell, 15 bytes, score = 13/15 (0.866) (cracked)
f x=1+2*div x 2

A109613 with offset 0. Repeats each odd number twice.
1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, ...

Cracked

Brachylog, 27 bytes, score = 0.666... (18/27), Cracked!
+ybL:L:[1]co~c[A:B]hl-?,A*.

Computes A010551 (offset = 0).
You can try it online here.
Explanation
Since the vast majority of people don't know this language, and since I'm posting this answer mostly to get people looking into it (See: Brachylog's Wiki), I'll provide a short explanation of the code above:
+           Add 1 to the input N
ybL         L = [1, 2, ..., N+1]
:L:[1]c     Construct a list [1, 2, ..., N+1, 1, 2, ..., N+1, 1]
o           Sort the list from smallest to biggest
~c[A:B]     A concatenated to B results in that sorted list
hl-?,       The length of A is N + 1
A*.         The output is the result of the product of all elements of A

Cracked!

Haskell, 4 bytes / 5 bytes (cracked by Leaky Nun)
Let's start simple. A000012, the sequence of all 1's (offset 0). Here's a table:
0 -> 1
1 -> 1
2 -> 1
3 -> 1
4 -> 1
 ...

5 bytes:
f n=1

Cracked!

Java 7, 53 bytes, score = 0.9623 (51/53) Cracked
int f(int n){return n<1?3:n<2?0:n<3?2:f(n-2)+f(n-3);}

Computes the Perrin sequence, A001608
f(0)=3
f(1)=0
f(2)=2
f(n)=f(n-2)+f(n-3)

First code golf attempt, feel free to point out any mistakes.
Explanation after cracking:
miles shortened the first three values (0,1,2) -> (3,0,2) to
n<2?3-3*n:n<3?2

while my own solution was a slightly over-engineered
n<3?(n+4)%5*2%5

Combining the two tricks, you get
n<3?3-3*n%5

for a 47-byte
int k(int n){return n<3?3-3*n%5:f(n-2)+f(n-3);}

which looks pretty compact for Java :)

Cracked!

Cheddar, 7 bytes, score = 0.8571 (6/7), [cracked]
n->2**n

Pretty simple, just the powers of two. OEIS A000079
Try it online!

Uh, language creators are at an advantage here...

Especially language creators whose languages are sorely lacking in documentation.

Cracked (?)

@Mego is self documenting code not considered docs? The code reviewers lied to me! D:<

@Downgoat When you have a link on your website called "Documentation" and it's woefully incomplete... Yeah.

@feersum yup, nice!

J, 17 bytes, score = 0.8235 (14/17) (cracked)
(+/@(!+:)&i.-)@>:

Computes A002478.
The funny thing is that this version was originally the short one to be kept secret.

Cracked!

Pyke, 11 bytes, score = 0.45 (5/11) [cracked]
hZRVoeX*oe+

Calculates OEIS A180255
Try it here!

I wanted to have a go at this one but the documentation for the language isn't very enlightening. (e.g. Z is undocumented; the language claims to be stack-based but after the * there are only zeros on the stack despite it having an effect on the rest of the code; order of parameters is not clearly specified)

@Score_Under what could I do to improve it? - Perfectly happy to discuss in a chat room about what's unclear

Sure. I don't know how to start a chat but I've edited my above comment with some examples - I thought I'd be able to get it in before you read it ;)

@Score_Under http://chat.stackexchange.com/rooms/43566/pyke-language

To anyone else reading, I'll be happy to respond to queries about the language in that chat room (but only when I'm awake)

Cracked.

Python 2, 43 bytes, score = 0.9302 (40/43), cracked
f=lambda n:n==1or-(-sum(map(f,range(n)))/3)
Computes A072493
Let's see if anybody can golf off all 3 bytes.

Wait, is it really okay if True is used to represent 1?

Cracked

s=1;exec"a=-(-s/3);s+=a;"*input();print a for 41.

@R.Kap yes, it is. Any value that is truthy (if x is true) is a valid return.

Brachylog, 11 bytes, score = 10 / 11 = 0.909, cracked!
ybLrb:Lrcc.

Computes A173426.
Try it online!
Explanation
ybL      L = [1, 2, …, Input]
rb       Get [Input - 1, …, 2, 1]
:Lrc     Concatenate [1, 2, …, Input] and [Input - 1, …, 2, 1]
c.       Concatenate [1, 2, …, Input, Input - 1, …, 2, 1] into a single integer

Cracked!

Jelly, 9 bytes, score 0.5556 (5 / 9) [cracked]
r©0+’Ac®Ḅ

This calculates sequence A119259. Try it online!

Cracked, but barely.

J, 20 bytes, score = 0.75 (15/20) (cracked)
[:*/0 1(]{:,+/)^:[~]

Computes A001654.
My solution for 15 bytes was
*&(+/@:!&i.-)>:

cracked

Sesos, 14 bytes, score = 0.8571 (12/14) (cracked)
0000000: 16f8be 760e1e 7c5f3b 07ddc7 ce3f                  ...v..|_;....?

Computes A000290.
Try it online!
Hints
This binary file has been generated by the following assembler:
set numin
set numout
get
jmp,sub 1,fwd 1,add 1,fwd 1,add 1,rwd 2,jnz
fwd 1
jmp
  sub 1,fwd 1
  jmp,sub 1,fwd 1,add 1,fwd 1,add 1,rwd 2,jnz
  fwd 1
  jmp,sub 1,rwd 1,add 1,fwd 1,jnz
  rwd 2
jnz
fwd 3
put

Cracked!

MarioLANG, 87 bytes, score = 0.839 (73/87), cracked
;
)-)+(< >>
-)===" ""====
>>+([!)( >-(+(
"====#[(("== [
!-) - <!!![)<<)
#======###====:

Computes A000217, the triangular numbers. Offset 0.
Try it online!
Short Solution:
Since the crack took only 1 byte off, I'll share my solution in 73 bytes, which uses a different algorithm altogether:
;   +)-<
-   (=="
+)-<(
(=="+
> [!>)[!(
"==#===#[
!    -  <))
#=========:

Try it online!
The first program lays out all the numbers from n to 1 along the tape, then adds up all numbers until it comes across a 0-value cell. It does this by copying each cell into the two adjacent cells, decrementing the right copy, and repeating the process on it until it reaches 0. During this process, the tape looks like this (for n=5):
0 0 5 0 0 0 0
0 5 0 5 0 0 0
0 5 0 4 0 0 0
0 5 4 0 4 0 0
0 5 4 0 3 0 0
0 5 4 3 0 3 0
0 5 4 3 0 2 0
0 5 4 3 2 0 2

... and so on. Then it moves left, summing the cells until it reaches a cell with 0.
The second program only works with three cells of the tape. Until the first cell reaches 0, it does the following:

Move the value of the first cell to the second cell.
Decrement the second cell to 0, adding its own value to the first and third cells.
Decrement the first cell.

After the first cell reaches 0, the third cell will contain n + (n-1) + (n-2) + ... + 2 + 1.

Does your 87 byte version work in another interpreter? The one on Tio! seems to require a trailing newline...

@Dennis: It does work on the Ruby interpreter without the newline. For whatever reason, the interpreter on TIO won't output from a : if it's on the bottom line, which is why I included the trailing newline in the link. Martin and I discussed this in another one of my MarioLANG answers.

OK, just checking. I've added wrapper for Tio! that appends a newline to the source code.

cracked I think (not sure though)

MATL, 11 bytes, score = 0.8181 (9/11), cracked
YftdA-1bn^*

Computes the Möbius function, or A087811 (offset 1).
Try it online!
Resources for robbers
I think this one should be easy, but anyway here is some help.
Code explanation:
Yf     % Implicit input. Push array of prime factors, with repetitions
t      % Duplicate
d      % Compute consecutive differences
A      % 1 if all those differences are nonzero, 0 otherwise
-1     % Push -1
b      % Bubble up array of prime factors to the top of the stack
n      % Number of elements
^      % -1 raised to that
*      % Multiply. Implicitly display

Language documentation.
MATL chatroom.

Cracked

@feersum Well done! For reference, the 9-byte version was YftdA_wn^

Jelly, 11 bytes, score 0.5455 (6 / 11) [cracked]
Ḷ+’cḶ
r1*ÇP

This calculates sequence A068943. Try it online!

Cracked

M, 18 bytes, score 0.3889 (7 / 18) [cracked]
r0+c
‘Ḥc0r$×Ç:‘+\S

This approach is based on @Sp3000's golf of my Jelly answer.
The code calculates sequence A116881 (row sums of CM(1,2)). Try it online!

Cracked

Haskell, 28 bytes, score = 0.3571 (10/28), cracked
f n|odd n=1|1>0=2*f(div n 2)

A006519, the highest power of 2 dividing n, starting at n=1.
1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 16, 1, ...

While you get cracking credit for any shorter code, I consider the real puzzle to be getting down to 10 bytes.

my try.

@nimi Congrats, you got it.

05AB1E, 9 bytes, score = 0.6667 (6/9), Cracked
ÐnŠ·sÉO4/

Computes: A087811
Try it online

Cracked!

Hexagony, 7 bytes, score = 0.857 (6/7), cracked
Not designed to be the winning submission, but definitely a brain cracker. It actually isn't that hard if you think about it :p. Code:
\!?__@(

Or a more readable version:
 \ !
? _ _
 @ (

Computes A052246.
Try it online!.

Cracked,

M, 9 bytes, score 0.6667 (6 / 9) [cracked]
r©0+’Ac®Ḅ

A tad cheaty since M and Jelly are quite similar, but allowed by the rules. @miles' crack to my Jelly answer doesn't work in M; it lacks the œċ atom.
This calculates sequence A119259. Try it online!

Cracked

I had started to hope this one would survive... Well done.

J, 10 bytes, score = 0.9 (9/10) (cracked by Dennis)
*2%~3<:@*]

Computes A000326.
This one should be easy.
Online interpreter.
Quickref.

Cracked.

J, 9 bytes, score = 0.6667 (6/9) (cracked by Dennis)
9 o.0j1^]

Computes A056594.

Cracked.

@Dennis dang, you beat me to it.

05AB1E, 7 bytes, score = 0.571 (4/7), Cracked
0s·Ì3c;

Computes: A006331
Try it online
After golfing 5 unique versions of this sequence before finding this public version I hope I haven't left any obvious improvement out there so it'll at least be a challenge for the robbers.

Cracked.

QBasic (QB64), 30 bytes, score = 28 / 30 = 0.9333 (cracked)
INPUT n:p=n MOD 2:?p*n+(n+p)/2

Computes A014682, a version of the Collatz function (offset 0).
This works on the QB64 emulator with autoformatting turned off. It should work on actual QBasic as well, but I don't have a copy to test it.

My 28-byte version used a bitwise operator and integer division:
INPUT n:?(1AND n)*n+(n+.5)\2

Cracked

So "integer division" is floating-point division followed by round to nearest? Funny :)

@feersum Even curiouser, actually: it appears to be round to nearest followed by integer division. For example, 1.4\2 gives 0, but 1.6\2 gives 1. I can't confirm whether that's how it works in actual QBasic or if it's a QB64 quirk, but it's weird, in any case.  ... Which just made me realize that I could have used 1 instead of .5, for 27 bytes.  D'oh!

Acc!!, 526 bytes, score = 0.5627 (296/526) (cracked)
N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3^(1+i%2)
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_+_/100^i*100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A000204, Lucas numbers with offset 1.
A couple of notes. Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:
> python acc.py Program.txt
5.
11

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 14 (takes 60 seconds on my laptop). However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.
Have fun!

cracked (barely)

Python, 46 bytes, score = 0.97826 (45 / 46) [cracked]
f=lambda n,k=1:n and-~f(n-("01"in bin(k)),k+1)

Calculates A101082 (offset = 1), which are:

Numbers n such that binary representation contains bit strings "10" and "01" (possibly overlapping).

@Dennis cracked the submission as intended, which was to replace "01"in bin(k) with some bit twiddling, namely (k&-k)+k&k>0, to check that k's binary representation isn't of the form 111...111000...000.

cracked

Acc!!, 512 bytes, score = 0.5625 (288 ÷ 512) (cracked)
Fourth try. Let's see how fast Dennis cracks this one. (Edit: 8 minutes, that's a record!)
N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/30
Count i while _/27^i {
_+(_/27^i*26-18)*27^i
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+27^k*3^(i%2)*78
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+2-j {
_+(_%10-_/100^j%10)*(100^j-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A002878, Lucas(2*n+1), offset = 0.
Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:
> python acc.py Program.txt
3.
29

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 7. However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.

cracked

@Dennis Hey, fastest yet!

Woefully, (noncompeting, but you still get points for cracking it), 520/776= ~0.67 Cracked by Feersum.
Computes A000042 (would compute repunits, but that one has 0 as first member)
Offset 1, zero indexed (0 outputs 1, 1 outputs 11, 2 outputs 111, etc.)
| |||||||| | |
|| |||||| |
||| |||| |
|||| || |
||||| || |
|||| |||| |
||| |||||| |
|| |||||||| |
| |||||||||| |
|| ||||||||| |
||| |||||||| |
|||||||||||| |
|||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
|||||||||| |
|||||||||| |
|||||||||| |
||||||||||| |
|||||||||||| |
||||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
|||| |
||| |
|| |
|| |
|| |
| |
| |
| |
| |
| |
|| |
|| |
|| |
||| |
|||| |
||||| |
|||||| |
||||||| |
|||||||| |
||||||| |
|||||||| |
||||||||| |
|||||||||| |
||||||||||| |
|||||||||||| |
||||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
|||| |
||| |
|| |
|| |
|| |
|| |
||| |
|||| |
||| |
|| |
| |
| |
| |
|| |
|| |
|| |
|| |

Try it online!

I like to think that my shorter solution was a pretty nice one.
| || || |
|| || |
||| || |
|||| || |
||||| || |
|||| |||| |
||| ||||| |
|| |||||| |
| ||||||| |
|| |||||| |
||| ||||| |
||| |||| |
|||| || |
||| ||| |
|| |||| |
| ||||| |
|||||||| |
||||||||| |
|||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
||||| |
||||| |
|||| |
|||| |
|||| |
|||| |
|||| |
||| |
||| |
||| |
|||| |
|||| |
||||| |
||||| |
|||||| |
||||| |
|||| |
||| |
|| |
| |
| |
| |
| |
|| |
||| |
||| |
|||| |
||| |
|| |
| |
| |
| |
|| |
|| |
|| |
|| |
||| |
||| |
|||| |
||| |
|| |
| |

What I did was remove the push one command from the top, replace it at the bottom and at the end of the first command, which was free because I just had to replace some pipes, which then allowed me to shorten the push nine commands some more, because it didn't need to move that much anymore

This TIO link is way too long o_o

Cracked

J, 12 bytes, score = 0.9167 (11/12) (cracked)
(#++/)@I.@#:

Computes A230877.

Cracked

J, 18 bytes, score = 0.7222 (13/18) (cracked)
0{]1&(}.],+/)2 1"_

Computes the Lucas numbers, A000032.

Cracked

Sesos, 14 bytes, score =  0.6429 (9/14) (cracked)
0000000: aed40b b47bc2 8e01be 8e9ddb b107                  ....{.........

Computes A130909.
Try it online!

Cracked again :>

You need to include the score in the header of your submission.

05AB1E, 13 bytes, score = 0.769 (10 ÷ 13), cracked
This one isn't too hard either. Code:
µN•vÉ•vyK}g_½

Calculates A001742 (offset = 1).
Try it online!.

Cracked. Gonna keep working on that 10 byte solution for a while.

Python (3.4.3), 77 bytes, score = 0.7272 (56/77) cracked
import math;lambda x: 1 if x==0 else (0 if ((math.sqrt(1+8*x)-1)/2)%1 else 1)

Computes A010054, offset = 0

Cracked

Coffeescript, 83 bytes, score = 79/83 = 0.952 [cracked!]
r=(n)->return if r<0 then 0 else Array(parseInt(n/9)+2).join ((n-1)%9+1).toString()

Computes A010785.
(Not so) Surprisingly, @DomHastings managed to shave 33 bytes off of my solution.
Wow, I suck at code-golf, don't I? Well, here's my other code:
r=(n)->return if r<0 then 0 else ((n-1)%9+1).toString().repeat(parseInt(n/9)+2)

Here's a less messy version of the code:
r=(n)->
  if r<0
   return 0
  else
   ((n-1)%9+1).toString().repeat(parseInt(n/9)+2)
   # ((n-1)%9+1).toString() is the repeating digit (as a string).
   # parseInt(n/9)+2 is the times the digit is repeated.

Cracked.

Python 3.5, 38 bytes, Score = 0.86842 (33/38) (Cracked):
G=lambda n:n<1and 1or(2*n-1)**2*G(n-1)

Computes A001818.
Try It Online! (Ideone)

Cracked

05AB1E, 10 bytes, score = 5 ÷ 10 = 0.5, cracked
This one isn't too hard actually :p. Code:
[NNÂÊ½¾¹Q#

Computes the Nth non-palindromic number, which is A029742.
Try it online!

Cracked.

JavaScript (ES6), 77 bytes, score = 0.9481 (73 / 77) [Cracked]
n=>eval("for(i=0;n;a||n--)[...s=a=++i+''].map(d=>a-=Math.pow(d,s.length));i")

Computes A005188, (offset = 1).

Didn't end up being super interesting but I thought I'd try and submit something.
Note: This is in ES6 so there is no ** operator. I just thought this would make it more cross-browser compatible and easier to test.

Cracked

@feersum Lol, I should have spent more time golfing it! Evidently this is possible in 72 bytes...

Jelly, 22 bytes, score 0.2727 (6 / 22) [cracked]
‘ðḤ;+;c2\×P:+’×$¥µÐ€‘S

This calculates sequence A116881. Try it online!

Cracked

Pip, 24 bytes, score = 22 / 24 = 0.9166 (cracked)
Y53T++i>ay.:k.A(yi)A(ya)

Computes A109648 (offset = 0). Try it online!

My 22-byte version:
T++v>alPB A(lJk|5v)l@a

Cracked

Actually, 28 bytes, Score = 0.39285714 (11/28) (cracked)
2√;;4*;u@D))u(*,;)@ⁿ)1-*ⁿ@-½

Computes A048696 (offset = 0). Actually uses CP437 for its encoding.
Try it online!
Dennis's solution is actually almost identical to mine:
19,`;τ(+`nX (Dennis)
19(`;)τ+`nX (Mine)

A Levenshtein distance of 3 is pretty impressive!
Try it online!

cracked

05AB1E, 7 bytes, score = 0.857 (6 / 7) [cracked]
This one shouldn't be too hard if you think about it :p. Code:
L!zO¹!*

Try it online!
Computes A002627.

Cracked

Acc!!, 523 bytes, score = 0.55067 (288/523) (cracked)
Second try, slightly different sequence.
N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3^(1+i%2)
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A000032, Lucas numbers with offset 0.
Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:
> python acc.py Program.txt
5.
11

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 14 (takes 60 seconds on my laptop). However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.

cracked

Acc!!, 522 bytes, score = 0.5555 (290 ÷ 522) (cracked)
Third try. Thanks to Dennis for the golfing "help" with the first two. ;^)
N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60*2
Count i while _/27^i {
_+(_/27^i*26-18)*27^i
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+27^k*3^(i%2)*78
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A005248, Lucas(2*n), offset = 0.
Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:
> python acc.py Program.txt
3.
18

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 7. However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.

cracked

Excel, 16 bytes, score = 0.75, [cracked by Dennis♦]
=FACTDOUBLE(2*n)

Computes A000165: double factorial of even numbers, (offset = 0).

Cracked?

This answer doesn't have the correct form -- it is not a program or a function.

@feersum By the definition here, it is a program

See here. Input by inserting the number into the source code isn't an accepted input method.

@feersum No need to insert the number into the code, but you can use name of reference cell n as an input

What do you mean? How do I specify the input?

@feersum Name the cell input as n. See this

INTERCAL, 85 bytes Score: 77/85=0.90588, safe.
Input: up to SIX FIVE FIVE THREE FIVE, although actual calcuatable input is smaller than that.
This calculates A000217.
PLEASEWRITEIN.1PLEASE.2<-#1DO(1000)NEXTDO.2<-.3DO(1030)NEXTDO.3<-.3~#65534DOREADOUT.3

Try it online!
The answer
77 bytes.
PLEASEWRITEIN.2PLEASE.1<-.2DO(1020)NEXTDO(1030)NEXTDO.3<-.3~#65534DOREADOUT.3

C-INTERCAL has a subroutine that just increments .1, which is (1020).
Try it online!

I'm on UTC+9, so would I be safe at 20:48 here?

Calcuable up to TWO FIVE FIVE

Python, 39 bytes, 26/39=2/3=0.666 cont. points, cracked
s=lambda x:x+s(x-1)if x==1else x+s(x-1)

won't last long, but lets see just how long. Just doing the robbers a favour I guess (also because I don't know eso golf langs ;_;)
umm, I accidentally bad code but someone cracked my lower score so...
computes A000217

How does this terminate if the then clause and the end clause are the same?

Which version of Python is this?

Cracked.

You need to include the score in the header :3.

also o sh*t I did the wrong code :(

Python, 69 bytes, score = 0.97 (67÷69), cracked
f=lambda n:reduce(lambda x,y:x*y,range(1,n+1),1)
lambda n:f(n*2)/f(n)

Computes A001813

cracked

05AB1E - 1 byte - A000027
Code: I
05AB1E - 0 bytes - A000027
Code:
Explanation:
I means that it pushes the input to the stack.
 means that nothing is changed to the stack, but the input was already added to the stack by default, so it prints out the input.

Please note this challenge has been inactive for 2 years.

Oh I thought that there was a proposal to revive old challenges


text:
Can you outgolf me? (Robbers section)
Robbers section
The cops section can be found here.
Challenge
Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only need to golf off at least 1 byte in order to crack a submission. E.g. if the task was to perform 2 × n, and the submission was the following:
print(2*input())

You could outgolf the cop by doing the following:
print 2*input()

Or even this (since lambda's are allowed):
lambda x:2*x

Post this with the following header:
##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}

For example:

Python 2, 16 12 bytes, Adnan (+ link to submission)
lambda x:2*x

Computes A005843, (offset = 0).

In that case, you have cracked the submission.
Scoring
The person with who cracked the most submissions is the winner.
Rules

The crack submission must be in the same language as the cop submission.
The same input should result into the same output (so a(2) = 4 should remain 4).
For languages such as Python, you can import libraries that are standard included within the language. (So, no numpy/sympy etc.)
Input and output are both in decimal (base 10).

Note
This challenge is finished. The winner of the Robbers section is feersum. The final scores for the CnR are shown below:

feersum: 16 cracks
Dennis: 12 cracks
Leaky Nun: 6 cracks
Lynn: 4 cracks
miles: 3 cracks
Martin Ender: 2 cracks
Emigna: 2 cracks
jimmy23013: 1 crack
Sp3000: 1 crack
randomra: 1 crack
alephalpha: 1 crack
nimi: 1 crack
Destructible Watermelon: 1 crack
Dom Hastings: 1 crack

Cheddar, 7 6 bytes, Downgoat
(<<)&1

This seems to work, but it's always possible that I don't understand the language correctly.

Alternatively, (**)&2. I tried 2&(**) and failed. :(

@Dennis (**)&2 works just fine for me :/ but this also works.

Jelly, 5 4 bytes, George V. Williams
RÆḊḞ

Try it here.
A hidden feature!
If I remembered correctly, ÆḊ(A) = sqrt(det(AAT)) is n! times the n dimensional Lebesgue measure of a simplex formed by n input point and the origin in m dimensional space. When n=1 it degenerate to the Euclidean distance. Not that weird after all...

Right, I did something weird with determinants... So well hidden that I couldn't find it myself!

@Dennis I know this because someday I tried to extend determinant too, and that's what you get if you want it to work as cross product. But it took me long because I thought it might be weird too and didn't expect someone come up with the same thing...

Can these really be considered "bytes?" The code points for Ḋ and Ḟ are in the UTF-16 range. That'd make this solution 6 bytes assuming heterogeneous encoding, and 8 bytes assuming homogeneous encoding. Asking honestly here.

@Jules https://github.com/DennisMitchell/jelly/wiki/Code-page

Hexagony, 91 33 bytes, Blue
1""?{\>{+/</+'+./_'..@'~&/!}'+=($

Unfolded:
    1 " " ?
   { \ > { +
  / < / + ' +
 . / _ ' . . @
  ' ~ & / ! }
   ' + = ( $
    . . . .

Try it online!
Still looks somewhat golfable but I figured I'd post it before FryAmTheEggman beats me to it. ;)
Explanation
Here are some colour-coded execution paths:

However, these are unnecessarily convoluted due to golfing. Here is the exact same code with a saner layout:

That's better. And finally, here is a memory diagram, where the red arrow indicates the initial position and orientation of the memory pointer (MP):

The gist is that I'm iteratively computing Fibonacci numbers on the three edges labelled f(i), f(i+1) and f(i+2) while keeping track of the iterator on the edges A, B and C. While doing so the roles of these edges are swapped out cyclically after each iteration. Let's see how this happens...
The code starts on the grey path which does some initial setup. Note that f(i) already has its correct initial value of 0.
1   Set edge f(i+1) to 1.
""  Move the MP to edge A.
?   Read input n into edge A.
)   Increment n.

Now the green path is the main loop. _ and > are just mirrors.
(     Decrement n.
<     If the result is zero or less, continue on the red path, otherwise
      perform another iteration of the main loop.
{     Move the MP to edge f(i+2).
+     Add edges f(i) and f(i+1) into this edge, computing the next Fibonacci number.
'     Move the MP to the edge opposite A.
~     Multiply by -1 to ensure that it's non-positive (the edge may have a positive
      value after a few iterations).
&     Copy the current value of n from A.
'     Move back and to the right again.
+     Copy n by adding it to zero. Since we know that the other adjacent edge
      is always zero, we no longer need to use ~&.
'+'+  Repeat the process twice, moving n all the way from A to B.
=     Reverse the orientation of the MP so that it points at f(i) which now
      becomes f(i+2) for the next iteration.

This way, the MP moves around the inner triplet of edges, computing successive Fibonacci numbers until n reaches zero. Then finally the red path is executed:
{}    Move the MP to f(i).
!     Print it.
@     Terminate the program.

Diagrams generated with Timwi's HexagonyColorer and EsotericIDE.

Holy cow! I was expecting to be beaten by you but not my that much! 0.o

@Blue Are you planning to add an explanation to yours? I'd be interested in how that one works. :) I'll add an explanation to this one as well sooner or later, but I'm not sure I'll find the time today.

Yeah, mine uses a more traditional method of calculation. I completely forgot about &, that could have saved some bytes

Haskell, 5 4 bytes, xnor
(^)1

Simple currying.

Stack Cats, 14 13 bytes, feersum
^]T{_+:}_

with the -nm flags for +4 bytes.
Try it online!
Okay, that loop was nuts. I tried several approaches, such as brute forcing over a reduced alphabet and brute forcing 3x+2 or 5x+4 and trying to extend it, but I never expected the solution to actually contain a loop.
The best way to see how this works is to add a D flag for debugging (so run with -nmD) and turn debug on for the above TIO link. A {} loop remembers the top of stack at the beginning of the loop, and exits when the top of stack is that value again. The interior of the loop does some fun subtracting and cycling of the top three elements of the stack, which is how the loop gets to run for so many iterations.

Sesos, 14 11 bytes, Leaky Nun
Computes n2. Try it here.
Hex dump:
0000000: 16c0f7 959d9b 26e83e ce3d                         ......&.>.=

From assembly:
set numin
set numout
get
jmp
  jmp, sub 1, fwd 1, add 1, fwd 1, add 2, rwd 2, jnz
  fwd 2, sub 1
  rwd 1, sub 1
  jmp, sub 1, rwd 1, add 1, fwd 1, jnz
  rwd 1
jnz
fwd 2
put

Nice, you're even shorter than my original golfed version.

This computes 1 + 3 + … + (2n–1) instead of n × n :)

I also used your approach

Woefully, 776 759 bytes, Destructible Watermelon
| |||||||| | |
|| |||||| |
||| |||| |
|||| || |
||||| || |
|||| |||| |
||| |||||| |
|| |||||||| |
| |||||||||| |
|| |||||||| |
||| ||||||| |
||||||||||| |
||||||||||| |
||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
||||||||| |
||||||||| |
||||||||| |
|||||||||| |
||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
|||| |
||| |
|| |
| |
| |
| |
|| |
|| |
|| |
|| |
|| |
| |
| |
| |
|| |
||| |
|||| |
||||| |
|||||| |
||||||| |
|||||| |
||||||| |
|||||||| |
||||||||| |
|||||||||| |
||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
|||| |
||| |
|| |
| |
| |
| |
| |
|| |
| |
|| |
||| |
||| |
|||| |
||| |
|| |
| |
| |
| |
|| |
|| |
|| |
|| |

I tried to read the source code for this language but it was too confusing. For one thing, ip[1] is a line number while ip[0] is the column number, while the cp coordinates are used the other way around. Yet, sometimes the value of cp is assigned to ip. I gave up on trying to understand what the program is doing and found a way to encode the identical sequence of instructions using fewer bars.

Snowman, 50 44 bytes, Doorknob
((}#2nMNdE0nR1`wRaC2aGaZ::nM;aF;aM:`nS;aF*))

Try it online!

Very nice. Even shorter than the original, which was ((}#1nG|#2nMNdE0nR2aGaZ::nM;aF;aM:nS;aF,nM*)).

Brachylog, 27 21 bytes, Fatalize
yrb:1a:+a:[1]c*.
:2/.

Try it online!

Well done! Using integer division is definitely not the solution I had in mind (which is still shorter), didn't even think about it tbh :p

J, 17 12 bytes, miles
+/@(]!2*-)i:

Pretty much the same as the original just more golfed. :)
i: having +1 range compared to i. is useful (and weird). If you use i. here n=0 will be incorrect but luckily i: solves that.
Try it online here.

Neat trick with i: being zeros for negative values. My version was +/@(]!2*-)i.,].

M, 10 6 bytes, Dennis
R×\³¡Ṫ

Given n, it computes the nth-level factorial of n. This was a fun exercise!
The code is capable of running as Jelly so you can Try it online.
Explanation
R×\³¡Ṫ  Input: n
R       Create the range [1, 2, ..., n]
   ³¡   Repeat n times starting with that range
 ×\       Find the cumulative products
     Ṫ  Get the last value in the list
        Return implicitly

Haskell, 15 14 bytes, xnor
until odd succ

I spent a fruitless couple of hours learning to decipher "pointless" syntax... until I found this instead.
Or for a less mellifluous 13 bytes, until odd(+1).

Nicely done, this is what I had in mind. I like the three words.

05AB1E, 7 4, Emigna
LnOx

From the formula for the sum of squares of positive integers 1^2 + 2^2 + 3^2 + ... + n^2 = n(n+1)(2*n+1)/6, if we multiply both sides by 2 we get Sum_{k=0..n} 2*k^2 = n(n+1)(2*n+1)/3, which is an alternative formula for this sequence. - Mike Warburton (mikewarb(AT)gmail.com), Sep 08 2007

I'm happy you cracked it at 4 since there was a trivial modification of my public one I'd missed. Nice!

Python 2, 43 40, xsot
g=lambda n:n<2or-~sum(map(g,range(n)))/3

Interesting, this is different from what I had originally.

Pyke, 11 9 bytes, muddyfish
hVoeX*oe+

Try it here!
How it works
          Implicit input: n (accumulator), n (iterations)
h         Increment the number of iterations.
 V        Do the following n + 1 times.
  o         Iterator. Pushes its value (initially 0) and increments it.
   e        Perform integer division by 2.
            This pushes 0 the first time, then 1, then 2, etc.
    X       Square the result.
     *      Multiply the accumulator and the result.
      oe    As before.
        +   Add the result to the accumulator.
            This sets the accumulator to a(0) = 0 in the first iteration and
            applies the recursive formula in all subsequent ones.

Using that method you can get 8 with hV~oX*o+. My 5 byte answer was SDmX^

Ah, ~o is neat. I have no idea what SDmX^ does though.

It basically uses mixed base conversation on the 1-indexed range against that squared. Not something on OEIS

Oh, does m only affect the X and not the ^? That explains a lot.

Yeah, m and similar only use the next node. Any comments on my docs etc?

Jelly, 22 21 bytes, Dennis
_²×c×Ḥc¥@÷⁸÷’{S
‘µR+ç

I spent several hours reading Jelly source code for the last one, so I might as well put this "skill" to use. I hope @Dennis will share with us his mathematical discoveries allowing a shorter formula (assuming there is something and not only weird Jelly tricks!).

For comparison, I had: `‘Ḥc_×c@+¥\nr0ç@€:‘+\S

@Sp3000 Oh, well why didn't you post it?

More time to think about the 6 before Dennis reposts in M :P

J, 20 19 bytes, miles
[:+/2^~+/@(!|.)\@i.

This computes the product as a sum of squared Fibonacci numbers, which are calculated as a sum of binomial coefficients.
Thankfully, @miles himself posted the code to generate Fibonacci numbers in this comment.

Acc!!, 526 525 bytes, DLosc
N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3^(1+i%2)
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-(_%100^i)*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

I have no idea how this works, but I was able to spot a tiny improvement.
24c24
< _+_/100^i*100^i*9
---
> _*10-(_%100^i)*9

Ah, shoot.  I was hoping no one would catch a math golf that I missed.  +1

Haskell, 10 bytes, xnor
gcd=<<(2^)

Usage example: map ( gcd=<<(2^) ) [1..17] -> [1,2,1,4,1,2,1,8,1,2,1,4,1,2,1,16,1].
How it works: From the oeis page we see that a(n) = gcd(2^n, n) or written in Haskell syntax: a n = gcd (2^n) n. Functions with the pattern f x = g (h x) x can be turned to point-free via the function =<<: f = g =<< h, hence gcd=<<(2^) which translates back to gcd (2^x) x.

............... How

Sesos, 14 9 bytes, Leaky Nun
Computes n mod 16. Try it here.
Hex:
0000000: 17f84a 750e4a 7d9d0f                              ..Ju.J}..

Assembly:
set numin
set numout
set mask
get
jmp, sub 1, fwd 1, add 16, rwd 1, jnz
fwd 1
jmp, sub 16, fwd 1, add 1, rwd 1, jnz
fwd 1
put

This is precisely my solution :D

Python, 39 17 bytes, Destructible Watermelon
lambda n:n*-~n>>1

actually really good, I'm actually glad at being outgolfed to see this solution

Why complicate a simple formula with the right shift?

@xsot Because I didn't know what version he used.

05AB1E, 9 4 bytes, Emigna
>n4÷

Try it online!
Computes this function instead:

Hexagony, 7 6 bytes, Adnan
?!/$(@

Unfolded:
 ? !
/ $ (
 @ .

Try it online!
Same idea, slightly different layout.

Ahhh, very nice! That was exactly the same solution :).

Jelly, 9 8 bytes, Dennis
œċr0$L€Ḅ

Sorry! I wasn't able to find your intended solution.
This relies on the fact that C(n+k-1, k) is the number of ways to choose k values from n with replacement.
Note: This is inefficient since it generates the possible sets in order to count them, so try to avoid using large values of n online.
Try it online or Verify up to n.
I later found another 8 byte version that is efficient enough to compute n = 1000. This computes the values using the binomial coefficient and avoids generating the lists.
Ḷ+c’Ṛ;1Ḅ

Try it online or Verify up to n.
Explanation
œċr0$L€Ḅ  Input: n
  r0$     Create a range [n, n-1, ..., 0]
œċ        Create all combinations with replacement for
          (n, n), (n, n-1), ..., (n, 0)
     L€   Find the length of each
       Ḅ  Convert it from binary to decimal and return

Ḷ+c’Ṛ;1Ḅ  Input: n
Ḷ         Creates the range [0, 1, ..., n-1]
 +        Add n to each in that range
   ’      Get n-1
  c       Compute the binomial coefficients between each
    Ṛ     Reverse the values
     ;1   Append 1 to it
       Ḅ  Convert it from binary to decimal and return

Brachylog, 11 10 bytes, Fatalize
yb:AcLrLc.

Try it online!
Explanation
Brachylog is a Prolog-derived languages, whose greatest ability is to prove things.
Here, we prove these statements:
yb:AcLrLc.
yb:AcL       Inclusive range from 1 to input, concatenated with A, gives L
     LrL     L reversed is still L
       Lc.   L concatenated is output

This is exacly the answer I had in mind, well done!

MATL, 11 10 bytes, Luis Mendo
YftdAwg_p*

Instead of doing -1^length(array) it converts the elements to Boolean values (which are always 1), negates them, and takes the product of the elements.

Jelly, 11 10, Dennis
Ḥ’_Rc’*@RP

Vectorized version of same approach.
Try it online!

05AB1E, 10 8 bytes, Adnan
µNÂÂQ>i¼

Try it online.

Yeah, that was pretty dumb of me :p. I forgot that that has been an actual challenge.

µNÂÊ½ for 5 bytes. Presumably the secret version.

M, 9 8 bytes, Dennis
Ḥrc’ḊḄḤ‘

Nice idea with the double + increment

QBasic, 30 29 bytes, DLosc
INPUT n:?(n MOD 2)*(n+.5)+n/2

Nice!  (Though not quite what I had.)

Pip, 24 22 bytes, DLosc
Y5T#y>aY(A_My)JkyA(ya)

You know, the approach of regenerating the string each time never occurred to me. Now let me golf your golf: Y5T#y>aY A*yJkA(ya) for 19 bytes. Very nice!

J, 12 11 bytes, miles
##.>:@I.@#:

+/ for summing an array behaves poorly with regards to vectorization, so I tried to use base 1 instead. # happened to work for a 1-byte verb that results in 1 when called on a scalar.

You're on a roll! Clever trick to sum using base 1. My solution was +/@(*#\)@#:.

05AB1E, 13 12 bytes, Adnan
µ•vÉ•DNìÙ{Q½

Try it online

Okay, that is clever. I didn't think of that :p.

Alternative 12 byte solution µNðì•vÉ•-gi¼

Python 3, 77 40 bytes, Joe
g=lambda n,c=1:+(n==0 or n>0<g(n-c,c+1))

MarioLANG, 87 86 bytes, Business Cat
Don't know how I did it, but here it is I think
;
)-)+(< >>(
-)===" ""====
>>+([!)( >-(
"====#[(("==+[
!-) - <!!![)<<)
#======###====:

Oh damn, didn't see that it was possible to get only one byte off... I'll post my 73-byte solution in my submission for interest's sake :)

CoffeeScript, 83 50 bytes, DerpfacePython
s=(n)->0|r<0||Array(0|(n/9)+2).join ((n-1)%9+1)+''

Tested via http://coffeescript.org/.

Whoa. That was... 10 minutes? Yikes, I suck at code golf. So, can you explain what the code does? Or is that just a naïve fix of what I did?

Wow, that really is convenient timing... well, I'll keep those tricks in mind. Thanks!

Python, 69 32 bytes, HiggsBot
f=lambda n:0**n or(4*n-2)*f(n-1)

Test it on Ideone.
Two bytes saved by @xnor. Thanks! Two more could be saved by returning True instead of 1.

Not that it matters, but there's 4*n-2.

Not sure how I missed that. Thanks!

Python 3.5, 38 36 bytes, R. Kap
G=lambda n:+(n<1)or(2*n-1)**2*G(n-1)

Even if you don't accept True as 1, this is good enough.

Nice job, although you were not able to get it as short as my shortest version.

@R.Kap I did not attempt to as it provides no benefit in this challenge.

Yeah, that's true.

Slightly shorter: G=lambda n:0**n or(2*n-1)**2*G(n-1) (35 bytes) - I am over a year too late though :P

J, 9 7 bytes, Leaky Nun
2&o.t.]

This is a monadic verb; it computes the yth term of the Taylor series of the cosine function (2&o.).
Example run
   f =: 2&o.t.]
   f each 0 1 2 3 4 5 6 7
┌─┬─┬──┬─┬─┬─┬──┬─┐
│1│0│_1│0│1│0│_1│0│
└─┴─┴──┴─┴─┴─┴──┴─┘

I think I need it. (2&o.t.) 2 returns _0.5.

This was close to my solution.

Aren't we looking for the sign of the coefficient, so something like *2&o.t.]?

@GeorgeV.Williams All coefficients of the Taylor series of cos are one of -1, 0 and 1. The coefficient is equal to its sign.

@Dennis, are you sure? On my interpreter, e.g. 2&o.t.]4 gives 0.0416667.

@GeorgeV.Williams This is meant to be a verb, so you'd have to call it like (2&o.t.]) 4 or by saving it in a variable. I'll add that to the post.

J, 10 9 bytes, Leaky Nun
-:*1-~3*]

Just shifted the operators around.

Not my intended solution, but nice.

A numberless version: -:*-.-~+:.

Java, 53 51 bytes, JollyJoker
int f(int n){return n<2?3-3*n:n<3?2:f(n-2)+f(n-3);}

Combines the first two if statements into 3-3*n for n less than 2.

Ah, finally got commenting privileges. I didn't come up with the '3-' trick myself; that makes it a lot easier! Updated the original with some comments and a 47-byte version combining both 3- and % to get 0,1,2 to 3,0,2 in seven bytes, 3-3*n%5

Retina, 28 27 bytes, Martin Ender
.+
$*
((^.?|\3)(^|\1)){99}$

Where it says {99} I wanted to use +, but that mysteriously causes the match to fail.
The regex matches strings which have a length that is a sum of a prefix of the Fibonacci numbers. The main group matches lengths starting with 1, 2, 3, ..., which skips one of the initial 1s, so I tried to improve it by getting it to match length 1 twice at the beginning, so that it was not necessary to have a special case.

05AB1E, 7 6 bytes, Adnan
!¹L!/O

or
!žr<*ï

Note that both of these return 1 for 0, but so did the cop program.

Oh nice! I really thought I had covered the n = 0 case :p. I had Î>GN*>, which does work for n = 0.

@Adnan: Nice one.

Acc!!, 522 514 bytes, DLosc
N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60*2
Count i while _/27^i {
_+(_/27^i*26-18)*27^i
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+27^k*3^(i%2)*78
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+2-j {
_+(_%10-_/100^j%10)*(100^j-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Not so tiny improvement this time, but I still have no idea what I'm doing.
28,29c28,29
< Count j while i+1-j {
< _+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
---
> Count j while i+2-j {
> _+(_%10-_/100^j%10)*(100^j-1)

Since (100^j-1) is zero when j = 0, we can loop over the range [0, ..., i + 2) instead of looping over [0, ..., i + 1) and incrementing j. This saves eight bytes.

Python, 46 45 bytes, Sp3000
f=lambda n,k=1:n and-~f(n-(k+(k&-k)&k>0),k+1)

Test it on Ideone.

Excel, 16 12 bytes, Anastasiya-Romanova 秀
=FACT(n)*2^n

I don't actually have Excel, but from what I read online, this should work.

This doesn't work: http://i.imgur.com/NUDGujV.png

Not yet :-)

Change n*n to 2^n

Eh, mixed up n^2 and 2^n, and I wasn't sure if Excel had ^. That's what happens when you try to do math at 4 AM... Thanks, @Emigna.

@Anastasiya-Romanova秀 Fixed.

@Dennis OK, (+1)

M, 18 17 bytes, Dennis
Tragically, Dennis has missed a trivial modification this time. Only the first line is different.
Ḥrc
‘Ḥc0r$×Ç:‘+\S

facepalm Well done.

Acc!!, 512 511 bytes, DLosc
N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/30
Count i while _/27^i {
_+(_/27^i*26-18)*27^i
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+i%2)*78
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+2-j {
_+(_%10-_/100^j%10)*(100^j-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

This is the improvement.
15c15
< _+27^k*3^(i%2)*78
---
> _+3^(3*k+i%2)*78

J, 18 13 bytes, miles
(2&-%-.-*:)t.

I checked the shortest most popular J answer for Fibonacci numbers: a generating function. Unsurprisingly, the same approach is also good for Lucas numbers.

Exactly what I had in mind.

JavaScript(ES6), 77 76, user81655
n=>eval("for(i=0;n;n-=!a)[...s=a=++i+''].map(d=>a-=Math.pow(d,s.length));i")

Just a 1-byte peephole golf.

Actually, 28 11 bytes, Mego
19,`;τ(+`nX

Try it online!
How it works
This uses the recursive definition from A048696: a(0) = 1, a(1) = 9, a(n) = 2a(n-1) + a(n-2).
19           Push 1 and 9 on the stack.
  ,          Read n from STDIN and push it on the stack.
   `    `n   Do the following n times:
    ;          Push a copy of the topmost integer.
     τ         Multiply it by 2.
      (        Rotate the bottom-most integer on top of the stack.
       +       Add the two topmost integers.
             Each iteration turns the stack [a(k-2) a(k-1)] into [a(k-1) a(k)].
             After n iterations, we are left with [a(n) a(n+1)].
          X  Discard a(n+1) from the stack.

Acc!!, 523 521 bytes, DLosc
N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

I have no idea how this works, but I was able to spot a tiny improvement.
13c13
< _+3^(1+i%2)
---
> _+3+i%2*6

Back to the drawing board!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
A tiny adventure
Text adventure games have a pretty set formula; there's a world composed of a series of rooms / spaces, the player can move around these rooms, and there are some items in the rooms. Items can be picked up by the player, put down, used to access other rooms (e.g. keys), and combined with other items to make new items.
Challenge
Your challenge is to write a text adventure runtime in the fewest bytes (code golf). To keep things simple, all you need to do is output a truthy or falsey value depending on whether a given series of commands would win a given game or not (no interactivity, no human friendly output, etc.)
Game Rules

The world is always composed of a corridor with 10 connected rooms. Each room requires a key to enter, but can be exited at any time without a key (so it's some kind of latch lock I guess);
The player begins in room 0, and wins if they ever enter room 9 (once they reach room 9 they can do whatever they like, including go to another room, and they will still have won);
Each room can contain any number of items;
There are up to 26 items, named A-Z, and no item will appear more than once in the world;
The player can pick up items from the current room and place them in their inventory (they can also drop items from their inventory into the current room);
The player's maximum inventory size is finite, and will be provided with the level details;
At the beginning of the game, the player's inventory is always empty;
There is no limit to the maximum number of items in a room (though the implicit limit would be 26, since that is the total number of items);
Items A-J are keys which can be used to enter rooms 0-9 (i.e. the player can move to room 0 if they have item A, to room 1 if they have B, etc. note that keys are not required to leave a room, and the player begins in room 0, so the key "A" is only required if the player wants to return to room 0);
Items in the player's inventory can be combined to create new items (which will be created in the player's inventory) — the permitted combinations will be provided with the level details;
Combining items consumes the original items (i.e. if one of the items was a key, it will no-longer be possible to use that key);
If the player tries to do something impossible (e.g. pick up an item which is not in the current room / drop an item they don't have / combine items they don't have / go to a room they don't have the key for), nothing happens and they can continue;
The player will never give a nonsense command (e.g. go to room 11).

So a simple game might look like this:
  v
+---+---+---+---+---+---+---+---+---+---+
| C |   | J |   |   |   |   |   |   |   |
+---+---+---+---+---+---+---+---+---+---+
|               CORRIDOR                |
+---------------------------------------+
Inventory capacity: 99

Room 0 contains item "C" (which is the key to room 2). Room 2 contains item "J" (which is the key to room 9). The player can win the game by picking up C, moving to room 2, picking up J, then moving to room 9.
A more complex game might be:
  v
+---+---+---+---+---+---+---+---+---+---+
| C |   | X |YZ |   |   |   |   |   |   |
+---+---+---+---+---+---+---+---+---+---+
|               CORRIDOR                |
+---------------------------------------+
Inventory capacity: 10
C+X => D
Y+Z => J

Now the player can win by picking up C, moving to room 2, picking up X, combining C with X to create D, then moving to room 3. They can now pick up and combine Y and Z to get J, allowing them to go to room 9.

Input Format
There's a fair bit of input to handle, and that's a pretty boring task, so the input format is very flexible. You will get the following data, and how it should be sent to your program is largely up to you:

The initial contents of each room (list of 0 or more items for each room);
A collection of permitted item combinations (each contains 2 input items and their output item — note that the input items are unordered);
The maximum inventory size (integer, 0 <= size <= 26);
The list of commands the player attempted.

The player's commands can be:

[P]ick up <item> - picks up an item from the room and puts it into the player's inventory (if there is space)
[D]rop <item> - drops an item from the player's inventory into the current room
[C]ombine <item1> <item2> - combines 2 items in the player's inventory to produce a new item
[G]o to <room> - travels to the chosen room if the player has the required key

For example, the input format I used for testing was simple program arguments:
./adventure YZ '' '' '' '' '' '' '' '' ''  1 YZJ         2          PY PZ CYZ G9
#           r0 r1 r2 r3 r4 r5 r6 r7 r8 r9  combinations  inv. size  commands...
# means:
#  room 0 starts with items Y & Z, all other rooms start empty
#  1 combination is possible: Y+Z => J
#  max inventory size is 2
#  player commands are [P]ick up Y, [P]ick up Z, [C]ombine Y and Z, [G]o to room 9
#  (in this example, the player wins)

But if some other format makes it easier, that's fine (e.g. special delimiter characters / multiple lines / different ordering / serialised to JSON / etc.)
Output Format
Your program should return some truthy output if the player's commands cause them to win the game, and some falsey output otherwise. This could be a recognisable message to stdout, a program return code, or whatever your language of choice provides. All other output will be ignored.
Test Cases
The following bash script provides a test harness which will check most situations. It has been written to use the format described above, but modifying it to use a different format is just a case of adding a conversion in the invoke function.
#!/bin/sh

PROG="$1";

if [[ -z "$PROG" ]]; then
    echo "Usage: $0 <program-to-test>";
    exit 1;
fi;

function invoke {
    "$PROG" "$@"
}

RED="\033[1;31m";
GREEN="\033[1;32m";
RESET="\033[m";
FAILURES="0";

function pass {
    if ! invoke "$@" >/dev/null 2>&1; then
        echo "${RED}Expected pass, got fail:${RESET} $*" >&2;
        (( FAILURES = "$FAILURES" + 1 ));
        invoke "$@" 2>&1;
    fi;
}

function fail {
    if invoke "$@" >/dev/null 2>&1; then
        echo "${RED}Expected fail, got pass:${RESET} $*" >&2;
        (( FAILURES = "$FAILURES" + 1 ));
        invoke "$@" 2>&1;
    fi;
}

echo "Running tests...";

#    R0  R1  R2  R3  R4  R5  R6  R7  R8  R9  C      I  Cmd...
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ G9;
fail ''  J   ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ PJ G9;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  G9 PJ G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      1  PJ G9;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      0  PJ G9;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ DJ G9;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ PJ DJ G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ DJ PJ G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ DJ PJ G9;
pass B   CJ  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PB G1 DB PC PJ G9;
fail B   CJ  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PB G1 DB PB PC PJ G9;
pass AJ  ''  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PA PJ G9;
pass B   D   ''  J   ''  ''  ''  ''  ''  ''  0      2  PB G1 PD G3 DB PJ G9;
fail B   D   ''  J   ''  ''  ''  ''  ''  ''  0      2  PB G1 PD G2 DB PJ G9;
fail B   D   ''  J   ''  ''  ''  ''  ''  ''  0      2  PB G1 PD G3 PJ G9;
fail B   D   J   C   ''  ''  ''  ''  ''  ''  0      2  PB G1 PD G3 PJ G9;
pass AJ  ''  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PA PJ G9 G0;
fail ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      3  PA PD PJ G3 DJ G0 PJ G9;
pass ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      3  PA PD PJ G3 DJ G0 G3 PJ G9;
fail ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      3  PA PD PJ G3 DJ G0 DD G3 PJ G9;
pass ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      3  PA PD PJ DD G3 DJ G0 DD G3 PJ G9;
fail ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      1  PA DA DA PD PJ G9;
pass ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      1  PA DA DA PJ G9;
fail ABCDEFGHIKLMNOPQRSTUVWXYZ  J  '' '' '' '' '' '' '' '' 0 26 PA PB PC PD PE PF PG PH PI PJ PK PL PM PN PO PP PQ PR PS PT PU PV PW PX PY PZ G9;
pass ABCDEFGHIJKLMNOPQRSTUVWXYZ '' '' '' '' '' '' '' '' '' 0 26 PA PB PC PD PE PF PG PH PI PJ PK PL PM PN PO PP PQ PR PS PT PU PV PW PX PY PZ G9;
fail YZJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PY PZ CYZ PJ G9;
pass YZJ ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PJ G9;
pass YZJ ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PJ CWJ G9;
fail XYZJ '' ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PX PJ G9;
fail XYZJ '' ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PX DY DZ PJ G9;
pass XYZJ '' ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PX DW PJ G9;
pass YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  CYZ G9;
pass YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ DJ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ DJ PY PZ CYZ G9;
fail WZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PW PZ CYZ G9;
fail WZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ G9;
pass YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CZY G9;
pass YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 ZYJ  2  PY PZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  1  PY PZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  1  PY PZ CYZ PY PZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  1  PY PZ CYZ PJ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  1  PJ G9;
pass BW  UV  ''  ''  ''  ''  ''  ''  ''  ''  3 BUR WVS RSJ  2  PB PW G1 DW PU CBU DR PW PV CVW PR CRS G9;
fail BW  AUV ''  ''  ''  ''  ''  ''  ''  ''  3 BUR WVS RSJ  2  PB G1 PU CBU DR PA PB G0 DA PW G1 PV CVW PR CRS G9;
pass BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PC PA PB G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW UV  ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PC PA PB G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU PA PB G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PA G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PB G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PA PB G0 DA G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PA PB G0 DA PW G1 DB CVW PR CRS G9;
pass BFK LG  M   N   O   CDE PQR U   W   ''  10 BPT CQS TSH HUI IWV VFA GRX MXZ ANY YZJ  5 \
  PB PF PK G1 PL PG G6 DB DK DL G5 PC PD PE G6 DF G2 PM G6 DM DC G3 PN G4 PO G6 DN DO DD DE \
  PB PP CBP PC PQ CCQ CTS G7 PU CUH G8 PW CWI G6 PF CVF PR PM PN CGR CMX CAN CYZ G9
fail BFK LG  M   N   O   CDE PQR U   W   ''  10 BPT CQS TSH HUI IWV VFA GRX MXZ ANY YZJ  5 \
  PB PF PK G1 PL PG G6 DB DK DL G5 PC PD PE G6 DF G6 DM DC G3 PN G4 PO PM G6 DN DO DD DE \
  PB PP CBP PC PQ CCQ CTS G7 PU CUH G8 PW CWI G6 PF CVF PR PM PN CGR CMX CAN CYZ G9

if (( "$FAILURES" == "0" )); then
    echo "${GREEN}All tests passed${RESET}";
else
    echo "${RED}Total failures: $FAILURES${RESET}";
fi;

Winning
Standard code golf: shortest code (in bytes) wins. Entries must follow the game rules, which in practice means they must pass all test cases (more tests may be added if necessary).

You might not believe me but I thought of a challenge that is pretty much the same thing as this one a few days ago...

I like this challenge.  However, I'd definitely include test cases outside of your test script.

@NathanMerrill can do, what format would you prefer? (the test cases inside the script are already quite easy to parse so I wasn't sure what to do to make a test table without simply repeating the same lines!)

@daHugLenny I got the idea a few days ago too. I guess it's possible we were both inspired by some challenge posted last week, or another question on the network. I can't remember where I got the idea from.

Dropping an item the user does not have. Is it impossible (no op) or nonsense (will not happen). And dropping a not existing item?

Dropping an item the user doesn't have is a no-op. Nonsense only covers commands which would never be possible (e.g. P@, D7, QA, etc.). If the command could be possible in some game, but isn't possible now / in this game, it's a no-op. To be clear; I'm only saying nonsense won't happen to avoid the need for bounds-checking, etc. in all answers.

@edc65 I updated to clarify, but also see my comment above.

Is combining AB the same as combining BA? If yes, do we have to account for this?

@orlp yes, it is the same and you will need to account for it (some of the tests already check that)

The first example (beginning "So a simple game might look like this:") seems to assume that the player starts with A in their inventory, but I don't see this stated anywhere. Can you edit to clarify?

@PeterTaylor the player starts in room 0, so A is not needed at all

@edc65, yes, that makes sense. The rules are somewhat weird, though, so some emphasis would help.

Does the code need to take into account a room containing more than one item? For example, room 1 contains item X, player enters room 1 and drops item Y.

@PeterTaylor I have added some clearer explanations of keys. I designed it that way so that submissions can be simpler (moving only requires checking one key, which depends on the destination and nothing else).

@trichoplax yes rooms can contain multiple items, but there will never be more than one of the same item, no matter what the player does. I'll update an example to show that more obviously.

JavaScript (ES6), 244 249 267 280
Edit Saved 18 (!) bytes thx @Neil
A function with input:

r = room content (array of 10 strings)
k = combinations (array of string of 3 chars - source1, source2, result)
s = inventory max size (number)
c = commands (array of strings)

Returns true or false
(r,k,s,c,p=0,j={})=>c.some(([c,a,b])=>c<'D'?j[a]>0&j[b]>0&&!k.map(([t,u,v])=>u+t==a+b|u+t==b+a?j[j[a]=j[b]=v]=++s:0):c<'G'?j[a]>0&&!(j[++s,a]=~p):c>'G'?s&&j[a]==~p&&!(j[a]=s--):j['ABCDEFGHIJ'[a]]>0&&(p=a)>8,r.map((o,n)=>[...o].map(c=>j[c]=~n)))

See the test snippet below for a newline separated version
Test

Exec=
(r,k,s,c,p=0,j={})=>
c.some(
  ([c,a,b])=>
   c<'D'?j[a]>0&j[b]>0&&!k.map(([t,u,v])=>u+t==a+b|u+t==b+a?j[j[a]=j[b]=v]=++s:0)
   :c<'G'?j[a]>0&&!(j[++s,a]=~p)
   :c>'G'?s&&j[a]==~p&&!(j[a]=s--)
   :j['ABCDEFGHIJ'[a]]>0&&(p=a)>8
  ,r.map((o,n)=>[...o].map(c=>j[c]=~n))
)

console.log = (...x) => O.textContent += x + '\n';

;`pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ G9;
fail ''  J   ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ PJ G9;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  G9 PJ G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      1  PJ G9;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      0  PJ G9;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ DJ G9;
fail J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ PJ DJ G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ DJ PJ G9;
pass J   ''  ''  ''  ''  ''  ''  ''  ''  ''  0      9  PJ DJ PJ G9;
pass B   CJ  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PB G1 DB PC PJ G9;
fail B   CJ  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PB G1 DB PB PC PJ G9;
pass AJ  ''  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PA PJ G9;
pass B   D   ''  J   ''  ''  ''  ''  ''  ''  0      2  PB G1 PD G3 DB PJ G9;
fail B   D   ''  J   ''  ''  ''  ''  ''  ''  0      2  PB G1 PD G2 DB PJ G9;
fail B   D   ''  J   ''  ''  ''  ''  ''  ''  0      2  PB G1 PD G3 PJ G9;
fail B   D   J   C   ''  ''  ''  ''  ''  ''  0      2  PB G1 PD G3 PJ G9;
pass AJ  ''  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PA PJ G9 G0;
fail ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      3  PA PD PJ G3 DJ G0 PJ G9;
pass ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      3  PA PD PJ G3 DJ G0 G3 PJ G9;
fail ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      3  PA PD PJ G3 DJ G0 DD G3 PJ G9;
pass ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      3  PA PD PJ DD G3 DJ G0 DD G3 PJ G9;
fail ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      1  PA DA DA PD PJ G9;
pass ADJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      1  PA DA DA PJ G9;
fail ABCDEFGHIKLMNOPQRSTUVWXYZ  J  '' '' '' '' '' '' '' '' 0 26 PA PB PC PD PE PF PG PH PI PJ PK PL PM PN PO PP PQ PR PS PT PU PV PW PX PY PZ G9;
pass ABCDEFGHIJKLMNOPQRSTUVWXYZ '' '' '' '' '' '' '' '' '' 0 26 PA PB PC PD PE PF PG PH PI PJ PK PL PM PN PO PP PQ PR PS PT PU PV PW PX PY PZ G9;
fail YZJ ''  ''  ''  ''  ''  ''  ''  ''  ''  0      2  PY PZ CYZ PJ G9;
pass YZJ ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PJ G9;
pass YZJ ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PJ CWJ G9;
fail XYZJ '' ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PX PJ G9;
fail XYZJ '' ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PX DY DZ PJ G9;
pass XYZJ '' ''  ''  ''  ''  ''  ''  ''  ''  1 YZW  2  PY PZ CYZ PX DW PJ G9;
pass YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  CYZ G9;
pass YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ DJ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ DJ PY PZ CYZ G9;
fail WZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PW PZ CYZ G9;
fail WZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CYZ G9;
pass YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  2  PY PZ CZY G9;
pass YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 ZYJ  2  PY PZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  1  PY PZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  1  PY PZ CYZ PY PZ CYZ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  1  PY PZ CYZ PJ G9;
fail YZ  ''  ''  ''  ''  ''  ''  ''  ''  ''  1 YZJ  1  PJ G9;
pass BW  UV  ''  ''  ''  ''  ''  ''  ''  ''  3 BUR WVS RSJ  2  PB PW G1 DW PU CBU DR PW PV CVW PR CRS G9;
fail BW  AUV ''  ''  ''  ''  ''  ''  ''  ''  3 BUR WVS RSJ  2  PB G1 PU CBU DR PA PB G0 DA PW G1 PV CVW PR CRS G9;
pass BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PC PA PB G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW UV  ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PC PA PB G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU PA PB G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PA G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PB G0 DA PW G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PA PB G0 DA G1 DB PV CVW PR CRS G9;
fail BCW AUV ''  ''  ''  ''  ''  ''  ''  ''  3 CUR WVS RSJ  2  PB PC G1 DB PU CCU DR PA PB G0 DA PW G1 DB CVW PR CRS G9;
pass BFK LG  M   N   O   CDE PQR U   W   ''  10 BPT CQS TSH HUI IWV VFA GRX MXZ ANY YZJ 5 PB PF PK G1 PL PG G6 DB DK DL G5 PC PD PE G6 DF G2 PM G6 DM DC G3 PN G4 PO G6 DN DO DD DE PB PP CBP PC PQ CCQ CTS G7 PU CUH G8 PW CWI G6 PF CVF PR PM PN CGR CMX CAN CYZ G9
fail BFK LG  M   N   O   CDE PQR U   W   ''  10 BPT CQS TSH HUI IWV VFA GRX MXZ ANY YZJ 5 PB PF PK G1 PL PG G6 DB DK DL G5 PC PD PE G6 DF G6 DM DC G3 PN G4 PO PM G6 DN DO DD DE PB PP CBP PC PQ CCQ CTS G7 PU CUH G8 PW CWI G6 PF CVF PR PM PN CGR CMX CAN CYZ G9`
.split(/;*\n/).map((srow,i)=>{
  var row=srow.split(/\s+/),
  rooms=row.slice(1,11).map(x=>x=="''"?"":x),
  ncomb=+row[11],
  comb=row.slice(12,12+ncomb),
  isize=+row[12+ncomb],
  commands=row.slice(13+ncomb),
  start='['+rooms+'] ['+comb+'] '+isize+' ['+commands+']';
  var result=Exec(rooms,comb,isize,commands),
     ok = row[0] == ['fail','pass'][~~result]
  console.log(i, ok ? 'ok':'ko', start, row[0], result)
})
<pre id=O></pre>

Nice (ab)use of .map!

Why is a>8 inside ()s? Can j[--s,a]=1 become j[a]=s--? Also, String.fromCharCode is far too long, why not just index into "ABCDEFGHIJ"?

@Neil thanks for the hints, i'll check them all. Obviously this is a result of a series of changes (at some point I need j[] to be exactly 1, but now probably they can be any positive value)

C, 338 bytes
I had a go at minifying my own test program. I think it went quite well, even if it is the longest answer so far!
#define P c[(i<j?i:j)*25+i+j]
#define F for(q=atoi(*++v);r
#define X c[r*91+i]
r,i,j,c[2405];main(q,v)char**v;{for(r=10;--r;)for(++v;i=**v;++*v)++X;++v;F<q;++r)i=**++v,j=1[*v],P=2[*v];r=9;F&&*++v;c[i=1[*v]]&&j==68?c[i]=!++X,++q:j>79&&q*X?c[i]=!--X,--q:j==71&&c[i+17]?r=57-i:j<68&&c[i]*c[j=2[*v]]&&P?c[i]=c[j]=0,c[P]=++q:0)j=**v;return r;}

This uses a few tricks to save space:

Rooms are loaded in reverse so that checking for room 9 becomes checking for room 0, which is cheaper
Room 9's contents never matter, so it is skipped when reading the input and used to store the inventory instead
The room contents and item combinations are stored in the same array. Because items are stored at their ascii values, they never overlap.

Breakdown:
#define P c[(i<j?i:j)*25+i+j]       // item combination lookup (input: i,j)
#define X c[r*91+i]                 // room item lookup (input: r,i)
r,i,j,c[2405];                      // globals default to 0
main(q,v)char**v;{                  // K&R syntax to save bytes
    for(r=10;--r;)                  // Load rooms 0-8, store as 9-1
        for(++v;i=**v;++*v)
            ++X;
    ++v;                            // Skip room 9
    for(q=atoi(*++v);r<q;++r)       // For each combination
        i=**++v,
        j=1[*v],                    // Use index[array] syntax to avoid (brackets)
        P=2[*v];                    // Record combination
    r=9;                            // Begin in room 0 (9 in memory)
    for(q=atoi(*++v);               // Load inventory size
                     r              // While not in room 9 (0 in memory)...
                      &&*++v;       // ...and still have user commands
                                    // (ISO C promises a NULL at the end of argv)
        c[i=1[*v]]&&j==68?          // If 'D'rop, and we have the item:
            c[i]=!++X,              //  Drop it
            ++q:                    //  Increase our inventory capacity
        j>79&&                      // If 'P'ick up, and...
              q                     // ...we have capacity in our inventory and...
               *X?                  // ...the item is in the room:
            c[i]=!--X,              //  Pick it up
            --q:                    //  Decrease our inventory capacity
        j==71&&c[i+17]?             // If 'G'o to room, and we have the key:
            r=57-i:                 //  Go to the room
        j<68&&                      // If 'C'ombine, and...
              c[i]*c[j=2[*v]]       // ...we have the items and...
                             &&P?   // ...they can be combined
            c[i]=c[j]=0,            //  Remove the items
            c[P]=++q:               //  Add the combined item and increase capacity
        0                           // Unrecognised or invalid command
    )
        j=**v;                      // 'j' is the command letter (happens first)
    return r;                       // Return the final room (0 = truthy in shell)
}

Partially inspired by @edc65's answer.

I was so close to getting ;*++*v; and c[P][c] into the code for ultimate confusion, but unfortunately other options turned out to be shorter :(

Haskell, 354 325 323 bytes
(#)=elem
(#)=elem
(%)=filter.(/=)
m!s=g""0.zip[0..]where g _ p _[]=p>8;g i p r(c:d)|p>8=1<2|'P':[k]<-c,k#x,length i<s=g(k:i)p((p,k%x):r)d|'D':[k]<-c,k#i=g(k%i)p((p,k:x):r)d|'C':q@[k,l]<-c,k#i,l#i,[y]<-[f|[d,e,f]<-m,q==[d,e]||q==[e,d]]=g(y:k%(l%i))p r d|'G':n<-c,y<-read n,['A'..]!!y#i=g i y r d|1<2=g i p r d where Just x=lookup p r

Defines a function ! which takes in order

the possible combinations as a list of 3 letter strings
the maximum size of the inventory
the rooms as a list of 9 strings
the player commands as a list of strings

Returns True or False. Example call:
*Main> (!) ["YZW"] 2 ["YZJ","","","","","","","","",""] ["PY","PZ","CYZ","PJ","CWJ","G9"]
True

All test cases.
Many bytes are spent in carrying the game state around. Haskell cannot destructively update data structures like the rooms and inventory.
The work is done by function g which takes 4 parameters: the inventory (String), the current room (Integer), the rooms (Assoc-List, with key: room number and value: items) and the commands left (List of String).
g _ p _[] = p>8                     -- base case. if no commands left, return
                                    -- True if we are in room 9
g i p r(c:d)
  | p>8 =   1<2                     -- reached room 9
  | 'P':[k]<-c,                     -- 'Pickup', if
        k#x,                        --   key is in room and
        length i<s                  --   inventory not full
        = g(k:i)p((p,k%x):r)d       --   adjust inventory and room
  | 'D':[k]<-c,                     -- 'Drop', if
        k#i                         --   key is in inventory
        = g(k%i)p((p,k:x):r)d       --   adjust inventory and room
  | 'C':q@[k,l]<-c,                 -- 'Combine', if
        k#i,l#i,                    --   both keys are in inventory and
        [y]<-[f|[d,e,f]<-m,q==[d,e]||q==[e,d]]
                                    --   combination is possible
        = g(y:k%(l%i))p r d         --   adjust inventory
  | 'G':n<-c, y<-read[n],           -- 'Goto', convert digit to integer
        ['A'..]!!y#i                --   key for room is in inventory
        = g i y r t                 --   go to room
  | 1<2                             -- impossible command
        = g i p r d                 --   ignore it

Maybe the following things can save some bytes

State Monad for the game state
A single Assoc-List for the keys (key: letter of key, value: room number with -1 for inventory) instead of rooms/inventory No, constructing such an initial Assoc-List and the check for max inventory size costs more than it saves dealing with one less parameter.

Nice. I don't know enough Haskell to check, but you might be able to save some bytes by incrementing/decrementing s as your inventory use changes, to avoid having to check length i (you could check s against 0 instead)

@Dave: I don't think it pays off, because changing s would make it the fifth parameter of g and it would have to be passed around. I have 5 recursive calls  to g, an additional parameter costs at least 6 bytes.

Python 3, 321 311 bytes
-10, thanks Dave
S,F=set,frozenset
def f(r,c,i,m):
 w,v,r,c=0,S(),list(map(S,r)),{F(k):S(x)for*k,x in c}
 for a,*q in m:
  p=F(q)
  if a<'D'and p in c and p<=v:v-=p;v|=c[p]
  elif a=='D'and p<=v:r[w]|=p;v-=p
  elif a=='G'and F(chr(65+int(q[0])))<=v:w=int(q[0])
  elif a>'G'and p<=r[w]and len(v)<i:r[w]-=p;v|=p
  if w==9:return 1

Rooms (r), combinations (c) and moves (m) are all lists of strings. Max inventory (i) is an int.
Fairly straight forward implementation.  Used set()s for the room contents and inventory to make updating easy. Used frozensets to key a dictionary of the combinations, so that the order of the 2 input items is irrelevant.

Cool. Verified it on the test set with this: import sys;r=sys.argv[1:11];nc=int(sys.argv[11]);c=sys.argv[12:12+nc];i=int(sys.argv[12+nc]);m=sys.argv[13+nc:];exit(not f(r,c,i,m)) (semicolons -> newlines). By the way, looks like you left ,dbg=False in there; you can save 10 bytes by removing it!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Roll an ASCII die
In this code-golf challenge, you must output an ascii-art of a random die roll.
like this:
   ________
  /\       \
 /  \   6   \
{ 4  }-------}
 \  /   5   /
  \/_______/

Please note that:
   ________
  /\       \
 /  \   3   \
{ 4  }-------}
 \  /   5   /
  \/_______/

is invalid output, because that is not a possible result on a die
There are 6(faces that could be up)*4(faces that could be the left face after the top is determined)*1(faces that could be the right face after the other two are determined)=24 possibilities of die rolls.
Your program must output one of these die rolls in the form of an ascii art (modeled like the one below, with the x y and zs replaced with numbers) like above, with each output having >0 probability of occurring, but the probabilities do not have to be even (they are allowed to be trick dice, unlike in real life). Your program cannot output an invalid die roll, or a non die roll. Your program must have a probability of 1 of outputting a valid roll
Please note that your die does not necessarily have to be a right handed die like shown in the first image. (right- and left-handed describe the die's net)
right-handed die
   ________
  /\       \    net
 /  \   z   \     _|4|_ _
{ x  }-------}   |6|2|1|5|
 \  /   y   /      |3|
  \/_______/

left handed die
   ________
  /\       \    net
 /  \   y   \     _|3|_ _
{ x  }-------}   |6|2|1|5|
 \  /   z   /      |4|
  \/_______/

If your die is left handed, the following is valid output, but not if your die is right handed:
   ________
  /\       \
 /  \   2   \
{ 1  }-------}
 \  /   3   /
  \/_______/

While you can choose left handed or right handed, your die has to be consistent: it cannot change from left to right or vice versa
the following is a list of valid outputs for the die. Refer to the pictures above for positions of X-Y-Z:
X-Y-Z
-----
5-4-1
1-5-4
4-1-5

5-6-4
4-5-6
6-4-5

5-3-6
6-5-3
3-6-5

5-1-3
3-5-1
1-3-5

2-6-3
3-2-6
6-3-2

2-4-6
6-2-4
4-6-2

2-1-4
4-2-1
1-4-2

2-3-1
1-2-3
3-1-2

again this is code-golf, so fewer bytes is better

Solvers might be interested in a formula for the third die face given the other two.

@xnor and as such I think that's a strong argument that this question is a duplicate

I don't know though of any ASCII art to draw a cube in this projection. With the small size though, I don't know if one can do better than hardcoding in languages like Python.

Related: http://meta.codegolf.stackexchange.com/a/8197/17602

@xnor indeed, even with some 7 and 8 char sequences in there.

Python 3, 197 196 192190 bytes
from random import*;c=choice;r=range(1,7);u=c(r);l=c(list({*r}-{u,u^7}));print(r'''   ________
  /\       \
 /  \%4d   \
{ %d  }-------}
 \  /%4d   /
  \/_______/'''%(u,l,3*u*l*(u*u-l*l)%7))

Try it online!
Right-handed (switch to a lefty by swapping u*u with l*l on the last line)
Bound to be beat - but let's get the dice rolling sigh - especially since all my attempts to golf the ASCII except going raw and using old-school formatting all failed to save bytes;

any further golfing tips for a n00b gladly appreciated.

You can save 1 byte by using from random import* and c=choice.

@daHugLenny - didn't now I could miss that white space before the *; ta!

Welcome to PPCG! Nice first post!

Thanks @GamrCorps - I have been meaning to do some for a while... now I have rep I can post a meaningful solution on a protected question... :D

Instead of having 3 spaces and then %d, use %4d instead and it'll pad it properly for you. You might be able to leverage it for other parts of the die as well.

C,177
f(r){r=rand()%24;r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;printf("   ________\n  /\\%9s /  \\%4d   \\\n{ %d  }-------}\n \\  /%4d   /\n  \\/_______/","\\\n",7&r,7&r/8,7&r/64);}

In test program
f(r){r=rand()%24;
r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;
printf("   ________\n  /\\%9s /  \\%4d   \\\n{ %d  }-------}\n \\  /%4d   /\n  \\/_______/","\\\n",7&r,7&r/8,7&r/64);}

j;
main(){
    for(j=99;j--;puts(""))f();
}

Explanation
r=                    \\after calculation, assign to r (in order to use only one variable.)
(5545>>r%4*3&63       \\5545 is 12651 in octal. Select 2 digts for the equator
^256-(r*2&8))         \\if 4's bit of r is 0, prepend 4=256/64. Else prepend 3 and reverse one of the faces by xoring with 7. 256-8 = 248 = 3*64+7*8.
*513                  \\now we have a 3 digit octal number. duplicate all digits by multiplying by 1001 octal.
>>r/8*3               \\rightshift 0,1 or 2 digits to rotate.

Javascript 238 232 207 201 bytes
var r=24*Math.random()|0,o=r%3,b=r-o,v="123513653263154214624564";console.log(`   ________
  /\\       \\
 /  \\   %s   \\
{ %s  }-------}
 \\  /   %s   /
  \\/_______/`,v[r],v[b+(o+1)%3],v[b+(o+2)%3])

which when ungolfed is:
var r = 24 * Math.random() | 0,
    o = r % 3,
    b = r - o,
    v = "123513653263154214624564";
console.log(
`   ________
  /\\       \\
 /  \\   %s   \\
{ %s  }-------}
 \\  /   %s   /
  \\/_______/`,

    v[r],
    v[b+(o+1)%3]
    ,v[b+(o+2)%3]
)

Algorithm
Consider that at each of the 8 corner intersections of a die, the intersecting die face values are fixed but can appear in any of 3 rotations. For example while looking down at the "1","2","3" corner, the die can be rotated about an axis through the corner and out the opposite corner, to show "1", "2" or "3" on top of the ASCII art.
v hard codes the die faces which intersect at each corner, b is an offset to the start of a random corner, and o is start of the rotation within corner data. The ASCII art is written to the console using a console.log format string.

You can probably shave a few bytes by using \`` quotes which permit the use of literal newline characters instead of having to write \n` all the time.

@Neil most appreciated, it worked well. Also removed the trailing ';'

Javascript, 251 bytes
r="replace";a=()=>(0|Math.random()*6)+1;b=(x,y)=>3*x*y*(x*x+6*y*y)%7;u=()=>{x=a(),y=a();z=b(x,y);if(z==0)u();return"   ________\r\n  \/\\       \\\r\n \/  \\   1   \\\r\n{ 2  }-------}\r\n \\  \/   3   \/\r\n  \\\/_______\/"[r](1,x)[r](2,y)[r](3,z);}

Call using u();
It's long but it's an answer, and I haven't answered in a long time.

Missing a space at the top-left of the output test on ideone.

a=()=>(0|Math.random()*6)+1; should save 8

TSQL 308 bytes
DECLARE @ char(87)=(SELECT
REPLACE(REPLACE(REPLACE('   ________
  /\       \
 /  \   7   \
{ 8  }-------}
 \  /   9   /
  \/_______/',7,a),8,b),9,3*ABS(a*a*a*b-a*b*b*b)%7)
FROM(SELECT*,SUBSTRING(REPLACE(STUFF(123456,a,1,''),7-a,''),CAST(RAND()*4as int)+1,1)b
FROM(SELECT CAST(RAND()*6as int)+1a)x)x)PRINT @

280 bytes(in Server Management Studio: Query - result to text)
SELECT
REPLACE(REPLACE(REPLACE('   ________
  /\       \
 /  \   7   \
{ 8  }-------}
 \  /   9   /
  \/_______/',7,a),8,b),9,3*ABS(a*a*a*b-a*b*b*b)%7)
FROM(SELECT*,SUBSTRING(REPLACE(STUFF(123456,a,1,''),7-a,''),CAST(RAND()*4as int)+1,1)b
FROM(SELECT CAST(RAND()*6as int)+1a)x)x

Note: by removing the print and the declare part - and output the result directly from the SELECT. However that would not work in the fiddle
Fiddle

Maybe you can change to ABS(a^3*b-a*b^3) to save 4 bytes? (I'm not sure - seems to work in the fiddle, but it is only ever giving me a single roll of a,b,c=5,1,3 so I may be mistaken)

@JonathanAllan thank you for your comment. Exponential is written POWER(a,3) in TSQL. ^ has a different meaning

Ruby, 150 bytes
All the string formatting abuse!!!
Credit for formula obtaining the last number goes to @xnor here.
u=1+rand(6)
l=([*1..6]-[u,u^7]).sample
$><<'%11s
  /\%8s
 /  \%4d%4s
{ %d  }%s}
 \  /%4d%4s
  \/%s/'%[?_*8,?\\,u,?\\,l,?-*7,3*u*l*(u*u-l*l)%7,?/,?_*7]

No - credit for formula goes to xnor

@JonathanAllan thanks for pointing me towards the proper credit. At any rate, how I formatted this answer was more what I had in mind when I said you could probably leverage string formatting more to your advantage to save bytes.

Python 3, 181 bytes
from random import*;a,b,c,d=sample(b"FGHJ",k=4);u,l=a-b,c-d;print(r'''   ________
  /\       \
 /  \%4d   \
{ %d  }-------}
 \  /%4d   /
  \/_______/'''%(u%7,l%7,3*u*l*(u*u-l*l)%7))

Right-handed die. Try it online
Explanation
The bytes b"FGHJ" are equivalent to (0,1,2,4) mod 7. The 4!=24 possible permutations of these numbers happen to give all 24 possibilities for the first two die numbers. I'm not sure how to demonstrate this, except listing all the possibilities:
(0, 1, 2, 4) -> (6, 5)
(0, 1, 4, 2) -> (6, 2)
(0, 2, 1, 4) -> (5, 4)
(0, 2, 4, 1) -> (5, 3)
(0, 4, 1, 2) -> (3, 6)
(0, 4, 2, 1) -> (3, 1)
(1, 0, 2, 4) -> (1, 5)
(1, 0, 4, 2) -> (1, 2)
(1, 2, 0, 4) -> (6, 3)
(1, 2, 4, 0) -> (6, 4)
(1, 4, 0, 2) -> (4, 5)
(1, 4, 2, 0) -> (4, 2)
(2, 0, 1, 4) -> (2, 4)
(2, 0, 4, 1) -> (2, 3)
(2, 1, 0, 4) -> (1, 3)
(2, 1, 4, 0) -> (1, 4)
(2, 4, 0, 1) -> (5, 6)
(2, 4, 1, 0) -> (5, 1)
(4, 0, 1, 2) -> (4, 6)
(4, 0, 2, 1) -> (4, 1)
(4, 1, 0, 2) -> (3, 5)
(4, 1, 2, 0) -> (3, 2)
(4, 2, 0, 1) -> (2, 6)
(4, 2, 1, 0) -> (2, 1)

I found this formula partially by trial-and-error, guided by the fact that the set of possible pairs of numbers possesses certain symmetries (e.g., u can be replaced with -u by swapping a with b, and u and l can be swapped by swapping a with c and b with d). The formula for the third number is xnor's.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/