Code Monkey home page Code Monkey logo

tetran's Introduction

https://travis-ci.org/scivision/tetran.svg?branch=master
current author/maintainer:Michael Hirsch Ph.D.
original author:Lewis Bobbermen

Text/console falling-block tetromino game written in Modern Fortran. It has diverged and been enhanced considerably from L. Bobberman's original demo.

Tetran gameplay demo

  • user-configurable playfield size
  • Logs pieces played to tetran.log so you can recreate memorable games.
  • uniform random game piece generation.
  • clean, modern Fortran 2008 syntax
  • Ncurses used for display, called directly from Fortran code (this is a blocker for native Windows).

Tetran works on Mac, Linux, Cygwin and Windows Subsystem for Linux. Any modern Fortran compiler (including Flang with CMake >= 3.10) should work.

  • Linux / WSL: apt install gfortran libncurses-dev
  • Mac: brew install gcc ncurses
  • Cygwin: setup-x86_64.exe -P libncurses-devel cmake make gcc-gfortran
cd bin
cmake ..
make
make test

Optional: specify a compiler by setting FC=.

  • Intel: FC=ifort cmake ..
  • Flang: FC=flang cmake ..
  • PGI: FC=pgf95 cmake ..
./tetran

adjust cadence of falling blocks with -d option, including decimal point:

./tetran -d 1.2

Higher number => more difficult. Must include decimal point.

Debug logging is enabled by:

./tetran --debug

Other "secret" cheat keys exist! You can also use arrow keys.

Key Effect
W Rotate piece
A/D Left and right respectively
S Move down faster
Q or Esc Exit the game

unlike some games, block distribution is uniformly random as confirmed by:

./blockrand

using time ./blockrand 100000000 relative normalized execution times were:

-O3:

GNU   1.00 (fastest normalized)
Flang 1.90
PGI:  1.82
ifort 8.22

Tested with:

  • Intel Haswell laptop CPU
  • Flang 5.0
  • Gfortran 7.3
  • Intel Fortran 2019
  • PGI 2018

So Intel Fortran takes over 5 times longer than Gfortran at this simple single-thread benchmark.

Control codes

tetran's People

Contributors

scivision avatar lewisjb avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.