mirror of
https://github.com/abakh/nbsdgames.git
synced 2024-11-02 16:27:18 -04:00
misc
This commit is contained in:
parent
bff304279b
commit
1a0c368dee
29
README.md
29
README.md
@ -10,9 +10,7 @@
|
||||
|
||||
**Don't worry** anymore as you've got nbsdgames now!
|
||||
|
||||
I originally made these in hope of them becoming added to NetBSD (but the few i talked to preferred to have games in the repositories rather than in /usr/games itself).
|
||||
|
||||
These include:
|
||||
The games include:
|
||||
|
||||
* Jewels (A game with a gameplay kinda similiar to that of Tetris, NOT my invention)
|
||||
* Sudoku
|
||||
@ -25,20 +23,21 @@ These include:
|
||||
* Pipes (Same as the famous Pipe Mania, unplayable on the environments that don't support the line characters)
|
||||
* Fifteen
|
||||
* Memoblocks (or Memory blocks. A similar game was included in Windows 7)
|
||||
* Fisher^
|
||||
* Muncher^
|
||||
* Miketron^
|
||||
* Redsquare^ (Conway's Game of Life made playable!)
|
||||
|
||||
They natively run on Linux, BSD, MacOS and are known to work on Windows as well (using PDCurses, thanks to Laura Michaels for providing advice).
|
||||
|
||||
They have been ported to Plan9 thanks to Jens Staal!
|
||||
* Fisher
|
||||
* Muncher
|
||||
* Miketron
|
||||
* Redsquare (Conway's Game of Life made playable!)
|
||||
|
||||
The difficulty and/or dimensions are adjustable through simple command line options, you can play a minesweeper game that take hours to complete, or exprience hexadecimal sudoku and 8x8 fifteen-like puzzles!
|
||||
|
||||
Play on xterm for best exprience.
|
||||
|
||||
^ I have encounterd Fisher, Muncher and Miketron on MikeOS and RedSquare on KolibriOS
|
||||
## Platforms
|
||||
|
||||
They natively run on Linux, BSD, MacOS and are known to work on Windows as well (using PDCurses, thanks to Laura Michaels for providing advice).
|
||||
|
||||
They have been ported to Plan9 thanks to Jens Staal!
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* git (optional)
|
||||
@ -62,12 +61,12 @@ Like this:
|
||||
export PREFIX= ~/bin
|
||||
make install
|
||||
```
|
||||
|
||||
## Packages
|
||||
Also, If you are on a debian-based OS on a 64-bit PC you can download the deb package and simply install it with dpkg or apt.
|
||||
the deb package(old): https://github.com/abakh/nbsdgames/releases/download/v2.0/nbsdgames_amd64.deb
|
||||
|
||||
It's available on AUR thanks to Elias Riedel Gårding: https://aur.archlinux.org/packages/nbsdgames-git/
|
||||
(The commands start with nbsd_ to avoid conflict)
|
||||
(The commands start with nbsd_ or nb to avoid conflict)
|
||||
|
||||
It's been made available for openSUSE thanks to Zinjanthropus: https://build.opensuse.org/package/show/home:Zinjanthropus/nbsdgames
|
||||
## How do these look like
|
||||
@ -79,7 +78,7 @@ Plan9
|
||||
|
||||
## How to contribute
|
||||
* Share these with your friends and others
|
||||
* Your stars make the repo more findable in github
|
||||
* Your stars make the repo more findable in github :star:
|
||||
* Tell me your feature requests, bug reports, etc.
|
||||
* Tell me the games you want to be added (but in the same genre, i can't port Angry Birds to curses! :)
|
||||
* Make a package for your distro (or put it on repos if the package is not there)
|
||||
|
@ -14,7 +14,7 @@ compile with -lncurses
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
typedef /*signed char*/ uint8_t byte;
|
||||
typedef signed char byte;
|
||||
|
||||
/* The Plan9 compiler can not handle VLAs */
|
||||
#ifdef Plan9
|
||||
@ -22,7 +22,6 @@ typedef /*signed char*/ uint8_t byte;
|
||||
#else
|
||||
byte size;
|
||||
#endif
|
||||
FILE *lol;
|
||||
byte py,px;
|
||||
byte ey,ex; //the empty tile
|
||||
chtype green=A_BOLD; //bold when there is no color
|
||||
@ -201,7 +200,6 @@ int main(int argc, char** argv){
|
||||
}
|
||||
}
|
||||
#endif
|
||||
lol=fopen("lol","w");
|
||||
signal(SIGINT,sigint_handler);
|
||||
srand(time(NULL)%UINT_MAX);
|
||||
initscr();
|
||||
|
@ -257,11 +257,11 @@ void showscores(byte playerrank){
|
||||
mvprintw(a+1,HWID-10," _____ You bet the");
|
||||
mvprintw(a+2,HWID-10," .' | previous");
|
||||
mvprintw(a+3,HWID-10," .' | record");
|
||||
mvprintw(a+4,HWID-10," | .| | of");
|
||||
mvprintw(a+4,HWID-10," | .| | of");
|
||||
mvprintw(a+5,HWID-10," |.' | |%11ld",formerscore);
|
||||
mvprintw(a+6,HWID-10," | | held by");
|
||||
mvprintw(a+7,HWID-10," ___| |___%7s!",formername);
|
||||
mvprintw(a+8,HWID-10," | |");
|
||||
mvprintw(a+8,HWID-10," | |");
|
||||
mvprintw(a+9,HWID-10," |____________|");
|
||||
mvprintw(LEN-3,HWID-11,"Press a key to continue");
|
||||
refresh();
|
||||
|
170
sources/jewels.c
170
sources/jewels.c
@ -97,12 +97,12 @@ void showscores(byte playerrank){
|
||||
printf("\n*****CONGRATULATIONS!****\n");
|
||||
printf(" _____ You bet the\n");
|
||||
printf(" .' | previous\n");
|
||||
printf(" .' | record\n");
|
||||
printf(" | .| | of\n");
|
||||
printf(" .' | record\n");
|
||||
printf(" | .| | of\n");
|
||||
printf(" |.' | |%14ld\n",formerscore);
|
||||
printf(" | | held by\n");
|
||||
printf(" ___| |___%11s\n",formername);
|
||||
printf(" | |\n");
|
||||
printf(" | |\n");
|
||||
printf(" |____________|\n");
|
||||
printf("*************************\n");
|
||||
}
|
||||
@ -301,89 +301,89 @@ int main(void){
|
||||
bool falls;
|
||||
byte stop=0 , combo;
|
||||
char jwstr[] = {'*','^','~','"','$','V'};
|
||||
if(has_colors()){
|
||||
start_color();
|
||||
use_default_colors();
|
||||
init_pair(1,COLOR_RED,-1);
|
||||
init_pair(2,COLOR_GREEN,-1);
|
||||
init_pair(3,COLOR_MAGENTA,-1);
|
||||
init_pair(4,COLOR_BLUE,-1);//array this thing
|
||||
init_pair(5,COLOR_YELLOW,-1);
|
||||
init_pair(6,COLOR_CYAN,-1);
|
||||
for(byte n=0;n<6;++n){
|
||||
colors[n] = COLOR_PAIR(n+1);
|
||||
}
|
||||
}
|
||||
if(has_colors()){
|
||||
start_color();
|
||||
use_default_colors();
|
||||
init_pair(1,COLOR_RED,-1);
|
||||
init_pair(2,COLOR_GREEN,-1);
|
||||
init_pair(3,COLOR_MAGENTA,-1);
|
||||
init_pair(4,COLOR_BLUE,-1);//array this thing
|
||||
init_pair(5,COLOR_YELLOW,-1);
|
||||
init_pair(6,COLOR_CYAN,-1);
|
||||
for(byte n=0;n<6;++n){
|
||||
colors[n] = COLOR_PAIR(n+1);
|
||||
}
|
||||
}
|
||||
|
||||
srand(time(NULL)%UINT_MAX);
|
||||
byte ran1= rand()%6;
|
||||
byte ran2= rand()%6;
|
||||
next1= colors[ran1]|jwstr[ran1];
|
||||
next2= colors[ran2]|jwstr[ran2];
|
||||
while(1){
|
||||
chtype a,b;
|
||||
a=board[0][WID/2];
|
||||
b=board[0][WID/2-1];
|
||||
if(a || b ){
|
||||
goto Lose;
|
||||
}
|
||||
jy=ky=0;
|
||||
jx=WID/2;
|
||||
kx=-1;
|
||||
board[jy][jx]=next2;
|
||||
board[jy+ky][jx+kx]=next1;
|
||||
ran1= rand()%6;
|
||||
ran2= rand()%6;
|
||||
next1=colors[ran1]|jwstr[ran1];
|
||||
next2=colors[ran2]|jwstr[ran2];
|
||||
falls = 1;
|
||||
while(falls){
|
||||
input = getch();
|
||||
srand(time(NULL)%UINT_MAX);
|
||||
byte ran1= rand()%6;
|
||||
byte ran2= rand()%6;
|
||||
next1= colors[ran1]|jwstr[ran1];
|
||||
next2= colors[ran2]|jwstr[ran2];
|
||||
while(1){
|
||||
chtype a,b;
|
||||
a=board[0][WID/2];
|
||||
b=board[0][WID/2-1];
|
||||
if(a || b ){
|
||||
goto Lose;
|
||||
}
|
||||
jy=ky=0;
|
||||
jx=WID/2;
|
||||
kx=-1;
|
||||
board[jy][jx]=next2;
|
||||
board[jy+ky][jx+kx]=next1;
|
||||
ran1= rand()%6;
|
||||
ran2= rand()%6;
|
||||
next1=colors[ran1]|jwstr[ran1];
|
||||
next2=colors[ran2]|jwstr[ran2];
|
||||
falls = 1;
|
||||
while(falls){
|
||||
input = getch();
|
||||
|
||||
if(input != ERR)
|
||||
stop+=1;
|
||||
if(input != ERR)
|
||||
stop+=1;
|
||||
|
||||
if( stop >= 10){
|
||||
falls=fall();
|
||||
stop=0;
|
||||
}
|
||||
else if(input=='l' || input==KEY_RIGHT)
|
||||
jmove(0,+1);
|
||||
else if(input=='j' || input==KEY_LEFT )
|
||||
jmove(0,-1);
|
||||
else if(input=='k' || input==KEY_UP)
|
||||
rotate();
|
||||
else if(input=='p'){
|
||||
mvaddstr(LINES-2,COLS/2-15,"Paused - Press a key to continue ");
|
||||
refresh();
|
||||
nocbreak();
|
||||
cbreak();
|
||||
getch();
|
||||
halfdelay(DELAY);
|
||||
}
|
||||
else if(input=='q')
|
||||
goto Lose;
|
||||
else if(input==' ')
|
||||
while( (falls=fall()) )
|
||||
stop=0;
|
||||
else{
|
||||
falls=fall();
|
||||
stop=0;
|
||||
}
|
||||
draw();
|
||||
}
|
||||
combo=1;
|
||||
while(explode(combo)){ // explode, fall, explode, fall until nothing is left
|
||||
++combo;
|
||||
while(fall());
|
||||
draw();
|
||||
}
|
||||
}
|
||||
Lose:
|
||||
nocbreak();
|
||||
endwin();
|
||||
printf("%s _Jewels_ %s\n",jwstr,jwstr);
|
||||
printf("You have scored %ld points.\n",score);
|
||||
showscores(scorewrite(score));
|
||||
return EXIT_SUCCESS;
|
||||
if( stop >= 10){
|
||||
falls=fall();
|
||||
stop=0;
|
||||
}
|
||||
else if(input=='l' || input==KEY_RIGHT)
|
||||
jmove(0,+1);
|
||||
else if(input=='j' || input==KEY_LEFT )
|
||||
jmove(0,-1);
|
||||
else if(input=='k' || input==KEY_UP)
|
||||
rotate();
|
||||
else if(input=='p'){
|
||||
mvaddstr(LINES-2,COLS/2-15,"Paused - Press a key to continue ");
|
||||
refresh();
|
||||
nocbreak();
|
||||
cbreak();
|
||||
getch();
|
||||
halfdelay(DELAY);
|
||||
}
|
||||
else if(input=='q')
|
||||
goto Lose;
|
||||
else if(input==' ')
|
||||
while( (falls=fall()) )
|
||||
stop=0;
|
||||
else{
|
||||
falls=fall();
|
||||
stop=0;
|
||||
}
|
||||
draw();
|
||||
}
|
||||
combo=1;
|
||||
while(explode(combo)){ // explode, fall, explode, fall until nothing is left
|
||||
++combo;
|
||||
while(fall());
|
||||
draw();
|
||||
}
|
||||
}
|
||||
Lose:
|
||||
nocbreak();
|
||||
endwin();
|
||||
printf("%s _Jewels_ %s\n",jwstr,jwstr);
|
||||
printf("You have scored %ld points.\n",score);
|
||||
showscores(scorewrite(score));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -158,15 +158,15 @@ void showscores(byte playerrank){
|
||||
if ( fscanf(scorefile,"%s : %ld\n",formername,&formerscore)==2){
|
||||
halfdelay(1);
|
||||
printw("*****CONGRATULATIONS!****\n");
|
||||
printw(" You bet the\n");
|
||||
printw(" previous\n");
|
||||
printw(" record\n");
|
||||
printw(" of\n");
|
||||
printw(" %14ld\n",formerscore);
|
||||
printw(" held by\n");
|
||||
printw(" %11s\n",formername);
|
||||
printw(" \n");
|
||||
printw(" \n");
|
||||
printw(" You bet the\n");
|
||||
printw(" previous\n");
|
||||
printw(" record\n");
|
||||
printw(" of\n");
|
||||
printw(" %14ld\n",formerscore);
|
||||
printw(" held by\n");
|
||||
printw(" %11s\n",formername);
|
||||
printw(" \n");
|
||||
printw(" \n");
|
||||
printw("*************************\n");
|
||||
printw("Press a key to proceed:");
|
||||
Effect:
|
||||
@ -179,7 +179,7 @@ void showscores(byte playerrank){
|
||||
mvprintw(8,0, " |.' | |");
|
||||
mvprintw(9,0, " | |");
|
||||
mvprintw(10,0," ___| |___");
|
||||
mvprintw(11,0," | |");
|
||||
mvprintw(11,0," | |");
|
||||
mvprintw(12,0," |____________|");
|
||||
attroff(colors[b]);
|
||||
b=(b+1)%6;
|
||||
|
@ -135,15 +135,15 @@ void showscores(byte playerrank){
|
||||
if ( fscanf(scorefile,"%s : %ld\n",formername,&formerscore)==2){
|
||||
halfdelay(2);
|
||||
printw("*****CONGRATULATIONS!****\n");
|
||||
printw(" You bet the\n");
|
||||
printw(" previous\n");
|
||||
printw(" record\n");
|
||||
printw(" of\n");
|
||||
printw(" %14ld\n",formerscore);
|
||||
printw(" held by\n");
|
||||
printw(" %11s\n",formername);
|
||||
printw(" \n");
|
||||
printw(" \n");
|
||||
printw(" You bet the\n");
|
||||
printw(" previous\n");
|
||||
printw(" record\n");
|
||||
printw(" of\n");
|
||||
printw(" %14ld\n",formerscore);
|
||||
printw(" held by\n");
|
||||
printw(" %11s\n",formername);
|
||||
printw(" \n");
|
||||
printw(" \n");
|
||||
printw("*************************\n");
|
||||
printw("Press a key to proceed:");
|
||||
Effect:
|
||||
@ -156,7 +156,7 @@ void showscores(byte playerrank){
|
||||
mvprintw(8,0, " |.' | |");
|
||||
mvprintw(9,0, " | |");
|
||||
mvprintw(10,0," ___| |___");
|
||||
mvprintw(11,0," | |");
|
||||
mvprintw(11,0," | |");
|
||||
mvprintw(12,0," |____________|");
|
||||
attroff(colors[b]);
|
||||
b=(b+1)%6;
|
||||
|
@ -125,7 +125,7 @@ void showscores(byte playerrank){
|
||||
if ( fscanf(scorefile,"%s : %ld",formername,&formerscore)==2 && formerscore>0){
|
||||
byte a = (len-9)/2;
|
||||
attron(A_BOLD);
|
||||
mvprintw(SY,SX, "**** ***");
|
||||
mvprintw(SY,SX, "**** ***");
|
||||
mvprintw(SY+len+1,SX,"***********************");
|
||||
attroff(A_BOLD);
|
||||
attron(green);
|
||||
@ -135,11 +135,11 @@ void showscores(byte playerrank){
|
||||
mvprintw(SY+a+1,SX," _____ You bet the");
|
||||
mvprintw(SY+a+2,SX," .' | previous");
|
||||
mvprintw(SY+a+3,SX," .' | record");
|
||||
mvprintw(SY+a+4,SX," | .| | of");
|
||||
mvprintw(SY+a+4,SX," | .| | of");
|
||||
mvprintw(SY+a+5,SX," |.' | |%11ld",formerscore);
|
||||
mvprintw(SY+a+6,SX," | | held by");
|
||||
mvprintw(SY+a+7,SX," ___| |___%7s!",formername);
|
||||
mvprintw(SY+a+8,SX," | |");
|
||||
mvprintw(SY+a+8,SX," | |");
|
||||
mvprintw(SY+a+9,SX," |____________|");
|
||||
mvprintw(len+2,0,"Game over! Press a key to proceed:");
|
||||
refresh();
|
||||
@ -311,7 +311,7 @@ void help(void){
|
||||
erase();
|
||||
logo();
|
||||
attron(A_BOLD);
|
||||
mvprintw(SY,SX+5,"-* *-");
|
||||
mvprintw(SY,SX+5,"-* *-");
|
||||
mvprintw(3,0," HELP");
|
||||
mvprintw(4,0," PAGE");
|
||||
mvprintw(SY+7,SX,"YOU CAN ALSO USE THE MOUSE!");
|
||||
@ -335,7 +335,7 @@ void gameplay(void){
|
||||
erase();
|
||||
logo();
|
||||
attron(A_BOLD);
|
||||
mvprintw(SY,SX+5,"-* *-");
|
||||
mvprintw(SY,SX+5,"-* *-");
|
||||
mvprintw(3,0," HELP");
|
||||
mvprintw(4,0," PAGE");
|
||||
attroff(A_BOLD);
|
||||
|
@ -262,7 +262,7 @@ int main(int argc, char** argv){
|
||||
now=time(NULL);
|
||||
erase();
|
||||
mvprintw(sy+0,sx+0," _ ");
|
||||
mvprintw(sy+1,sx+0,"|_) Time left :%ld",giventime-(now-tstart));
|
||||
mvprintw(sy+1,sx+0,"|_) Time left :%ld",giventime-(now-tstart));
|
||||
mvprintw(sy+2,sx+0,"| \\ABBITHOLE Carrots left :%d",carrot_count-carrots_found);
|
||||
draw(sy+3,sx+0,board);
|
||||
refresh();
|
||||
|
@ -160,7 +160,7 @@ void fill(char board[s][s]){
|
||||
if ( fill_with(board,int2sgn(num) ) ){
|
||||
memset(board,0,s*s);
|
||||
num=0;
|
||||
mvaddstr(0,0,"My algorithm sucks, so you need to wait a bit ");//with animated dots to entertain the waiter
|
||||
mvaddstr(0,0,"My algorithm sucks, so you need to wait a bit ");//with animated dots to entertain the waiter
|
||||
if(waitcycles==3)
|
||||
mvaddstr(2,0,"(You can set SUDOKU_FASTGEN if you just want to see if it works)");
|
||||
move(0,45);
|
||||
|
Loading…
Reference in New Issue
Block a user