Skip to content

Navigator: Puzzles by Tuum Est ˆ

Optimize Emacs Tetris on Apple Terminal

Square the Game Board & Manage Scores

Emacs Tetris:  Introduction

Tetris is one of several free arcade games on Emacs. Access is instantaneous: you can enjoy a few rounds during your first cup of coffee of the day without the frustration of a marathon wait for online Tetris Marathon, Battle, or Blitz. Emacs has some drawbacks: One is the lack of nimble moves such as T-Spins. Another is the default game board.

The standard Tetris game board has 10 columns and 20 rows. On graph paper it forms a matrix 10 units by 20 units, with each unit a perfect square. Tetris on Emacs uses the same layout, with this exception: Each unit is not a square, but instead gets compressed sideways into a tall narrow rectangle. In its default state, the Emacs Tetris board is squashed, making the game unplayable.

This tutorial shows you how to enlarge the Emacs Tetris board, and adjust the tetrimino geometry, by adjusting the font in Terminal Preferences. Compare the before-and-after screenshots below where we transform the default board (left) into a square build (right).

Emacs Tetris:  Default Board versus Square Build

Terminal Prefs / Default Font

Terminal Default
Font: Monaco 15px
Char-spacing 1.0
Line-spacing 1.0

Terminal Prefs / Font Verdana 23px / Char-spacing 1.4 / Line-height 1.1

Font: Verdana 23px / Character-spacing 1.4 / Line-spacing 1.1

Launch Emacs Tetris in Terminal

Terminal is found in Applications > Utilities. For quick access, put the Terminal icon in the Dock. To launch the Emacs game Tetris, open Terminal and enter the commands below.

  • At the prompt, type Emacs then hit Return.
  • Screen: Welcome to GNU Emacs, a part of the GNU operating system.
  • Click the Escape key, then type x (do not hit Return yet).
  • An M-x prompt appears at bottom-left of the Terminal window.
  • Type tetris (all lowercase) and hit Return.

Emacs Command Line Prompt

Apple Terminal: Emacs Command Line Prompt M-x

Terminal Preferences:  Adjust Tetrimino Geometry

  • Open the Terminal application.
  • In the top menu bar click Terminal > Preferences
  • In the pane that appears, select Profiles and the Text tab.
  • In the row labeled Font, click the Change button (screenshot below)

Terminal Preferences / Change Font Button

Apple Terminal Preferences / Profiles / Text Tab
  • A Fonts pane appears. Select a font, and adjust its characteristics, just as if you were setting up to work in the Terminal window. The font governs the shape of alpha-numeric characters; equally, the font governs the shape of the geometric Tetris pieces (called tetriminos). We aim to stretch the pieces into a square build. Many options are possible: those below suit a 13-inch Mac laptop.
  • Select the Verdana font, regular typeface, size 23 pixels.
  • Set the Character Spacing to 1.4  (stretch tetriminos horizontally).
  • Set the Line Spacing to 1.1  (stretch tetriminos vertically).

Terminal Preferences / Fonts Pane

Apple Terminal Preferences / Profiles / Select Font

Optimize the Terminal Window

Finally, re-size the background of the Tetris game. The Terminal window should cover the height of your computer screen for maximum playing space. But if the window covers the width, the game sits too far left. For comfort you can center the board on the screen (approximately) while leaving room to display the active scorecard beside it. Follow the steps below:

  • In Terminal > Preferences, select Profiles and the Window tab.
  • Under Window Size enter a number for each of Columns and Rows.
  • Example: On a 13-inch Mac retina screen, we set the Terminal window
    size at 32 columns by 24 rows.
  • Adjust this at will, depending on the size of your computer.

Terminal Preferences / Window Size

Apple Terminal Preferences / Profiles / Windows Tab

Emacs Tetris:  Controls and Tips

Commercial brands of Tetris often assign unique colors to the tetriminos. Emacs does as well, but accommodating to color change is easy. The controls present more difficulty: In Emacs you have a hard-drop (but no soft-drop). You cannot rotate pieces after they land, which bans snazzy T-Spins. The counter-clockwise rotation button is on the opposite side of the keyboard, which means a learning curve if you alternate venus.

Emacs Tetris Controls

Left arrow Move left (one space per click)

Right arrow Move right (one space per click)

Up arrow Rotate clockwise (90° per click)

Down arrow Rotate counter-clockwise (90° per click)

Spacebar Hard-drop (no soft-drop)

P Pause / Resume (toggle)

N New game (start fresh)

