May 2019
Beginner to intermediate
466 pages
10h 44m
English
For the fifth and very last part of our spec, we need to display information about the game and provide a way to navigate back to the previous articles. We'll define the following functions:
function objective(game)
"""
<h3>
Go from <i>$(game.articles[1].title)</i>
to <i>$(game.articles[end].title)</i>
</h3>
<h5>
Progress: $(size(game.history, 1) - 1)
out of maximum $(size(game.articles, 1) - 1) links
in $(game.steps_taken) steps
</h5>
<h6>
<a href="/$(game.id)/solution">Solution?</a> |
<a href="/">New game</a>
</h6>"""
end
The objective function informs the player about the start and end articles and about the current progress. It also provides a small menu so that you can view the solution ...
Read now
Unlock full access