Author Topic: Tetris  (Read 4178 times)

0 Members and 1 Guest are viewing this topic.

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
Tetris
« on: September 24, 2018, 04:06:21 pm »
clean and simple tetris implementation. you can change variables size, sw, and sh for custom board sizes.

controls:
* arrow keys: movement, up: rotate
* shift + left/right/down: hard left/right/drop
* spacebar: hard drop
* +/-: change speed
* p: pause
* Enter: restart
* Esc: quit

Code: QB64: [Select]
  1. deflng a-z
  2.  
  3. dim shared piece(6, 3, 1)
  4. dim shared piece_color(6)
  5. dim shared size, sw, sh
  6.  
  7. size = 35
  8. sw = 10
  9. sh = 20
  10.  
  11. redim shared board(sw - 1, sh - 1)
  12.  
  13. piece(0,0,0)=0: piece(0,1,0)=1: piece(0,2,0)=1: piece(0,3,0)=0
  14. piece(0,0,1)=0: piece(0,1,1)=1: piece(0,2,1)=1: piece(0,3,1)=0
  15. piece(1,0,0)=1: piece(1,1,0)=1: piece(1,2,0)=1: piece(1,3,0)=1
  16. piece(1,0,1)=0: piece(1,1,1)=0: piece(1,2,1)=0: piece(1,3,1)=0
  17. piece(2,0,0)=0: piece(2,1,0)=0: piece(2,2,0)=1: piece(2,3,0)=1
  18. piece(2,0,1)=0: piece(2,1,1)=1: piece(2,2,1)=1: piece(2,3,1)=0
  19. piece(3,0,0)=0: piece(3,1,0)=1: piece(3,2,0)=1: piece(3,3,0)=0
  20. piece(3,0,1)=0: piece(3,1,1)=0: piece(3,2,1)=1: piece(3,3,1)=1
  21. piece(4,0,0)=0: piece(4,1,0)=1: piece(4,2,0)=1: piece(4,3,0)=1
  22. piece(4,0,1)=0: piece(4,1,1)=0: piece(4,2,1)=1: piece(4,3,1)=0
  23. piece(5,0,0)=0: piece(5,1,0)=1: piece(5,2,0)=1: piece(5,3,0)=1
  24. piece(5,0,1)=0: piece(5,1,1)=1: piece(5,2,1)=0: piece(5,3,1)=0
  25. piece(6,0,0)=0: piece(6,1,0)=1: piece(6,2,0)=1: piece(6,3,0)=1
  26. piece(6,0,1)=0: piece(6,1,1)=0: piece(6,2,1)=0: piece(6,3,1)=1
  27.  
  28. screen _newimage(sw*size, sh*size, 32)
  29.  
  30. piece_color(0) = _rgb(0,200,0)
  31. piece_color(1) = _rgb(200,0,0)
  32. piece_color(2) = _rgb(156,85,211)
  33. piece_color(3) = _rgb(219,112,147)
  34. piece_color(4) = _rgb(0,100,250)
  35. piece_color(5) = _rgb(230,197,92)
  36. piece_color(6) = _rgb(0,128,128)
  37.  
  38.  
  39. redraw = -1
  40.  
  41. speed = 10
  42. lines = 0
  43. pause = 0
  44. putpiece = 0
  45. startx = (sw - 4)/2
  46.  
  47. pn = int(rnd*7)
  48. px = startx
  49. py = 1
  50. rot = 0
  51.  
  52. title$ = "lines="+ltrim$(str$(lines))+",speed="++ltrim$(str$(speed))
  53. _title title$
  54.  
  55. t = timer
  56.  
  57.         if (timer - t) > (1/speed) and not pause then
  58.                 if valid(pn, px, py + 1, rot) then py = py + 1 else putpiece = -1
  59.  
  60.                 t = timer
  61.                 redraw = -1
  62.         end if
  63.  
  64.         if putpiece then
  65.                 if valid(pn, px, py, rot) then
  66.                         n = place(pn, px, py, rot)
  67.                         if n then
  68.                                 lines = lines + n
  69.                                 title$ = "lines="+ltrim$(str$(lines))+",speed="++ltrim$(str$(speed))
  70.                                 _title title$
  71.                         end if
  72.                 end if
  73.  
  74.                 pn = int(rnd*7)
  75.                 px = startx
  76.                 py = 0
  77.                 rot = 0
  78.  
  79.                 putpiece = 0
  80.                 redraw = -1
  81.  
  82.                 if not valid(pn, px, py, rot) then
  83.                         for y=0 to sh-1
  84.                                 for x=0 to sw-1
  85.                                         board(x, y) = 0
  86.                                 next
  87.                         next
  88.                         lines = 0
  89.                         title$ = "lines="+ltrim$(str$(lines))+",speed="++ltrim$(str$(speed))
  90.                         _title title$
  91.                 end if
  92.         end if
  93.  
  94.         if redraw then
  95.                 line (0,0)-(sw*size, sh*size),_rgb(0,0,0),bf
  96.                 for y=0 to sh - 1
  97.                         for x=0 to sw - 1
  98.                                 if board(x, y) <> 0 then
  99.                                         line (x*size, y*size)-step(size-2, size-2), piece_color(board(x, y)-1), bf
  100.                                 else
  101.                                         line (x*size, y*size)-step(size-2, size-2), _rgb(50,50,50), b
  102.                                 end if
  103.                         next
  104.                 next
  105.  
  106.                 for y=0 to 1
  107.                         for x=0 to 3
  108.                                 rotate xx, yy, x, y, pn, rot
  109.                                 if piece(pn, x, y) then line ((px + xx)*size, (py + yy)*size)-step(size-2, size-2), piece_color(pn), bf
  110.                         next
  111.                 next
  112.  
  113.                 _display
  114.                 redraw = 0
  115.         end if
  116.  
  117.         k = _keyhit
  118.         if k then
  119.                 shift = _keydown(100304) or _keydown(100303)
  120.                 select case k
  121.                 case 18432 'up
  122.                         if valid(pn, px, py, (rot + 1) mod 4) then rot = (rot + 1) mod 4
  123.                         pause = 0
  124.                 case 19200 'left
  125.                         if shift then
  126.                                 for xx=0 to sw-1
  127.                                         if not valid(pn, px - xx, py, rot) then exit for
  128.                                 next
  129.                                 px = px - xx + 1
  130.                         else
  131.                                 if valid(pn, px - 1, py, rot) then px = px - 1
  132.                         end if
  133.                         pause = 0
  134.                 case 19712 'right
  135.                         if shift then
  136.                                 for xx=px to sw-1
  137.                                         if not valid(pn, xx, py, rot) then exit for
  138.                                 next
  139.                                 px = xx - 1
  140.                         else
  141.                                 if valid(pn, px + 1, py, rot) then px = px + 1
  142.                         end if
  143.                         pause = 0
  144.                 case 20480, 32 'down
  145.                         if shift or k = 32 then
  146.                                 for yy=py to sh-1
  147.                                         if not valid(pn, px, yy, rot) then exit for
  148.                                 next
  149.                                 py = yy - 1
  150.                                 putpiece = -1
  151.                         else
  152.                                 if valid(pn, px, py + 1, rot) then py = py + 1
  153.                         end if
  154.                         pause = 0
  155.                 case 112 'p
  156.                         pause = not pause
  157.                 case 13 'enter
  158.                         for y=0 to sh-1
  159.                                 for x=0 to sw-1
  160.                                         board(x, y) = 0
  161.                                 next
  162.                         next
  163.                         pn = int(rnd*7)
  164.                         px = startx
  165.                         py = 0
  166.                         rot = 0
  167.                         putpiece = 0
  168.                         lines = 0
  169.                         title$ = "lines="+ltrim$(str$(lines))+",speed="++ltrim$(str$(speed))
  170.                         _title title$
  171.                 case 43, 61 'plus
  172.                         if speed < 100 then
  173.                                 speed = speed + 1
  174.                                 title$ = "lines="+ltrim$(str$(lines))+",speed="++ltrim$(str$(speed))
  175.                                 _title title$
  176.                         end if
  177.                 case 95, 45
  178.                         if speed > 1 then
  179.                                 speed = speed - 1
  180.                                 title$ = "lines="+ltrim$(str$(lines))+",speed="++ltrim$(str$(speed))
  181.                                 _title title$
  182.                         end if
  183.                 case 27
  184.                         exit do
  185.                 end select
  186.  
  187.                 redraw = -1
  188.         end if
  189.  
  190. sub rotate(xx, yy, x, y, pn, rot)
  191.         select case pn
  192.         case 0
  193.                 rot_new = 0
  194.         case 1 to 3
  195.                 rot_new = rot mod 2
  196.         case 4 to 6
  197.                 rot_new = rot
  198.         end select
  199.  
  200.         select case rot_new
  201.         case 0
  202.                 xx = x
  203.                 yy = y
  204.         case 1
  205.                 xx = y + 2
  206.                 yy = 2 - x
  207.         case 2
  208.                 xx = 4 - x
  209.                 yy = 1 - y
  210.         case 3
  211.                 xx = 2 - y
  212.                 yy = x - 1
  213.         end select
  214.  
  215. function valid(pn, px, py, rot)
  216.         for y=0 to 1
  217.                 for x=0 to 3
  218.                         rotate xx, yy, x, y, pn, rot
  219.                         if py + yy >= 0 then
  220.                                 if piece(pn, x, y) then
  221.                                         if (px + xx >= sw) or (px + xx < 0) then
  222.                                                 valid = 0
  223.                                                 exit function
  224.                                         end if
  225.                                         if (py + yy >= sh) then
  226.                                                 valid = 0
  227.                                                 exit function
  228.                                         end if
  229.                                         if (py >= 0) then
  230.                                         if board(px + xx, py + yy) then
  231.                                                 valid = 0
  232.                                                 exit function
  233.                                         end if
  234.                                         end if
  235.                                 end if
  236.                         end if
  237.                 next
  238.         next
  239.  
  240.         valid = -1
  241.  
  242. function place(pn, px, py, rot)
  243.         lines = 0
  244.  
  245.         for y=0 to 1
  246.                 for x=0 to 3
  247.                         rotate xx, yy, x, y, pn, rot
  248.                         if py + yy >= 0 then if piece(pn, x, y) then board(px + xx, py + yy) = pn + 1
  249.                 next
  250.         next
  251.  
  252.         'clear lines
  253.         for y=py-1 to py+2
  254.                 if y>=0 and y<sh then
  255.                         clr = -1
  256.                         for x=0 to sw - 1
  257.                                 if board(x, y) = 0 then
  258.                                         clr = 0
  259.                                         exit for
  260.                                 end if
  261.                         next
  262.  
  263.                         if clr then
  264.                                 lines = lines + 1
  265.                                 for yy=y to 1 step -1
  266.                                         for x=0 to sw-1
  267.                                                 board(x, yy) = board(x, yy-1)
  268.                                         next
  269.                                 next
  270.                         end if
  271.                 end if
  272.         next
  273.  
  274.         place = lines
  275.  