Q Quit game (quit and see scores)

Tips and Tricks for Emacs Tetris

  • Plug in the power cord of your computer: Keystrokes will respond more swiftly.
  • Best way to delay a crash: Don't allow the board to stack too high. In Emacs this will not affect scoring, because clearing multiple lines earns no extra points.
  • Try to preserve a flat space, two units wide, to receive a blue square when it drops.
  • When Emacs throws out repeated shapes, it can help to stack Z-pieces (pink color) at the left edge of the board, and S-pieces (aqua color) at the right edge.

Emacs Command Line Messages

  • When a Tetris game ends, the command line at the bottom of the screen may say: Buffer has been auto-saved recently. Revert from auto-save file? (y or n). You should type y or n – for yes or no (choose either, it makes no difference).
  • After that, and for all other messages, click Escape and x. This will bring up the M-x prompt where you can re-type the game name tetris.

Manage the Emacs Tetris Score Buffer

After you play Emacs Tetris awhile, the score buffer fills up. At one time, Emacs purportedly cleared out low scores in the buffer to make room for higher scores. We find this no longer occurs. However, the system permits you to manage the buffer manually. Your steps:

There are two ways to locate the Tetris score buffer:

  • Display hidden files on your Mac, then examine your home folder.
  • Or enter this path in the Go Menu:  ~/.emacs.d/games

The Tetris score buffer consists of two text files with matching contents. To free up room in this buffer, manually delete your lowest set of scores from both files.

  • tetris-scores > Control-click > Open With > TextEdit
  • #tetris-scores# > Control-click > Open With > TextEdit

If necessary, click Open With > Other which displays the Choose Application pane. Scroll down the list of apps, highlight TextEdit, then click the Open button.

Emacs Score Buffer: Hidden Folder (Starts with a Dot) inside your Home Folder

Emacs Game Buffer in Home Folder

Emacs Score Buffer: Open in TextEdit, Delete Lowest Scores (Match Both Files)

Emacs Score Buffer: Open and Manage in TextEdit

Introduce a Puzzle Aspect to Tetris

If always played at breakneck pace, Tetris speedily leads to tedium. To maintain interest, practice an expert move – fit the pieces under ledges. The timing is tricky for novices so train when the game is slowest (at the start). Our favorite: drop the first few pieces as is without any rotation or sideways movement. To set up quickly, hit the hard-drop key (spacebar) 4 or 5 times in succession. Create a glorious mess – then get yourself out of it. A sample is below.

Tetris fit piece under ledge Tetris fit piece under ledge Tetris fit piece under ledge

Emacs Tetris:  Monochrome Variant

The Department of Physics of Complex Systems in Amsterdam created the world's smallest Tetris game. The playing pieces (tetriminos) are assembled from 42 glass microspheres, each measuring 1 μm (0.001 mm) in diameter. An electron microscope optically traps the microspheres inside a rectangular area of size 25 μm x 20 μm. The position of the microspheres is steered by computer in this real-life implementation.

Play a similar variant in Emacs by changing the Terminal interface from color to monochrome. Specifically, set the Terminal environment variable to emulate the physical CRT Video Terminal invented in 1978 by Digital Equipment Corporation (brand names DEC VT100 and VT102). The Emacs game board becomes stark black and white. The game pieces are devised from circles – each of the seven tetriminos takes four circles. Have fun: this version requires concentration.

  • Play Emacs Tetris with circular pieces on a monochrome board:
  • In Terminal > Preferences, select Profiles and the Advanced tab.
  • In the row labeled Terminfo, declare the terminal as either vt100 or vt102.
  • For the change to take effect, quit and then re-open Terminal.

Tetris: Amsterdam University
42 Glass Microspheres (1 μm Diameter)
Optically Trapped by Electron Microscope

Tetris: Amsterdam Electron Microscope

Emacs Tetris: Circles on Monochrome Board
Environment Variable: VT100
Emulate DEC Video Terminal

Emacs Tetris: Monochrome vt100

Research:  How Video Games Affect Cognition

Over three decades ago, Tetris was invented by Alexey Pajitnov of Moscow. He formed a partnership with Vladimir Pokhilko who studied the game in his clinical psychology lab at the Moscow Health Institute. Pokhilko analyzed what attracts the brain to Tetris:

In Tetris the main part is visual insight. You make your visual decision and it happens almost immediately. Insight means emotion: small, but many of them, every two, three seconds. The second mechanism is unfinished action. Tetris has many unfinished actions (that) force you to continue and make it very addictive. The third is automatization: In a couple of hours, the activity becomes automatic, a habit, a motivation to repeat.

