So, I'll give this a try: my writeup of Skirmish 8 in the RPCiege.
On the off-chance someone reads this without knowing what that is, here's a brief summary.
On www.rpciege.com there is a series of coding games/challenges on the Soroban smart contract platform. It's currently in a testing stage, aiming to go live end of 2023.
RPCiege (and its predecessor Stellar Quest) will let you get familiar with the language and platform, and gives you kick-ass collectible cards to boot.
So, on to Skirmish 8. I'll give a brief writeup of how I attempted to tackle this, and give some hints on how you can solve it.
No full solution, but enough to get you going.
The booklet gives you your mission, and a helpful link to documentation. However, with the latest preview release, you don't actually need the linked docs!
To get started, we have a contract. I always start by pointing my friend -h
at the contract.
It will tell you what functions the contract has, which is always a good start.
And you can also use -h
on those functions itself, to get information about what parameters the function expects. Let's have a look:
The _nft_dest
is optional, so I'll skip it. I already have the cards and my spot on the leaderboard :)
For source, I'll just use my configured identity.
But notice how --answer
expects an <Array<u32>>
? And it even gives an example of such an array.
I took the lazy route, and just tried it with that example.
In the current release, we see a lot of diagnostic events, along with the return of the function.
So, a few things to unwrap here:
1) I just passed [1] as answer
2) The diagnostics return a vector: [0, 4508]
3) We died.. that's usually not good.
So, we didn't solve this yet. But did you expect that, with an answer of [1]
?
I'll give a hint here: the 0 in that vector is the number of positions we got correct.
And we got some information: the number 4508.
So, let's try --answer
with that as input:
And now we starved.. so something has changed.
And notice that we did not get a screen full of diagnostic info.
So, when we Died
, the contract emitted a diagnostic event, and when we Starved
, it did not.
But that also leaves us stuck for a bit.
Any random input leads to Died
, except for that number we got returned earlier.
But --answer
takes a vector! So we can input more numbers.
After some fiddling around, I decided to add my random guess after the 4508:
We still Died
, but have a different diagnostic event.
So we're getting somewhere. 1 correct position, and the number 4509.
That should be enough to get you going.
For reference, there is another way to get the diagnostic events.
Soroban-cli has a command for it. You can point it at a contract, and it will return (recent) events emitted by it.
The part that always trips me up is the --start-ledger
I end up getting that from Stellar Laboratory. If there's a better way to find out what the latest ledger is, let me know!
Row-Bear
PS: After you have some parts of your sequence right, you might be able to predict the next parts..
If you're smarter than me, that may take you less time than uncovering them one by one.
PPS: Other than Died
or Starved
, you can also get Exploded
. Bonus points if you reach that :)