[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7803":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},7803,"ruby-warrior","ryanb\u002Fruby-warrior","ryanb","Game written in Ruby for learning Ruby.","",null,"Ruby",3888,827,207,35,0,1,30.75,"MIT License",false,"master",true,[],"2026-06-12 02:01:44","# Ruby Warrior\n\nThis is a game designed to teach the Ruby language in a fun and interactive way.\n\nYou play as a warrior climbing a tall tower to reach the precious Ruby at the top level. On each floor you need to write a Ruby script to instruct the warrior to battle enemies, rescue captives, and reach the stairs. You have some idea of what each floor contains, but you never know for certain what will happen. You must give the Warrior enough artificial intelligence up-front to find his own way.\n\n> Note: The player directory structure changed on July 18, 2009. If you have an old profile using the `level-00*` structure then move the contents of the last level into the parent directory.\n\n\n## Getting Started\n\nFirst install the gem.\n\n```sh\ngem install rubywarrior\n```\n\n> As of version 0.2.0, this gem has been updated to work with Ruby 3.3. If you have difficulty running it in an older version of Ruby, try using an older version of the gem.\n\nThen run the `rubywarrior` command to setup your profile. This will create a rubywarrior directory in your current location where you will find a player.rb file in your profile's directory containing this:\n\n```rb\nclass Player\n  def play_turn(warrior)\n    # your code goes here\n  end\nend\n```\n\nYour objective is to fill this `play_turn` method with commands to instruct the warrior what to do. With each level your abilities will grow along with the difficulty. See the README in your profile's directory for details on what abilities your warrior has available on the current level.\n\nHere is a simple example which will instruct the warrior to attack if he feels an enemy, otherwise he will walk forward.\n\n```rb\nclass Player\n  def play_turn(warrior)\n    if warrior.feel.enemy?\n      warrior.attack!\n    else\n      warrior.walk!\n    end\n  end\nend\n```\n\nOnce you are done editing `player.rb`, save the file and run the `rubywarrior` command again to start playing the level. The play happens through a series of turns. On each one, your `play_turn` method is called along with any enemy's.\n\nYou cannot change your code in the middle of a level. You must take into account everything that may happen on that level and give your warrior the proper instructions from the start.\n\nLosing all of your health will cause you to fail the level. You are not punished by this, you simply need to go back to your `player.rb`, improve your code, and try again.\n\nOnce you pass a level (by reaching the stairs), the profile README will be updated for the next level. Alter the `player.rb` file and run `rubywarrior` again to play the next level.\n\n\n## Scoring\n\nYour objective is to not only reach the stairs, but to get the highest score you can. There are many ways you can earn points on a level.\n\n* defeat an enemy to add his max health to your score\n* rescue a captive to earn 20 points\n* pass the level within the bonus time to earn the amount of bonus time remaining\n* defeat all enemies and rescue all captives to receive a 20% overall bonus\n\nA total score is kept as you progress through the levels. When you pass a level, that score is added to your total.\n\nDon't be too concerned about scoring perfectly in the beginning. After you reach the top of the tower you will be able to re-run the tower and fine-tune your warrior to get the highest score. See the Epic Mode below for details.\n\n\n## Perspective\n\nEven though this is a text-based game, think of it as two-dimensional where you are viewing from overhead. Each level is always rectangular in shape and is made up of a number of squares. Only one unit can be on a given square at a time, and your objective is to find the square with the stairs. Here is an example level map and key.\n\n```\n ----\n|C s>|\n| S s|\n|C @ |\n ----\n\n> = Stairs\n@ = Warrior (20 HP)\ns = Sludge (12 HP)\nS = Thick Sludge (24 HP)\nC = Captive (1 HP)\n```\n\n\n## Commanding the Warrior\n\nWhen you first start, your warrior will only have a few abilities, but with each level your abilities will grow. A warrior has two kinds of abilities: actions and senses.\n\nAn action is something that effects the game in some way. You can easily tell an action because it ends in an exclamation mark. Only one action can be performed per turn, so choose wisely. Here are some examples of actions.\n\n```\nwarrior.walk!\n  Move in given direction (forward by default).\n\nwarrior.attack!\n  Attack the unit in given direction (forward by default).\n\nwarrior.rest!\n  Gain 10% of max health back, but do nothing more.\n\nwarrior.bind!\n  Bind unit in given direction to keep him from moving (forward by default).\n\nwarrior.rescue!\n  Rescue a captive from his chains (earning 20 points) in given direction (forward by default).\n```\n\n\nA sense is something which gathers information about the floor. You can perform senses as often as you want per turn to gather information about your surroundings and to aid you in choosing the proper action. Senses do NOT end in an exclamation mark.\n\n```\nwarrior.feel\n  Returns a Space for the given direction (forward by default).\n\nwarrior.health\n  Returns an integer representing your health.\n\nwarrior.distance\n  Returns the number of spaces the stairs are away.\n\nwarrior.listen\n  Returns an array of all spaces which have units in them.\n```\n\n\nSince what you sense will change each turn, you should record what information you gather for use on the next turn. For example, you can determine if you are being attacked if your health has gone down since the last turn.\n\n\n## Spaces\n\nWhenever you sense an area, often one or multiple spaces (in an array) will be returned. A space is an object representing a square in the level. You can call methods on a space to gather information about what is there. Here are the various methods you can call on a space.\n\n```\nspace.empty?\n  If true, this means that nothing (except maybe stairs) is at this location and you can walk here.\n\nspace.stairs?\n  Determine if stairs are at that location\n\nspace.enemy?\n  Determine if an enemy unit is at this location.\n\nspace.captive?\n  Determine if a captive is at this location.\n\nspace.wall?\n  Returns true if this is the edge of the level. You can't walk here.\n\nspace.ticking?\n  Returns true if this space contains a bomb which will explode in time.\n\nspace.golem?\n  Returns true if a golem is occupying this space.\n```\n\nYou will often call these methods directly after a sense. For example, the `feel` sense returns one space. You can call `captive?` on this to determine if a captive is in front of you.\n\n```\nwarrior.feel.captive?\n```\n\n\n## Golem\n\nAlong your journey you may discover the ability to create a golem. This is a separate unit which you also control. The turn handling is done through a block. Here is an example.\n\n```rb\nwarrior.form! do |golem|\n  golem.attack! if golem.feel.enemy?\nend\n```\n\nComplex logic can be placed in this block just like in the player turn method. You may want to move the logic into its own class or create multiple classes for different types of golems. You can create multiple golems in a level, but each one will take half of the warrior's health.\n\n\n## Epic Mode\n\nOnce you reach the top of the tower, you will enter epic mode. When running rubywarrior again it will run your current player.rb through all levels in the tower without stopping.\n\nYour warrior will most likely not succeed the first time around, so use the -l option on levels you are having difficulty or want to fine-tune the scoring.\n\n```sh\nrubywarrior -l 3\n```\n\nOnce your warrior reaches the top again you will receive an average grade, along with a grade for each level. The grades from best to worst are S, A, B, C, D and F. Try to get S on each level for the ultimate score.\n\nNote: I'm in the process of fine-tuning the grading system. If you find the `S` grade to be too easy or too difficult to achieve on a given level, please add an issue for this on GitHub.\n\n\n## Tips\n\nIf you ever get stuck on a level, review the README documentation and be sure you're trying each ability out. If you can't keep your health up, be sure to `rest` when no enemy is around (while keeping an eye on your health). Also, try to use far-ranged weapons whenever possible (such as the bow).\n\nRemember, you're working in Ruby here. Don't simply fill up the `play_turn` method with a lot of code. Organize it with methods and classes. The player directory is set up as a load path so you can include other ruby files from your player.rb file.\n\nSenses are cheap, so use them liberally. Store the sensed information to help you better determine what actions to take in the future.\n\nRunning `rubywarrior` while you are in your profile directory will auto-select that profile so you don't have to each time.\n\nIf you're aiming for points, remember to sweep the area. Even if you're close to the stairs, don't go in until you've gotten everything (if you have the health). Use far-ranged senses (such as look and listen) to determine if there are any enemies left.\n\nMake sure to try the different options you can pass to the rubywarrior command. Run `rubywarrior --help` to see them all.\n","Ruby Warrior 是一个用 Ruby 编写的游戏，旨在以有趣且互动的方式教授 Ruby 语言。玩家扮演一名勇士，通过编写 Ruby 脚本来控制勇士攀爬高塔、击败敌人、解救俘虏并找到通往下一关的楼梯。游戏的核心在于为勇士编写具有一定智能的脚本，使其能够自主应对各种情况。Ruby Warrior 适合初学者和有一定基础的开发者在实践中学习和巩固 Ruby 语法及编程思维。它不仅是一个学习工具，也是一个挑战逻辑思维与问题解决能力的好方法。",2,"2026-06-11 03:14:28","top_language"]