California psychology professor Richard Haier used Positron-Emission Tomography (PET) scans to track glucose metabolism in the brains of Tetris players. The human brain is a glucose hog: The rate of cerebral glucose metabolism tracks how much energy your brain is consuming (and hence how hard your brain is working).

To get a baseline, Haier measured novice Tetris players. They then played Tetris daily for a month, and Haier re-tested the group. Result: game scores increased by a factor of seven (indicating faster and longer play), but cerebral glucose metabolism decreased.

That experimental result correlates with a core principle of learning: Students prosper when the subject matter challenges them at the edge of their ability. Lessons too difficult raise frustration; lessons too easy provoke ennui and boredom. James Gee, a professor of learning sciences at the University of Wisconsin, observed:

The regime of competence principle is central to video games: As players progress, higher levels are unlocked after the player acquires specific skills and expertise. Only then does the puzzle become more complex, enemies swifter and more numerous, and underlying patterns more subtle. Along the way, something provocative happens to the mind.

Physiology Perspective on Tetris:

  • Tetris is a visual joy, satisfying the observation of environmentalist David Suzuki who said, The human eye has a hunger for color.
  • Tetris is rhythmic – music in motion – and speeds up your heartrate in time with the drop speed of the blocks.
  • Tetris can be an outlet for aggression (bash tetriminos down with the hard-drop key, bash the people who stress you).
  • From a biochemical perspective, Tetris increases dopamine in the brain.

Neuroscientist Jaak Panksepp of Northwestern University explains the significance of the last point: The dopamine system is the brain's seeking circuitry which propels humans to explore new avenues for reward. Dopamine is not the reward; it is what lets you go out and explore in the first place.

Major pitfall: You can never win Tetris. Unlike most video games, Tetris does not deliver a clearly articulated reward. Tetris increases dopamine in the brain, which spurs reward-seeking behavior, but never allows relief: you never seize the reward. As stated above, the basic mechanism of Tetris is unfinished action. A human can never finish Tetris, never complete the challenge, never get the reward – therefore you keep seeking.

Key point:  There is no way to feel rewarded by Tetris, so realize this and be satisfied with a few rounds during a coffee break, then immerse yourself in your work of the world.

Can a computer play Tetris forever? Mathematicians found Tetrimino sequences which will terminate a game, no matter how well-placed the blocks. To overcome this, the official Tetris Guideline was updated in 2001 with new features (3 piece-preview, and hold). But an insurmountable barrier remains: as the blocks accelerate; the only limit to their speed is infinity; eventually the computer cannot spin the blocks fast enough and tops out.

Below are further references to Tetris – its history, curious facts, and modern research. In the sidebar at right we address an emerging controversy between the brain effects of repetitive games, versus puzzle-type games.

FURTHER READING

Tetris Facts and History

Tetris Research: Sponsored by Blue Planet

  • MRI Assessment of Cortical Thickness and Functional Activity Changes Following Three Months Practice of a Visual-Spatial Task
    BMC Research Notes / Authors’ Disclosure Statement
    This project was funded at the MIND Research Network, Albuquerque, New Mexico, USA by Blue Planet Software (BPS), Inc., the company holding exclusive licensing rights to Tetris. Rex E. Jung was the PI, and Leonard Leyba received partial salary support. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript. Richard J. Haier is a paid consultant to Blue Planet Software.

Tetris Research: Independent

Georgena S. Sil
Saskatoon, Canada
Physicist & Technical Writer
Alumnus: University of British Columbia

Twitter Facebook Linked In Google+

LOCATE EMACS ON COMPUTER

Games and Scores

Locate the folder of Emacs games on your Macintosh Hard Drive by entering this path into the Go Menu:
/usr/share/emacs/22.1/lisp/play/

To access the Emacs score buffer, enter this path into the Go Menu:
~/.emacs.d/games

Working with Emacs is simple and safe but note: Terminal is a powerful application. Before exploring further, read a guide.

Emacs List of Games

Emacs on Macintosh HD
Nostalgic Arcade Games

OTHER EMACS GAMES

Adventure Game: Dunnet

Emacs has a text-based adventure game called Dunnet, invented by Ron Schnell. To play it in Terminal, get a normal prompt and type:  emacs -batch -l dunnet

Dunnet is a portmanteau of two words, Dungeons and Arpanet. The game itself spans two worlds, starting out ‘at the end of a dirt road’ and ending with the player walking around inside a Unix computer.

