blocked.c

来自「嵌入式系统基础课件」· C语言 代码 · 共 32 行

C
32
字号
#include "libepc.h"
#include "tetris.h"

/* ------------------------------------------------------------ */
/* Returns TRUE if painting the Tetris object at the specified	*/
/* coordinates would overwrite another object already there.	*/
/* Also returns TRUE if the object has reached the bottom.	*/
/* ------------------------------------------------------------ */
BOOL Blocked(int row, int col, int rot)
	{
	int r ;

	if (row >= 23) return TRUE ;

	for (r = 0; r < 2; r++)
		{
		int c ;

		for (c = 0; c < 4; c++)
			{
			if (!On(rot, r, c)) continue ;
			if (*Cell(row + r, col + c) != EMPTY)
				{
				return TRUE ;
				}
			}
		}

	return FALSE ;
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?