Free Tetris mini contest
unknown Wrote:Starts now, ends in 5 days from this post so thats aboutCould have been fun to try, pity I saw it three days after the start. I should visit here more often.
22:20 on 30th Aug GMT.
good luck everyone!
About the copyright issue, I agree that "Tetris clone" is unnecessarily provocative. Making straight clones is not interesting, making interesting games inspired by another is fine, and there are many ways to make games where things are falling down.
diordna Wrote:I'm in, with Dan Lurie I think.
You think therefore I am. IM me.
"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
I entered, but I dont know where to host it.
Sir, e^iπ + 1 = 0, hence God exists; reply!
unknown, if you want hosting again, and your game (compressed) is less than ~two megs, email me 
I'll be uploading my own entry later as soon as I'm back on my own machine

I'll be uploading my own entry later as soon as I'm back on my own machine
Mark Bishop
MrFreak already emailed me with space, but thank you!
Cheers to MrFreak as well for putting this up.
here's my one http://www.sloppydisk.com/hosted/Tetris06.zip
and a cool ncurses one my friend wrote:
Cheers to MrFreak as well for putting this up.
here's my one http://www.sloppydisk.com/hosted/Tetris06.zip
and a cool ncurses one my friend wrote:
Code:
#include <ncurses.h>
#include <sys/time.h>
#include <math.h>
#define SQUARE 0
#define SSHAPE 1
#define SSHAPER 2
#define ZSHAPE 3
#define ZSHAPER 4
#define LSHAPEN 5
#define LSHAPEE 6
#define LSHAPES 7
#define LSHAPEW 8
#define JSHAPEN 9
#define JSHAPEE 10
#define JSHAPES 11
#define JSHAPEW 12
#define TSHAPEN 13
#define TSHAPEE 14
#define TSHAPES 15
#define TSHAPEW 16
#define LINE 17
#define LINER 18
typedef struct {
char shape[4][4];
int leftPiece;
int rightPiece;
int this; // interopate with C++ THIS
} piece;
piece pieces[19];
char field[15][10];
WINDOW *playbox;
WINDOW *nextbox;
int score;
void initPieces();
void printField();
void initField(char c);
void printPiece(int x, int y, piece thepiece);
int movePiece(int x, int y, piece thepiece);
int slidePiece(int x, int y, piece thepiece);
int rotatePieceLeft(int *x, int y, piece thepiece);
int rotatePieceRight(int *x, int y, piece thepiece);
void addPieceToField(int x, int y, piece thepiece);
void printNext(piece thepiece);
int clearLines(int y);
void eraseLine(int y);
static long mtime(void);
int main()
{
WINDOW *border;
int pieceX, pieceY;
int c;
int currentPiece, nextPiece;
int needUpdate;
long int timePassed;
initscr(); /* Start curses mode */
keypad(stdscr, TRUE);
nodelay(stdscr, TRUE);
noecho();
refresh();
playbox = newwin(17, 12, 2, 3); // set up boxes
border = newwin(20, 40, 1, 1);
nextbox = newwin( 6, 6, 2, 15);
box(playbox, 0, 0);
box(border, 0, 0);
box(nextbox, 0, 0);
wmove(nextbox, 0, 1);
wprintw(nextbox, "NEXT");
wrefresh(border);
wrefresh(nextbox);
initField(' ');
initPieces();
pieceX = 4;
pieceY = 1;
needUpdate = 1;
timePassed = mtime();
score = 0;
srandom(mtime());
currentPiece = random() % 19;
nextPiece = random() % 19;
printNext(pieces[nextPiece]);
while ((c = getch()) != 'q') {
switch (c) {
case KEY_LEFT:
if (slidePiece(pieceX-1, pieceY, pieces[currentPiece])) pieceX--;
needUpdate = 1;
break;
case KEY_RIGHT:
if (slidePiece(pieceX+1, pieceY, pieces[currentPiece])) pieceX++;
needUpdate = 1;
break;
case KEY_UP:
currentPiece = rotatePieceLeft(&pieceX, pieceY, pieces[currentPiece]);
needUpdate = 1;
break;
case KEY_DOWN:
currentPiece = rotatePieceRight(&pieceX, pieceY, pieces[currentPiece]);
needUpdate = 1;
break;
case ' ':
pieceY++;
needUpdate = 1;
break;
}
if (movePiece(pieceX, pieceY, pieces[currentPiece]) == 1) {
pieceX = 4;
pieceY = 0;
currentPiece = nextPiece;
nextPiece = random() % 19;
printNext(pieces[nextPiece]);
needUpdate = 1;
}
else if (movePiece(pieceX, pieceY, pieces[currentPiece]) == 2) {
break;
}
if (mtime() - timePassed > 300000) {
pieceY++;
timePassed = mtime();
needUpdate = 1;
}
if (needUpdate) {
printField();
printPiece(pieceX, pieceY, pieces[currentPiece]);
move(0, 0);
printw("LINES: %d", score);
refresh();
needUpdate = 0;
}
}
move(6, 4);
printw("GAME OVER");
nodelay(stdscr, FALSE);
getch();
endwin(); /* End curses mode */
return 0;
}
void initField(char c)
{
int x, y;
for (y = 0; y < 15; y++) { // zero field
for (x = 0; x < 10; x++) {
field[y][x] = c;
}
}
}
void printField()
{
int x, y;
for (y = 1; y < 16; y++) {
wmove(playbox, y, 1);
for (x = 0; x < 10; x++) {
waddch(playbox, field[y-1][x]);
}
}
box(playbox, 0, 0);
wrefresh(playbox); /* Print it on to the real screen */
}
int rotatePieceLeft(int *x, int y, piece thepiece)
{
piece newPiece;
newPiece = pieces[thepiece.leftPiece];
if (slidePiece(*x, y, newPiece)) {
return thepiece.leftPiece;
}
// try nudging left, then right
if (slidePiece(*x+1, y, newPiece)) { (*x)++; return thepiece.leftPiece; }
if (slidePiece(*x+2, y, newPiece)) { (*x)+=2; return thepiece.leftPiece; }
if (slidePiece(*x-1, y, newPiece)) { (*x)--; return thepiece.leftPiece; }
if (slidePiece(*x-2, y, newPiece)) { (*x)-=2; return thepiece.leftPiece; }
return thepiece.this;
}
int rotatePieceRight(int *x, int y, piece thepiece)
{
piece newPiece;
newPiece = pieces[thepiece.rightPiece];
if (slidePiece(*x, y, newPiece)) {
return thepiece.rightPiece;
}
// try nudging left, then right
if (slidePiece(*x+1, y, newPiece)) { (*x)++; return thepiece.rightPiece; }
if (slidePiece(*x+2, y, newPiece)) { (*x)+=2; return thepiece.rightPiece; }
if (slidePiece(*x-1, y, newPiece)) { (*x)--; return thepiece.rightPiece; }
if (slidePiece(*x-2, y, newPiece)) { (*x)-=2; return thepiece.rightPiece; }
return thepiece.this;
}
int slidePiece(int x, int y, piece thepiece)
{
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
if (thepiece.shape[i][j] != ' ') {
if (field[y+i-1][x+j-1] == '#' || x+j == 0 || x+j == 11) {
return 0;
}
}
}
}
return 1;
}
int movePiece(int x, int y, piece thepiece)
{
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
if (thepiece.shape[i][j] != ' ') {
if (field[y+i-1][x+j-1] == '#' || y+i == 16) {
if (y == 1) return 2;
addPieceToField(x, y, thepiece);
return 1;
}
}
}
}
return 0;
}
void addPieceToField(int x, int y, piece thepiece)
{
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
if (thepiece.shape[i][j] != ' ') field[y+i-2][x+j-1] = '#';
}
}
score += clearLines(y);
}
int clearLines(int y)
{
int i, j, k;
int clear, linesDone;
linesDone = 0;
clear = 1;
for (i = -1; i < 4; i++) { // why -1 to 4? fucked if i know
if (i+y >= 15 || i+y < 0) break; // hack ahoy
clear = 1;
for (j = 0; j < 10; j++) {
if (field[i+y][j] == ' ') {
clear = 0;
// printw("%d, %d\n", i+y, j);
break;
}
}
if (clear) {
linesDone++;
for (k = 0; k < 10; k++) {
field[i+y][k] = '-';
}
}
}
if (linesDone) {
printField();
usleep(100000);
}
clear = 1;
while (clear) {
for (i = 0; i < 15; i++) {
clear = 0;
if (field[i][0] == '-') {
eraseLine(i);
}
}
}
refresh();
return linesDone;
}
void eraseLine(int y)
{
int i;
int they;
they = y;
while (they) {
for (i = 0; i < 10; i++) field[they][i] = field[they-1][i];
they--;
}
}
void printPiece(int x, int y, piece thepiece)
{
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
wmove(playbox, y+i, x+j);
if (thepiece.shape[i][j] != ' ') waddch(playbox, thepiece.shape[i][j]);
}
}
wrefresh(playbox);
}
void printNext(piece thepiece)
{
int i, j;
box(nextbox, 0, 0);
wmove(nextbox, 1, 1);
wprintw(nextbox, " \n \n \n ");
box(nextbox, 0, 0);
wmove(nextbox, 0, 1);
wprintw(nextbox, "NEXT");
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
wmove(nextbox, i+1, j+1);
if (thepiece.shape[i][j] != ' ') waddch(nextbox, thepiece.shape[i][j]);
}
}
wrefresh(nextbox);
}
void initPieces()
{
int i;
char *place;
place = (char*)pieces;
for (i = 0; i < sizeof(pieces); i++) {
*(place++) = ' ';
}
pieces[SQUARE].shape[1][1] = '@';
pieces[SQUARE].shape[1][2] = '@';
pieces[SQUARE].shape[2][1] = '@';
pieces[SQUARE].shape[2][2] = '@';
pieces[SQUARE].leftPiece = SQUARE;
pieces[SQUARE].rightPiece = SQUARE;
pieces[SQUARE].this = SQUARE;
pieces[SSHAPE].shape[1][2] = '@';
pieces[SSHAPE].shape[1][3] = '@';
pieces[SSHAPE].shape[2][1] = '@';
pieces[SSHAPE].shape[2][2] = '@';
pieces[SSHAPE].leftPiece = SSHAPER;
pieces[SSHAPE].rightPiece = SSHAPER;
pieces[SSHAPE].this = SSHAPE;
pieces[SSHAPER].shape[0][1] = '@';
pieces[SSHAPER].shape[1][1] = '@';
pieces[SSHAPER].shape[1][2] = '@';
pieces[SSHAPER].shape[2][2] = '@';
pieces[SSHAPER].leftPiece = SSHAPE;
pieces[SSHAPER].rightPiece = SSHAPE;
pieces[SSHAPER].this = SSHAPER;
pieces[ZSHAPE].shape[1][0] = '@';
pieces[ZSHAPE].shape[1][1] = '@';
pieces[ZSHAPE].shape[2][1] = '@';
pieces[ZSHAPE].shape[2][2] = '@';
pieces[ZSHAPE].leftPiece = ZSHAPER;
pieces[ZSHAPE].rightPiece = ZSHAPER;
pieces[ZSHAPE].this = ZSHAPE;
pieces[ZSHAPER].shape[0][2] = '@';
pieces[ZSHAPER].shape[1][1] = '@';
pieces[ZSHAPER].shape[1][2] = '@';
pieces[ZSHAPER].shape[2][1] = '@';
pieces[ZSHAPER].leftPiece = ZSHAPE;
pieces[ZSHAPER].rightPiece =ZSHAPE;
pieces[ZSHAPER].this = ZSHAPER;
pieces[LSHAPEN].shape[1][1] = '@';
pieces[LSHAPEN].shape[2][1] = '@';
pieces[LSHAPEN].shape[3][1] = '@';
pieces[LSHAPEN].shape[3][2] = '@';
pieces[LSHAPEN].leftPiece = LSHAPEW;
pieces[LSHAPEN].rightPiece = LSHAPEE;
pieces[LSHAPEN].this = LSHAPEN;
pieces[LSHAPEE].shape[1][1] = '@';
pieces[LSHAPEE].shape[1][2] = '@';
pieces[LSHAPEE].shape[1][3] = '@';
pieces[LSHAPEE].shape[2][1] = '@';
pieces[LSHAPEE].leftPiece = LSHAPEN;
pieces[LSHAPEE].rightPiece = LSHAPES;
pieces[LSHAPEE].this = LSHAPEE;
pieces[LSHAPES].shape[0][1] = '@';
pieces[LSHAPES].shape[0][2] = '@';
pieces[LSHAPES].shape[1][2] = '@';
pieces[LSHAPES].shape[2][2] = '@';
pieces[LSHAPES].leftPiece = LSHAPEE;
pieces[LSHAPES].rightPiece = LSHAPEW;
pieces[LSHAPES].this = LSHAPES;
pieces[LSHAPEW].shape[1][3] = '@';
pieces[LSHAPEW].shape[2][1] = '@';
pieces[LSHAPEW].shape[2][2] = '@';
pieces[LSHAPEW].shape[2][3] = '@';
pieces[LSHAPEW].leftPiece = LSHAPES;
pieces[LSHAPEW].rightPiece = LSHAPEN;
pieces[LSHAPEW].this = LSHAPEW;
pieces[JSHAPEN].shape[0][1] = '@';
pieces[JSHAPEN].shape[1][1] = '@';
pieces[JSHAPEN].shape[2][1] = '@';
pieces[JSHAPEN].shape[2][0] = '@';
pieces[JSHAPEN].leftPiece = JSHAPEW;
pieces[JSHAPEN].rightPiece = JSHAPEE;
pieces[JSHAPEN].this = JSHAPEN;
pieces[JSHAPEE].shape[0][1] = '@';
pieces[JSHAPEE].shape[1][1] = '@';
pieces[JSHAPEE].shape[1][2] = '@';
pieces[JSHAPEE].shape[1][3] = '@';
pieces[JSHAPEE].leftPiece = JSHAPEN;
pieces[JSHAPEE].rightPiece = JSHAPES;
pieces[JSHAPEE].this = JSHAPEE;
pieces[JSHAPES].shape[1][2] = '@';
pieces[JSHAPES].shape[1][3] = '@';
pieces[JSHAPES].shape[2][2] = '@';
pieces[JSHAPES].shape[3][2] = '@';
pieces[JSHAPES].leftPiece = JSHAPEE;
pieces[JSHAPES].rightPiece = JSHAPEW;
pieces[JSHAPES].this = JSHAPES;
pieces[JSHAPEW].shape[2][0] = '@';
pieces[JSHAPEW].shape[2][1] = '@';
pieces[JSHAPEW].shape[2][2] = '@';
pieces[JSHAPEW].shape[3][2] = '@';
pieces[JSHAPEW].leftPiece = JSHAPES;
pieces[JSHAPEW].rightPiece = JSHAPEN;
pieces[JSHAPEW].this = JSHAPEW;
pieces[TSHAPEN].shape[1][1] = '@';
pieces[TSHAPEN].shape[2][0] = '@';
pieces[TSHAPEN].shape[2][1] = '@';
pieces[TSHAPEN].shape[2][2] = '@';
pieces[TSHAPEN].leftPiece = TSHAPEW;
pieces[TSHAPEN].rightPiece = TSHAPEE;
pieces[TSHAPEN].this = TSHAPEN;
pieces[TSHAPEE].shape[0][1] = '@';
pieces[TSHAPEE].shape[1][1] = '@';
pieces[TSHAPEE].shape[2][1] = '@';
pieces[TSHAPEE].shape[1][2] = '@';
pieces[TSHAPEE].leftPiece = TSHAPEN;
pieces[TSHAPEE].rightPiece = TSHAPES;
pieces[TSHAPEE].this = TSHAPEE;
pieces[TSHAPES].shape[1][1] = '@';
pieces[TSHAPES].shape[1][2] = '@';
pieces[TSHAPES].shape[1][3] = '@';
pieces[TSHAPES].shape[2][2] = '@';
pieces[TSHAPES].leftPiece = TSHAPEE;
pieces[TSHAPES].rightPiece = TSHAPEW;
pieces[TSHAPES].this = TSHAPES;
pieces[TSHAPEW].shape[1][2] = '@';
pieces[TSHAPEW].shape[2][1] = '@';
pieces[TSHAPEW].shape[2][2] = '@';
pieces[TSHAPEW].shape[3][2] = '@';
pieces[TSHAPEW].leftPiece = TSHAPES;
pieces[TSHAPEW].rightPiece = TSHAPEN;
pieces[TSHAPEW].this = TSHAPEW;
pieces[LINE].shape[0][1] = '@';
pieces[LINE].shape[1][1] = '@';
pieces[LINE].shape[2][1] = '@';
pieces[LINE].shape[3][1] = '@';
pieces[LINE].leftPiece = LINER;
pieces[LINE].rightPiece = LINER;
pieces[LINE].this = LINE;
pieces[LINE].shape[0][1] = '@';
pieces[LINE].shape[1][1] = '@';
pieces[LINE].shape[2][1] = '@';
pieces[LINE].shape[3][1] = '@';
pieces[LINE].leftPiece = LINER;
pieces[LINE].rightPiece = LINER;
pieces[LINE].this = LINE;
pieces[LINE].shape[0][1] = '@';
pieces[LINE].shape[1][1] = '@';
pieces[LINE].shape[2][1] = '@';
pieces[LINE].shape[3][1] = '@';
pieces[LINE].leftPiece = LINER;
pieces[LINE].rightPiece = LINER;
pieces[LINE].this = LINE;
pieces[LINER].shape[1][0] = '@';
pieces[LINER].shape[1][1] = '@';
pieces[LINER].shape[1][2] = '@';
pieces[LINER].shape[1][3] = '@';
pieces[LINER].leftPiece = LINE;
pieces[LINER].rightPiece = LINE;
pieces[LINER].this = LINER;
}
static long mtime(void)
{
struct timeval tk_time;
struct timezone tz;
gettimeofday(&tk_time, &tz);
return tk_time.tv_usec + tk_time.tv_sec*1000000;
}Sir, e^iπ + 1 = 0, hence God exists; reply!
I entered, but the forum was downl on Tuesday night and I've been out of the country with no internet access since then. My entry is at http://www.gerbilmedia.co.uk/SquareRain.app.zip (according to a scribbled note in my bag). (checked the link - it works).
It's still in a sort off beta state - don't press cmd-Q (sorry - I'll fix it - it seems to be a GLFW thing). I think it should work on Intel, but I've got no way to be sure.
I haven't written a help page yet, so briefly, try to arrange the blocks into lines of four the same colour. Longer lines get more points. The bricks are affected by gravity so they don't float around unsupported. The controls should be quite familiar. (Cursor keys, and press space to drop the block faster).
Enjoy.
It's still in a sort off beta state - don't press cmd-Q (sorry - I'll fix it - it seems to be a GLFW thing). I think it should work on Intel, but I've got no way to be sure.
I haven't written a help page yet, so briefly, try to arrange the blocks into lines of four the same colour. Longer lines get more points. The bricks are affected by gravity so they don't float around unsupported. The controls should be quite familiar. (Cursor keys, and press space to drop the block faster).
Enjoy.
in emacs:
press the meta key, which is esc on mac, then x (for the buffer).
type in tetris.
a nice distraction from working when you're in emacs.
press the meta key, which is esc on mac, then x (for the buffer).
type in tetris.
a nice distraction from working when you're in emacs.
It's not magic, it's Ruby.
Nayr Wrote:in emacs:You've just lowered all my grades a full letter
press the meta key, which is esc on mac, then x (for the buffer).
type in tetris.
a nice distraction from working when you're in emacs.
. Seriously, that's awesome and I'm glad someone told me about it.
also there is pong, snake, doctor, and probably others I haven't found.
There's also a way to learn how to say hello in an absurd amount of languages, but I've forgotten how to get it.
There's also a way to learn how to say hello in an absurd amount of languages, but I've forgotten how to get it.
It's not magic, it's Ruby.
I am currently trying to work through the text adventure "M-x dunnet"
Sir, e^iπ + 1 = 0, hence God exists; reply!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Mini fun Contest | EvolPenguin | 2 | 4,332 |
Nov 14, 2010 11:10 AM Last Post: EvolPenguin |
|
| WebGL Mini-Contest | OneSadCookie | 26 | 17,875 |
Dec 14, 2009 11:40 AM Last Post: OneSadCookie |
|
| Mini-contest: Time & Space Manipulation | OneSadCookie | 18 | 12,529 |
Nov 8, 2009 02:38 PM Last Post: Oddity007 |
|
| 21 Day Mini Contest | FlamingHairball | 2 | 5,973 |
Aug 1, 2009 03:03 PM Last Post: FlamingHairball |
|
| Mini Contest Ideas | FlamingHairball | 34 | 18,765 |
Aug 1, 2009 07:51 AM Last Post: Oddity007 |
|