The game is quaint but not trivial. Running through it once or twice is engaging if you let your imagination replace graphics. Click the button below for starting hints.

Show Hints
  • Dunnet Instructions: Help
  • List items you possess: Inventory
  • Pick up an object: Get (object)
  • Find buried objects: Dig
  • Study an object: Look (object)
  • Study your environs: Examine
  • Walk down a road: Go (direction)
  • Run computer: Put CPU card in Vax
  • Designer Ron Schnell says The source code is on your machine; read it. Find it by entering this path in the Go Menu:
    /usr/share/emacs/22.1/lisp/play/

VIDEO GAME CONTROVERSY

Playing Too Much Tetris?

Video games based on rapid action – called response-based games – slightly increase brain volume, it is true, but new research from McGill University unveils nuances:

  • Response-based games increase the size of the caudate nucleus.
  • At the same time, response-based games decrease the size of the hippocampus.

The articles below should give you reason to pause, and change over to a game or other pursuit which requires spatial skills, instead of pure-response skills.

Action Games Shrink Hippocampus

Habitual video gaming increases the grey matter and activity in the caudate nucleus within the striatum (a brain structure).

Gamers use a response learning strategy when navigating an action game, which is consistent with increased striatal volume.

But response strategies are associated with shrinkage of the hippocampus. Decreased volume in the hippocampus precedes the onset of many neurological disorders.

McGill University Research

Plasticity of Grey Matter

A decade of research shows that action video game players display more efficient visual attention. We recently learned that gamers use navigation strategies that rely on the brain's reward system (the caudate nucleus), as opposed to the brain's spatial memory system (the hippocampus).

When people habitually invoke navigation strategies from their caudate nucleus, the hippocampus is less active and shrinks in volume. Reduced hippocampal integrity is associated with an increase in the risk of neurological disorders such as Alzheimer's.

Further research is needed to verify the findings, and to find ways to harness the plasticity of grey matter.

Video Gaming May Lead to Higher Risk of Neurological Disorders

Video Games of the Future

The hippocampus, a tiny but vital brain structure, helps maintain spatial and episodic memory. Reduced grey matter in the hippocampus is linked to higher risk of brain illness.

To counter potential neurological damage, video game designers could alter action games by removing in-system navigational tools. This would allow gamers to move around using landmarks inside the virtual world. This can strengthen spatial learning, which exercises the hippocampus.

Video Games Effects on the Brain

Strategies Today

Response-type games such as Tetris cause you to run on auto-pilot, which shrinks your hippocampus. To counter-balance this, you must navigate with a cognitive map, that is, invoke a map in your imagination. Until video games catch up, here are options:

  • Play other word or text-based games such as Scrabble or Logic Puzzles.
  • Emacs has a text-based adventure game called Dunnet (see above). This basic game will pall after a round or two. But it gets across the difference between speed-games and thought-games.
  • Reading books in the fiction genre draws upon the imagination, especially if you savor, and paint the picture in your mind — drive for depth, not speed.
Amblyopia Dichoptic Training / Tetris Grid

Binocular Treatment of Amblyopia
using the Video Game Tetris

TETRIS IN MEDICAL RESEARCH

Amblyopia Dichoptic Training

Amblyopic adults played Tetris on a special game board. The contrast of pieces seen by the good eye was reduced to match the subjective appearance of pieces seen by the amblyopic eye. In the variant above:

  • Both eyes see the landed pieces.
  • The falling piece is divided so that its whole shape can be seen only when both eyes combine the information together.
  • In the falling piece, one of its four blocks is visible to the amblyopic eye, one is visible to the good eye, and the remaining two are visible to both eyes.

Amblyopia: Eye Dominance

The vision disorder amblyopia, common in childhood, results when there is a mismatch between the images seen by the two eyes.

One cause is strabismus where a baby has one far-sighted eye and one near-sighted eye. The brain refuses the blur of double vision. Since a baby focuses close-up on the mother's face and toys, the brain learns to accept the near-sighted image.

The brain rejects the far-sighted image by moving that eye inwards until the light falls on the blind spot of the retina. This is the physiology of a crossed eye.

Amblyopia is also related to anisometropia (different refractive errors in the two eyes) and cataract.

The standby treatment of patching the good eye (to allow the amblyopic eye to develop) has been disappointing. Recent studies in neural plasticity hold more hope.

Copyright © 2008-2019 Georgena Sil. All Rights Reserved.