Sorry for the perhaps confusing title, but essentially what I am doing is testing a list of things held by the player, each of which are of the same kind and have a numerical value attached to them. I am looking for the thing that has the highest such value.

Strangely enough, I seem to have figured this out on my own. So my question is not how to do it, but whether the solution I have come up with is the most efficient one and/or does not contain some pitfall that I am missing.

Here is the code:

```
A gadget is a kind of thing. A gadget has a number called complexity. The complexity is usually 1.
Understand the command "evaluate" as something new. Evaluating is an action applying to nothing. Understand "evaluate" and "eval" as evaluating.
Carry out evaluating:
if the player carries a gadget:
let the previous rating be 0;
let the chosen one be nothing;
Repeat with item running through gadgets held by the player:
let current rating be complexity of item;
if current rating is greater than previous rating:
now previous rating is current rating;
now the chosen one is item;
let stash be the number of gadgets held by the player;
say "You are carrying a total of [stash in words] gadget[s], [if stash is greater than 1]the most complex of which is [end if][the chosen one] (complexity level [complexity of the chosen one]).";
otherwise:
say "You are not carrying any gadgets."
The Gadgetorium is a room. "Here is where you keep all your gadgets, from the least to the most complex." The blorg, the zeret, the klaxta, the mip, and the weecog are gadgets in the Gadgetorium. The complexity of the zeret is 4. The complexity of the klaxta is 2. The complexity of the mip is 3. The complexity of the weecog is 5.
test me with "eval / take blorg / eval / take zeret / eval / take all / eval".
```

(I am aware that the above code will not distinguish between two gadgets of equal complexity. So, for example, if I had two gadgets with a complexity of 5, the result here would be whichever gadget comes later in the list. I did briefly consider refining the code to take this into account, but for what I am using this for I will not need such a distinction: Each item will have a different value attached to it.)

I gotta admit that I’m kind of chuffed to have figured this out myself. But I also know that the regulars here are far more informed (ahem) than I am and will no doubt be able to point out places where this code can be improved, either in terms of efficiency or coding practices.

Thanks in advance for any pointers.