sc1.png
* sc1.png (Filesize: 3.58 KB, Dimensions: 300x600, Views: 465)
sc2.png
* sc2.png (Filesize: 4.78 KB, Dimensions: 450x450, Views: 479)
« Last Edit: September 24, 2018, 04:10:59 pm by v »

Offline TrialAndTerror

  • Newbie
  • Posts: 11
  • Kick The Can
    • T&T Ware
Re: Tetris
« Reply #1 on: September 24, 2018, 07:12:36 pm »
Beautiful. The preset speed is a little to high for me though.
T&T
« Last Edit: September 24, 2018, 07:18:02 pm by TrialAndTerror »

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
Re: Tetris
« Reply #2 on: September 24, 2018, 08:19:34 pm »
Excellent, thank you :)
In order to understand recursion, one must first understand recursion.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Tetris
« Reply #3 on: September 24, 2018, 11:54:36 pm »
Nice! (Once B+ found the minus button) I like how you can slide blocks horizontally before they come to final resting place.

There is something clean looking about code. The indents?
« Last Edit: September 25, 2018, 12:14:24 am by bplus »

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
Re: Tetris
« Reply #4 on: September 25, 2018, 12:55:24 am »
yes this line needs adjustment:
Code: QB64: [Select]
  1. if (timer - t) > (1/speed) and not pause then

