tinytetris - 80x23 terminal tetris

Related tags

CLI tinytetris
Overview

tinytetris

80x23 terminal tetris!

tinytetris gif

tinytetris.cpp

This is the 80x23 version. You control it with a (left), d (right), w (rotate), s (drop), and q (quit). It depends on curses.h (so you'll need to compile with -lcurses, and install curses if you don't already have it) and requires C++11.

tinytetris-commented.cpp

This one is almost identical to tinytetris.cpp, but not minified, and with some comments to make it easier to read (but it's still tricky to read in certain parts).

Issues
  • make error

    make error

    [email protected]:~/hellogithub/tinytetris$ make g++ tinytetris.cpp -lcurses -o tinytetris tinytetris.cpp: In function ‘I F()’: tinytetris.cpp:10:73: error: ISO C++ forbids declaration of ‘z’ with no type [-fpermissive] +y][N(r,(i*2)+2)+x]=v;}I F(){for(I c=0;c<20;c++){move(1+c,1);for(auto &z:a[c]){ ^ tinytetris.cpp:10:75: warning: range-based ‘for’ loops only available with -std=c++11 or -std=gnu++11 +y][N(r,(i*2)+2)+x]=v;}I F(){for(I c=0;c<20;c++){move(1+c,1);for(auto &z:a[c]){ ^ tinytetris.cpp: In function ‘I R()’: tinytetris.cpp:14:12: error: ISO C++ forbids declaration of ‘z’ with no type [-fpermissive] ;for(auto &z:a[q])c*=z;if(!c)continue;for(I c=q-1;c>0;c--)memcpy(&a[c+1][0],&a[ ^ tinytetris.cpp:14:14: warning: range-based ‘for’ loops only available with -std=c++11 or -std=gnu++11 ;for(auto &z:a[q])c*=z;if(!c)continue;for(I c=q-1;c>0;c--)memcpy(&a[c+1][0],&a[ ^ : recipe for target 'tinytetris' failed make: *** [tinytetris] Error 1

    opened by wenchengy 1
  • Correct block layout comment

    Correct block layout comment

    It's a really minor thing, and I'm not even 100% sure it's correct.. but as I tried to reverse-engineer your code, this small detail really tripped me up. Does it make sense?

    opened by cjauvin 1
  • Add CMakeLists.txt

    Add CMakeLists.txt

    It's good if there's a CMakeLists.txt。I write one that works for me. In this case, you need to create build and src folder, and put the code that needs compilation in src:

    cmake_minimum_required (VERSION 3.0)
    
    
    project(terris_demo)
    
    
    find_package(Curses REQUIRED)
    include_directories(${CURSES_INCLUDE_DIR})
    
    aux_source_directory(src terris_src)
    
    add_executable(${PROJECT_NAME} ${terris_src})
    target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES})
    
    opened by KimRasak 0
  • I cannot make it.

    I cannot make it.

    linux:~/code/other/tinytetris$ make
    g++   -lcurses  tinytetris.cpp   -o tinytetris
    /tmp/ccNKijAL.o: In function `F()':
    tinytetris.cpp:(.text+0xf7): undefined reference to `move'
    tinytetris.cpp:(.text+0x161): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x171): undefined reference to `wattr_on'
    tinytetris.cpp:(.text+0x184): undefined reference to `printw'
    tinytetris.cpp:(.text+0x19c): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x1ac): undefined reference to `wattr_off'
    tinytetris.cpp:(.text+0x1ce): undefined reference to `move'
    tinytetris.cpp:(.text+0x1e7): undefined reference to `printw'
    tinytetris.cpp:(.text+0x1ec): undefined reference to `refresh'
    /tmp/ccNKijAL.o: In function `L()':
    tinytetris.cpp:(.text+0x634): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x63c): undefined reference to `wgetch'
    /tmp/ccNKijAL.o: In function `main':
    tinytetris.cpp:(.text+0x83f): undefined reference to `initscr'
    tinytetris.cpp:(.text+0x844): undefined reference to `start_color'
    tinytetris.cpp:(.text+0x877): undefined reference to `init_pair'
    tinytetris.cpp:(.text+0x89c): undefined reference to `resizeterm'
    tinytetris.cpp:(.text+0x8a1): undefined reference to `noecho'
    tinytetris.cpp:(.text+0x8a8): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x8b5): undefined reference to `wtimeout'
    tinytetris.cpp:(.text+0x8bf): undefined reference to `curs_set'
    tinytetris.cpp:(.text+0x8c6): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x8d8): undefined reference to `box'
    tinytetris.cpp:(.text+0x8e2): undefined reference to `endwin'
    collect2: error: ld returned 1 exit status
    <builtin>: recipe for target 'tinytetris' failed
    make: *** [tinytetris] Error 1
    
    
    opened by tong-hao 7
Owner
Conor Taylor
Conor Taylor
Spitfire is a basic terminal language that can exicute code via the terminal.

Spitfire is a basic terminal language that can exicute code via the terminal. It is easy to learn and runs fast, considering that its just a 300 line c++ file.

jhomas tefferson 0 Nov 18, 2021
Small header only C++ library for writing multiplatform terminal applications

Terminal Terminal is small header only library for writing terminal applications. It works on Linux, macOS and Windows (in the native cmd.exe console)

Jupyter Xeus 198 May 14, 2022
:computer: C++ Functional Terminal User Interface. :heart:

FTXUI Functional Terminal (X) User interface A simple C++ library for terminal based user interface. Demo: Feature Functional style. Inspired by [1] a

Arthur Sonzogni 3k May 12, 2022
A little UNIX-inspired terminal application for the Numworks Calculator (not using escher).

L.E. Terminal (let for short) is a little UNIX-inspired terminal for the Numworks Calculator.

Cacahuète Sans Sel 18 Apr 27, 2022
Draw sequence diagram in text from terminal.

sequence-diagram-cli Draw seqence diagram from terminal.

null 42 Feb 28, 2022
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits

Programmer calculator The programmer calculator is a simple terminal tool designed to give maximum efficiency and flexibility to the programmer workin

romes 164 May 8, 2022
X terminal emulator rendering through OpenGL ES Compute Shaders

Zutty is a terminal emulator for the X Window System, functionally similar to several other X terminal emulators such as xterm, rxvt and countless others

Tom Szilagyi 207 May 12, 2022
The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Microsoft 83.1k May 16, 2022
n³ The unorthodox terminal file manager

n³ The unorthodox terminal file manager

Mischievous Meerkat 14.1k May 17, 2022
Graphs the activity of a chia harvester in a linux terminal.

Chia Harvest Graph Monitor for Chia Harvesting Introduction The chiaharvestgraph tool will graph Chia Harvesting activity in a linux terminal. Use a 2

Bram Stolk 219 May 2, 2022
a simple to use linux terminal

a simple to use linux terminal

notaweeb 7 Feb 17, 2022
Collection of human friendly terminal interface for git.

A collection of human friendly terminal user interface for git.

Arthur Sonzogni 60 May 5, 2022
Simple benchmark for terminal output

TermBench This is a simple timing utility you can use to see how slow your terminal program is at parsing escape-sequence-coded color output. It can b

Casey Muratori 169 May 9, 2022
Contour - A modern C++ Terminal Emulator

contour is a modern terminal emulator, for everyday use. It is aiming for power users with a modern feature mindset.

Contour Terminal Emulator 805 May 10, 2022
A C, C++ and Rust library to draw graphics with pixels in the terminal

A library to draw graphics with pixels in the terminal Who needs a GUI when you have a terminal ? Building To generate libpluto.a, run: $ make To ins

null 67 Apr 9, 2022
📺🗿 Terminal graphics for the 21st century.

???? Chafa is a command-line utility that converts all kinds of images, including animated GIFs, into sixel or ANSI/Unicode character output that can be displayed in a terminal.

Hans Petter Jansson 1.3k May 16, 2022
Simple Unix Terminal Football Manager-like game.

Superleage 2020/2021 It is a "work in progress" simple game based on some mechanics of Football Manager. The game is in a very early stage of Developm

sewe2000 2 Oct 14, 2021
timg - Terminal Image and Video Viewer

timg - Terminal Image and Video Viewer

Henner Zeller 1.2k May 15, 2022
Tiny Mobile Terminal Device Kit.

Tiny Mobile Terminal Device Kit.

稚晖 1.2k May 16, 2022