Skip to content

Latest commit

 

History

History
75 lines (53 loc) · 5.07 KB

README.md

File metadata and controls

75 lines (53 loc) · 5.07 KB

Vim Robots

Introduction

This is a Vim plugin implementation of the game Robots. Check out this Wikipedia article to learn its history.

There is one key difference between the classic game and this modern Vim update. The original version is based on a Cartesian grid, with movement in the usual 8 directions,...

Robots on Cartesian grid
Figure 1: Robots on Cartesian grid

but this reincarnation is based on a hexagonal grid, with movement in only 6 directions. Disclaimer: the hexagonal tiling and letters (y, k, u, n, j, and b) in the image below are for illustrative purposes only, and are not generated during gameplay.

Robots on a hexagonal grid
Figure 2: Vim-Robots on a hexagonal grid

Installation

Use your favorite plugin manager. If you don't have one, try one of these: vim-pathogen, vim-plug, Packer.nvim or lazy.nvim. Alternatively, you can use packages and submodules, as Greg Hurrell (@wincent) describes in his excellent Youtube video: Vim screencast #75: Plugin managers

Playing the game

Start a game with the :Robots command.

You are the green solid circle. Robots are purple squares, and the junk piles are orange triangles. Your colors may vary, depending on your Vim colorscheme and/or terminal color settings.

The robots are programmed to pursue you at all costs, and will choose the shortest path to do so. They move in a straight line diagonally or vertically, but horizontal movement requires them to zig-zag randomly toward you. Fortunately, the robots are oblivious to each other, and will collide, leaving a flaming pile of junk. To survive to the next level, you must lure all the robots to walk into a junk pile or another robot, while avoiding being captured.

In later levels, you can take advantage of portals to travel instantly from one edge of the field to the opposite side. Eventually, the robots will catch on, and track you down through those portals too, so be careful.

Movement Keys

Main Keyboard Number Keypad Direction
y 7 Up left
k 8 Up
u 9 Up right
b 1 Down left
j 2 Down
n 3 Down right

Other Commands

Key Function
t Transport If you become trapped, you can transport to another location.
d Decoy Place a decoy down at your current location.
w Wait Sometimes the only winning move is not to play, but to wait and let the robots advance one step.
F Finish Finishing the level means waiting in place until defeat or triumph. Earn double the points and recharge your shield.
? Help Toggles the statusline to show the symbol legend and key mappings. The next move resets the statusline.
Esc Boss Key What? You've never heard of this?

Transporter and Shield

Your transporter and shield are closely linked. The transporter is used to whisk you away from imminent capture, but using it comes at a cost. Each transport reduces the shield's strength by 100%. If the shield is below 100%, you could transport onto a robot or junk pile, and be captured immediately. Using the F key to finish a level will recharge your shield at the rate of 20% for each defeated robot. There is no maximum shield strength.

Decoy

Once per level, you can deploy a decoy with the d key, which can help you escape encroaching robots. They will move toward the decoy, allowing you to briefly move without being followed. The duration of the decoy is a function of your shield strength, and doesn't drain your shield. It is always better to use the decoy as a first option.

Customization

The symbols representing various items can be changed to your liking. The statements below recreate the retro look, and the default values are shown in the comments.

let g:robots_empty = "\u00a0"    " Default: ·  An unoccupied cell on the board
let g:robots_robot = '+'         " Default: ■  A robot bent on capturing you
let g:robots_junk_pile = '*'     " Default: ▲  A junk pile
let g:robots_player = '@'        " Default: ●  You
" The following settings have no counterpart in the original game.
let g:robots_safe_portals  = 'o' " Default: ⬡ A portal only you can use
let g:robots_risky_portals = '#' " Default: ⬢ A portal you and robots can use

When transporting, a meandering path is drawn from the starting location to the final destination. It's just a bit of hi-res eye candy, and it can be slow on some computers. To turn it off, use this statement:

let g:robots_animation = 0