I want speed to be 1 to 100, 1 being really slow and 100 really fast.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
Re: Tetris
« Reply #5 on: September 25, 2018, 12:53:48 pm »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
Re: Tetris
« Reply #6 on: September 25, 2018, 04:40:42 pm »
V,

Nice game. My first instinct was to 'down arrow' to reduce speed... quickly re-thought 'minus'... Other than that, nicely done... When do you think it will be finished? (no pressure!... lol)

J
Logic is the beginning of wisdom.

FellippeHeitor

  • Guest
Re: Tetris
« Reply #7 on: September 25, 2018, 04:59:31 pm »
So much in so few lines of code! Great job, v.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
Re: Tetris
« Reply #8 on: September 25, 2018, 10:05:18 pm »
This is just perfect, I see nothing left to subtract.
You're not done when it works, you're done when it's right.

Offline janaknepal

  • Newbie
  • Posts: 1
Re: Tetris
« Reply #9 on: January 21, 2019, 10:34:11 am »
'Thanks for the game I love the most. I have some how modified it. Here's the code.

RANDOMIZE TIMER
DEFLNG A-Z

DIM SHARED piece(6, 3, 1)
DIM SHARED piece_color(6)
DIM SHARED size, sw, sh

size = 30
sw = 10
sh = 18

