DEV Community

Row-Bear
Row-Bear

Posted on

RPCIEGE - Skirmish 8

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.

Image description
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.

Image description
And you can also use -h on those functions itself, to get information about what parameters the function expects. Let's have a look:
Image description

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.
Image description

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:

Image description
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:
Image description

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 :)

Top comments (1)

Collapse
 
respect17 profile image
Kudzai Murimi

Welcome to the community, Row-Bear! We're thrilled to have you here. It's always exciting to see new faces joining us and bringing fresh perspectives. I hope you find this community to be a warm and supportive place where you can connect with like-minded individuals.

If you have any questions or need any assistance as you navigate your way around, don't hesitate to reach out. We're all here to help each other out. Feel free to share a bit about yourself, your interests, or any topics you're particularly passionate about. We're eager to get to know you better and learn from your experiences.

Once again, a warm welcome to the community, Row-Bear! We're looking forward to seeing your contributions and getting to know you. Enjoy your time here, and don't hesitate to join in on the discussions. Happy connecting!