A Fun Game for Rubyists to Play!
By: Nana Lau
Tags: Ruby, Fun, Coding Practice, Games

Hey everyone! This is my second blog! I was browsing over the internet and trying to see if there is anything cool but technical that I can write about Ruby, and I came across this fun little game that’s going to help kill some extra brain cells that are left in your brain after coding for the whole day!

LET’S GET STARTED!

This coding game that I found is called “Ruby Warrior”. In this game, you have control of this poor warrior who is trying to defeat all his enemies. Throughout his journey to defeat the bad guys, you will need to use Ruby to help him pass through all the possible obstacles on different floors. This game has two difficulties that you can choose from, which are between Beginner and Intermediate, and it mainly focuses on using Ruby conditionals to help this poor warrior to survive to the end. I will demonstrate a few levels in the Beginner difficulties to show how this game can help kill brain cells!

This is the home page of the game, which I think is pretty cute!

The following is Level 1, which is a tutorial, where it will kind of give you a walkthrough of how this game is supposed to be played. As you can see, they provide a code snippet area where you can code for the warrior to perform as to your order. By typing “warrior.walk!”, you will be able to have this little warrior to move toward the space in front of him as indicated. And each method ends with a “!” can only be called once per turn.

Level 1 of Ruby Warrior~

These are all of the methods I manage to acquire through level 6

Passing in the following code in the snippet will get the warrior through this level with ease.

Code for Level 1

Happy Warrior passed through level 1 with no problem! Yes!

In order to show you how fun this game can get, let me show you the floor map on each level!

This is Level 2, it doesn’t seem to be too difficult:

Map of Level 2

The moment little warrior eliminate his enemy

This is Level 3, and it still doesn’t seem too difficult:

Map of Level 3

I went through it fairly easily

I passed Level 3 with the following code:

Code to pass through Level 3

Which seems pretty manageable, right? However, when it comes to Level 4, it will require a little bit more time comparing to the previous levels. The following map is Level 4, in which the archer will be shooting arrows at you as long as you eliminate the first big green blobby monster a spaced away.

Map of Level 4

I tried my best to capture the moment of him trying to murder the warrior, this is the closest picture I got, where the poor warrior only had one heart left, after the final blow, he died:

Hate this annoying archer!

I manage to pass through this level at the end with some modification of my code. And in the following, this is how it looks like in Level 5… Now there are two annoying archers, and two captives that's crying for help, and you can’t accidentally kill them or leave them alone, or else that's a fail:

Map of Level 5

This is the little warrior on the way to save the last captive

This is the code that I want to show you guys that got through this level. It also took me a while to figure this out.

It took me a while to get the code for this level figured out, as it requires more logical thinking so the poor warrior won’t get killed by the two archers in the middle. I only played through Level 6, which is as follows. Where you need to start teaching the Warrior to walk backward! Wonderful! The warrior was only able to walk to the right, which is forward, from Level 1 through 5.

Map of Level 6

This is a fun and educational game for beginner Rubyists who were not really comfortable with writing conditionals with if, else, and elsifs. It helps you to get more practice on identifying which condition should be paired and grouped with which conditions. I found that this game has a total of 9 levels. With the two different difficulties that it has(all the above examples are from the beginner difficulty), I believe there will be so much more fun and satisfaction as you manage to process through all the levels in both difficulties.

My final words: For those of you who would like to get some challenge, or whoever has some extra brain cells and would like to get some practice on conditional in a fun way, give it a try. You will feel pretty accomplished after you are done!

Here’s a picture of a broken cat after it tries playing the game:

Have a great day to whoever got to the bottom of this blog!

This is the link for those of you who really want to play the game: https://www.bloc.io/ruby-warrior/#/