REDIM SHARED board(sw - 1, sh - 1)

piece(0, 0, 0) = 0: piece(0, 1, 0) = 1: piece(0, 2, 0) = 1: piece(0, 3, 0) = 0
piece(0, 0, 1) = 0: piece(0, 1, 1) = 1: piece(0, 2, 1) = 1: piece(0, 3, 1) = 0

piece(1, 0, 0) = 1: piece(1, 1, 0) = 1: piece(1, 2, 0) = 1: piece(1, 3, 0) = 1
piece(1, 0, 1) = 0: piece(1, 1, 1) = 0: piece(1, 2, 1) = 0: piece(1, 3, 1) = 0

piece(2, 0, 0) = 0: piece(2, 1, 0) = 0: piece(2, 2, 0) = 1: piece(2, 3, 0) = 1
piece(2, 0, 1) = 0: piece(2, 1, 1) = 1: piece(2, 2, 1) = 1: piece(2, 3, 1) = 0

piece(3, 0, 0) = 0: piece(3, 1, 0) = 1: piece(3, 2, 0) = 1: piece(3, 3, 0) = 0
piece(3, 0, 1) = 0: piece(3, 1, 1) = 0: piece(3, 2, 1) = 1: piece(3, 3, 1) = 1

piece(4, 0, 0) = 0: piece(4, 1, 0) = 1: piece(4, 2, 0) = 1: piece(4, 3, 0) = 1
piece(4, 0, 1) = 0: piece(4, 1, 1) = 0: piece(4, 2, 1) = 1: piece(4, 3, 1) = 0

piece(5, 0, 0) = 0: piece(5, 1, 0) = 1: piece(5, 2, 0) = 1: piece(5, 3, 0) = 1
piece(5, 0, 1) = 0: piece(5, 1, 1) = 1: piece(5, 2, 1) = 0: piece(5, 3, 1) = 0

piece(6, 0, 0) = 0: piece(6, 1, 0) = 1: piece(6, 2, 0) = 1: piece(6, 3, 0) = 1
piece(6, 0, 1) = 0: piece(6, 1, 1) = 0: piece(6, 2, 1) = 0: piece(6, 3, 1) = 1

SCREEN _NEWIMAGE((sw + 6) * size, sh * size, 32)

piece_color(0) = _RGB(0, 200, 0)
piece_color(1) = _RGB(200, 0, 0)
piece_color(2) = _RGB(156, 85, 211)
piece_color(3) = _RGB(219, 112, 147)
piece_color(4) = _RGB(0, 100, 250)
piece_color(5) = _RGB(230, 197, 92)
piece_color(6) = _RGB(0, 128, 128)

DIM t AS DOUBLE

redraw = -1

speed = 3
lines = 0
pause = 0
putpiece = 0
startx = (sw - 4) / 2

new_px = (sw + 1) * size
new_py = 2 * size


new_pn = INT(RND * 7)
px = startx
py = 1
rot = 0


title$ = "LINES = " + LTRIM$(STR$(lines)) + ", SPEED = " + LTRIM$(STR$(speed))
_TITLE title$

t = TIMER

DO
     place_new new_pn, new_px, new_py, 0, size
     IF (TIMER - t) > (1 / speed) AND NOT pause THEN
          IF valid(pn, px, py + 1, rot) THEN py = py + 1 ELSE putpiece = -1

          t = TIMER
          redraw = -1
     END IF

     IF putpiece THEN
          IF valid(pn, px, py, rot) THEN
               n = place(pn, px, py, rot)
               IF n THEN
                    lines = lines + n
                    title$ = "LINES = " + LTRIM$(STR$(lines)) + ", SPEED = " + LTRIM$(STR$(speed))
                    _TITLE title$
               END IF
          END IF

          pn = new_pn

          new_pn = INT(RND * 7)

          place_new new_pn, new_px, new_py, 0, size


          px = startx
          py = 0
          rot = 0

          putpiece = 0
          redraw = -1

          IF NOT valid(pn, px, py, rot) THEN
               FOR y = 0 TO sh - 1
                    FOR x = 0 TO sw - 1
                         board(x, y) = 0
                    NEXT
               NEXT
               lines = 0
               title$ = "LINES = " + LTRIM$(STR$(lines)) + ", SPEED = " + LTRIM$(STR$(speed))
               _TITLE title$
          END IF
     END IF

     IF redraw THEN
          LINE (0, 0)-(sw * size, sh * size), _RGB(0, 0, 0), BF
          FOR y = 0 TO sh - 1
               FOR x = 0 TO sw - 1
                    IF board(x, y) <> 0 THEN
                         LINE (x * size, y * size)-STEP(size - 2, size - 2), piece_color(board(x, y) - 1), BF
                    ELSE
                         LINE (x * size, y * size)-STEP(size - 2, size - 2), _RGB(50, 50, 50), B
                    END IF
               NEXT
          NEXT

          FOR y = 0 TO 1
               FOR x = 0 TO 3
                    rotate xx, yy, x, y, pn, rot
                    IF piece(pn, x, y) THEN LINE ((px + xx) * size, (py + yy) * size)-STEP(size - 2, size - 2), piece_color(pn), BF
               NEXT
          NEXT
          _DISPLAY
          redraw = 0
     END IF

     k = _KEYHIT
     IF k THEN
          shift = _KEYDOWN(100304) OR _KEYDOWN(100303)
          SELECT CASE k
               CASE 18432 'up
                    IF valid(pn, px, py, (rot + 1) MOD 4) THEN rot = (rot + 1) MOD 4
                    pause = 0
               CASE 19200 'left
                    IF shift THEN
                         FOR xx = 0 TO sw - 1
                              IF NOT valid(pn, px - xx, py, rot) THEN EXIT FOR
                         NEXT
                         px = px - xx + 1
                    ELSE
                         IF valid(pn, px - 1, py, rot) THEN px = px - 1
                    END IF
                    pause = 0
               CASE 19712 'right
                    IF shift THEN
                         FOR xx = px TO sw - 1
                              IF NOT valid(pn, xx, py, rot) THEN EXIT FOR
                         NEXT
                         px = xx - 1
                    ELSE
                         IF valid(pn, px + 1, py, rot) THEN px = px + 1
                    END IF
                    pause = 0
               CASE 20480, 32 'down
                    IF shift OR k = 32 THEN
                         FOR yy = py TO sh - 1
                              IF NOT valid(pn, px, yy, rot) THEN EXIT FOR
                         NEXT
                         py = yy - 1
                         putpiece = -1
                    ELSE
                         IF valid(pn, px, py + 1, rot) THEN py = py + 1
                    END IF
                    pause = 0
               CASE 112 'p
                    pause = NOT pause
               CASE 13 'enter
                    FOR y = 0 TO sh - 1
                         FOR x = 0 TO sw - 1
                              board(x, y) = 0
                         NEXT
                    NEXT
                    pn = INT(RND * 7)
                    px = startx
                    py = 0
                    rot = 0
                    putpiece = 0
                    lines = 0
                    title$ = "LINES = " + LTRIM$(STR$(lines)) + ", SPEED = " + LTRIM$(STR$(speed))
                    _TITLE title$
               CASE 43, 61 'plus
                    IF speed < 100 THEN
                         speed = speed + 1
                         title$ = "LINES = " + LTRIM$(STR$(lines)) + ", SPEED = " + LTRIM$(STR$(speed))
                         _TITLE title$
                    END IF
               CASE 95, 45
                    IF speed > 1 THEN
                         speed = speed - 1
                         title$ = "LINES = " + LTRIM$(STR$(lines)) + ", SPEED = " + LTRIM$(STR$(speed))
                         _TITLE title$
                    END IF
               CASE 27
                    EXIT DO
          END SELECT

          redraw = -1
     END IF
LOOP
SYSTEM

SUB rotate (xx, yy, x, y, pn, rot)
     SELECT CASE pn
          CASE 0
               rot_new = rot
          CASE 1 TO 3
               rot_new = rot MOD 2
          CASE 4 TO 6
               rot_new = rot
     END SELECT

     SELECT CASE rot_new
          CASE 0
               xx = x
               yy = y
          CASE 1
               xx = y + 2
               yy = 2 - x
          CASE 2
               xx = 4 - x
               yy = 1 - y
          CASE 3
               xx = 2 - y
               yy = x - 1
     END SELECT
END SUB

FUNCTION valid (pn, px, py, rot)
     FOR y = 0 TO 1
          FOR x = 0 TO 3
               rotate xx, yy, x, y, pn, rot
               IF py + yy >= 0 THEN
                    IF piece(pn, x, y) THEN
                         IF (px + xx >= sw) OR (px + xx < 0) THEN
                              valid = 0
                              EXIT FUNCTION
                         END IF
                         IF (py + yy >= sh) THEN
                              valid = 0
                              EXIT FUNCTION
                         END IF
                         IF (py >= 0) THEN
                              IF board(px + xx, py + yy) THEN
                                   valid = 0
                                   EXIT FUNCTION
                              END IF
                         END IF
                    END IF
               END IF
          NEXT
     NEXT

     valid = -1
END FUNCTION

FUNCTION place (pn, px, py, rot)
     lines = 0

     FOR y = 0 TO 1
          FOR x = 0 TO 3
               rotate xx, yy, x, y, pn, rot
               IF py + yy >= 0 THEN IF piece(pn, x, y) THEN board(px + xx, py + yy) = pn + 1
          NEXT
     NEXT

     'clear lines
     FOR y = py - 1 TO py + 2
          IF y >= 0 AND y < sh THEN
               clr = -1
               FOR x = 0 TO sw - 1
                    IF board(x, y) = 0 THEN
                         clr = 0
                         EXIT FOR
                    END IF
               NEXT

               IF clr THEN
                    lines = lines + 1
                    FOR yy = y TO 1 STEP -1
                         FOR x = 0 TO sw - 1
                              board(x, yy) = board(x, yy - 1)
                         NEXT
                    NEXT
               END IF
          END IF
     NEXT

     place = lines
END FUNCTION

SUB place_new (new_pn, new_px, new_py, rot, size)

     FOR x = 0 TO 3 'new_px TO (new_px + 4) * size STEP size
          FOR y = 0 TO 1 'new_py TO (new_py + 2) * size STEP size
               LINE (new_px + size * x, new_py + size * y)-(new_px + (size * x) + size - 2, new_py + (size * y) + size - 2), _RGB(0, 0, 0), BF
          NEXT
     NEXT

     FOR x = 0 TO 3 'new_px TO (new_px + 4) * size STEP size
          FOR y = 0 TO 1 'new_py TO (new_py + 2) * size STEP size
               LINE (new_px + size * x, new_py + size * y)-(new_px + (size * x) + size - 2, new_py + (size * y) + size - 2), _RGB(25, 25, 25), B
          NEXT
     NEXT

     FOR x = 0 TO 3 'new_px TO (new_px + 4) * size STEP size
          FOR y = 0 TO 1 'new_py TO (new_py + 2) * size STEP size
               IF piece(new_pn, x, y) THEN
                    LINE (new_px + size * x, new_py + size * y)-(new_px + (size * x) + size - 2, new_py + (size * y) + size - 2), piece_color(new_pn), BF
               END IF
          NEXT
     NEXT
     _DISPLAY

END SUB

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
Re: Tetris
« Reply #10 on: January 21, 2019, 08:48:51 pm »
cheers https://en.wikipedia.org/wiki/Nepali_tea

nice, you added a view of the next piece to come! I am impressed that you were able to modify the code to your liking
« Last Edit: January 31, 2019, 11:25:40 pm by _vince »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Tetris
« Reply #11 on: January 21, 2019, 10:32:55 pm »
What, no Kopi Luwak?

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • Danilin youtube
Re: Tetris
« Reply #12 on: June 06, 2019, 12:23:25 pm »
Today is day of invention in USSR in Russia of game Tetris 6.6.1984

Segodnya den' izobreteniya v SSSR v Rossii igry tetris 6.6.1984



« Last Edit: June 06, 2019, 12:24:54 pm by DANILIN »
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Tetris
« Reply #13 on: June 06, 2019, 12:27:58 pm »
Today is day of invention in USSR in Russia of game Tetris 6.6.1984

Segodnya den' izobreteniya v SSSR v Rossii igry tetris 6.6.1984





Now there's Kopi Luwak!