r1673
dslinux_pepsiman at user.in-berlin.de
dslinux_pepsiman at user.in-berlin.de
Thu Jan 11 23:46:26 CET 2007
Author: pepsiman
Date: 2007-01-11 23:46:21 +0100 (Thu, 11 Jan 2007)
New Revision: 1673
Log:
Apply patches from Daniele Forsi <dforsi at gmail.com>:
I have made some trivial changes to fit in 64 columns the test
programs from libncurses that are copied to /usr/bin with the RAM
build (blue, bs, gdc, hanoi and knight). I only changed column offsets
and reformatted help strings.
Modified: trunk/lib/libncurses/test/blue.c
===================================================================
--- trunk/lib/libncurses/test/blue.c 2006-12-24 14:36:33 UTC (rev 1672)
+++ trunk/lib/libncurses/test/blue.c 2007-01-11 22:46:21 UTC (rev 1673)
@@ -175,7 +175,6 @@
addch(ranks[value % SUIT_LENGTH][1] | COLOR_PAIR(BLUE_ON_WHITE));
addch(suits[value / SUIT_LENGTH]);
}
- (void) addch(' ');
}
static void
@@ -196,17 +195,20 @@
move(PROMPTROW + 2, 0);
refresh();
#define P(x) (void)printw("%s\n", x)
- P(" This 52-card solitaire starts with the entire deck shuffled and dealt");
- P("out in four rows. The aces are then moved to the left end of the layout,");
- P("making 4 initial free spaces. You may move to a space only the card that");
- P("matches the left neighbor in suit, and is one greater in rank. Kings are");
- P("high, so no cards may be placed to their right (they create dead spaces).");
- P(" When no moves can be made, cards still out of sequence are reshuffled");
- P("and dealt face up after the ends of the partial sequences, leaving a card");
- P("space after each sequence, so that each row looks like a partial sequence");
- P("followed by a space, followed by enough cards to make a row of 14. ");
- P(" A moment's reflection will show that this game cannot take more than 13");
- P("deals. A good score is 1-3 deals, 4-7 is average, 8 or more is poor. ");
+ P(" This 52-card solitaire starts with the entire deck shuffled");
+ P("and dealt out in four rows. The aces are then moved to the left");
+ P("end of the layout, making 4 initial free spaces. You may move");
+ P("to a space only the card that matches the left neighbor in");
+ P("suit, and is one greater in rank. Kings are high, so no cards");
+ P("may be placed to their right (they create dead spaces).");
+ P(" When no moves can be made, cards still out of sequence are");
+ P("reshuffled and dealt face up after the ends of the partial");
+ P("sequences, leaving a card space after each sequence, so that");
+ P("each row looks like a partial sequence followed by a space,");
+ P("followed by enough cards to make a row of 14.");
+ P(" A moment's reflection will show that this game cannot take");
+ P("more than 13 deals. A good score is 1-3 deals, 4-7 is average,");
+ P("8 or more is poor.");
#undef P
refresh();
}
@@ -230,10 +232,10 @@
grid[dst] = grid[src];
grid[src] = NOCARD;
- move(BASEROW + (dst / GRID_WIDTH) * 2 + 2, (dst % GRID_WIDTH) * 5 + 1);
+ move(BASEROW + (dst / GRID_WIDTH) * 2 + 2, (dst % GRID_WIDTH) * 4 + 1);
printcard(grid[dst]);
- move(BASEROW + (src / GRID_WIDTH) * 2 + 2, (src % GRID_WIDTH) * 5 + 1);
+ move(BASEROW + (src / GRID_WIDTH) * 2 + 2, (src % GRID_WIDTH) * 4 + 1);
printcard(grid[src]);
refresh();
@@ -268,7 +270,7 @@
for (i = 0; i < 4; i++) {
if (selection[i] != NOCARD) {
move(BASEROW + (selection[i] / GRID_WIDTH) * 2 + 3,
- (selection[i] % GRID_WIDTH) * 5);
+ (selection[i] % GRID_WIDTH) * 4);
(void) printw(" %c ", *lp++ = 'a' + i);
}
};
@@ -301,8 +303,8 @@
for (j = 0; j < 4; j++)
if (selection[j] != NOCARD) {
move(BASEROW + (selection[j] / GRID_WIDTH) * 2 + 3,
- (selection[j] % GRID_WIDTH) * 5);
- (void) printw(" ");
+ (selection[j] % GRID_WIDTH) * 4);
+ (void) printw(" ");
}
if (c == 'r')
Modified: trunk/lib/libncurses/test/bs.c
===================================================================
--- trunk/lib/libncurses/test/bs.c 2006-12-24 14:36:33 UTC (rev 1672)
+++ trunk/lib/libncurses/test/bs.c 2007-01-11 22:46:21 UTC (rev 1673)
@@ -48,14 +48,14 @@
/* how to position us on player board */
#define PYBASE 3
-#define PXBASE 3
+#define PXBASE 2
#define PY(y) (PYBASE + (y))
#define PX(x) (PXBASE + (x)*3)
#define pgoto(y, x) (void)move(PY(y), PX(x))
/* how to position us on cpu board */
#define CYBASE 3
-#define CXBASE 48
+#define CXBASE 34
#define CY(y) (CYBASE + (y))
#define CX(x) (CXBASE + (x)*3)
#define CYINV(y) ((y) - CYBASE)
@@ -65,17 +65,17 @@
#define ONBOARD(x, y) (x >= 0 && x < BWIDTH && y >= 0 && y < BDEPTH)
/* other board locations */
-#define COLWIDTH 80
+#define COLWIDTH 64
#define PROMPTLINE 21 /* prompt line */
#define SYBASE CYBASE + BDEPTH + 3 /* move key diagram */
-#define SXBASE 63
+#define SXBASE 52
#define MYBASE SYBASE - 1 /* diagram caption */
-#define MXBASE 64
+#define MXBASE 52
#define HYBASE SYBASE - 1 /* help area */
#define HXBASE 0
/* this will need to be changed if BWIDTH changes */
-static char numbers[] = " 0 1 2 3 4 5 6 7 8 9";
+static char numbers[] = " 0 1 2 3 4 5 6 7 8 9";
static char carrier[] = "Aircraft Carrier";
static char battle[] = "Battleship";
@@ -313,7 +313,7 @@
ship_t *ss;
(void) clear();
- (void) mvaddstr(0, 35, "BATTLESHIPS");
+ (void) mvaddstr(0, (COLWIDTH - 11) / 2, "BATTLESHIPS");
(void) move(PROMPTLINE + 2, 0);
announceopts();
@@ -339,62 +339,60 @@
/* draw empty boards */
(void) mvaddstr(PYBASE - 2, PXBASE + 5, "Main Board");
- (void) mvaddstr(PYBASE - 1, PXBASE - 3, numbers);
+ (void) mvaddstr(PYBASE - 1, PXBASE - 2, numbers);
for (i = 0; i < BDEPTH; ++i) {
- (void) mvaddch(PYBASE + i, PXBASE - 3, (chtype) (i + 'A'));
+ (void) mvaddch(PYBASE + i, PXBASE - 2, (chtype) (i + 'A'));
#ifdef A_COLOR
if (has_colors())
attron(COLOR_PAIR(COLOR_BLUE));
#endif /* A_COLOR */
- (void) addch(' ');
for (j = 0; j < BWIDTH; j++)
(void) addstr(" . ");
#ifdef A_COLOR
attrset(0);
#endif /* A_COLOR */
- (void) addch(' ');
(void) addch((chtype) (i + 'A'));
}
- (void) mvaddstr(PYBASE + BDEPTH, PXBASE - 3, numbers);
- (void) mvaddstr(CYBASE - 2, CXBASE + 7, "Hit/Miss Board");
- (void) mvaddstr(CYBASE - 1, CXBASE - 3, numbers);
+ (void) mvaddstr(PYBASE + BDEPTH, PXBASE - 2, numbers);
+ (void) mvaddstr(CYBASE - 2, CXBASE + 9, "Hit/Miss Board");
+ (void) mvaddstr(CYBASE - 1, CXBASE - 2, numbers);
for (i = 0; i < BDEPTH; ++i) {
- (void) mvaddch(CYBASE + i, CXBASE - 3, (chtype) (i + 'A'));
+ (void) mvaddch(CYBASE + i, CXBASE - 2, (chtype) (i + 'A'));
#ifdef A_COLOR
if (has_colors())
attron(COLOR_PAIR(COLOR_BLUE));
#endif /* A_COLOR */
- (void) addch(' ');
for (j = 0; j < BWIDTH; j++)
(void) addstr(" . ");
#ifdef A_COLOR
attrset(0);
#endif /* A_COLOR */
- (void) addch(' ');
(void) addch((chtype) (i + 'A'));
}
- (void) mvaddstr(CYBASE + BDEPTH, CXBASE - 3, numbers);
+ (void) mvaddstr(CYBASE + BDEPTH, CXBASE - 2, numbers);
(void) mvprintw(HYBASE, HXBASE,
- "To position your ships: move the cursor to a spot, then");
+ "To position your ships: move the cursor to a spot,");
(void) mvprintw(HYBASE + 1, HXBASE,
- "type the first letter of a ship type to select it, then");
+ "then type the first letter of a ship type to");
(void) mvprintw(HYBASE + 2, HXBASE,
- "type a direction ([hjkl] or [4862]), indicating how the");
+ "select it, then type a direction ([hjkl] or");
(void) mvprintw(HYBASE + 3, HXBASE,
- "ship should be pointed. You may also type a ship letter");
+ "[4862]), indicating how the ship should be pointed.");
(void) mvprintw(HYBASE + 4, HXBASE,
- "followed by `r' to position it randomly, or type `R' to");
+ "You may also type a ship letter followed by `r' to");
(void) mvprintw(HYBASE + 5, HXBASE,
- "place all remaining ships randomly.");
+ "position it randomly, or type `R' to place all");
+ (void) mvprintw(HYBASE + 6, HXBASE,
+ "remaining ships randomly.");
(void) mvaddstr(MYBASE, MXBASE, "Aiming keys:");
- (void) mvaddstr(SYBASE, SXBASE, "y k u 7 8 9");
- (void) mvaddstr(SYBASE + 1, SXBASE, " \\|/ \\|/ ");
- (void) mvaddstr(SYBASE + 2, SXBASE, "h-+-l 4-+-6");
- (void) mvaddstr(SYBASE + 3, SXBASE, " /|\\ /|\\ ");
- (void) mvaddstr(SYBASE + 4, SXBASE, "b j n 1 2 3");
+ (void) mvaddstr(SYBASE, SXBASE, "y k u 7 8 9");
+ (void) mvaddstr(SYBASE + 1, SXBASE, " \\|/ \\|/ ");
+ (void) mvaddstr(SYBASE + 2, SXBASE, "h-+-l 4-+-6");
+ (void) mvaddstr(SYBASE + 3, SXBASE, " /|\\ /|\\ ");
+ (void) mvaddstr(SYBASE + 4, SXBASE, "b j n 1 2 3");
/* have the computer place ships */
for (ss = cpuship; ss < cpuship + SHIPTYPES; ss++) {
@@ -493,17 +491,19 @@
turn = rnd(2);
(void) mvprintw(HYBASE, HXBASE,
- "To fire, move the cursor to your chosen aiming point ");
+ "To fire, move the cursor to your chosen aiming ");
(void) mvprintw(HYBASE + 1, HXBASE,
- "and strike any key other than a motion key. ");
+ "point and strike any key other than a motion key. ");
(void) mvprintw(HYBASE + 2, HXBASE,
- " ");
+ " ");
(void) mvprintw(HYBASE + 3, HXBASE,
- " ");
+ " ");
(void) mvprintw(HYBASE + 4, HXBASE,
- " ");
+ " ");
(void) mvprintw(HYBASE + 5, HXBASE,
- " ");
+ " ");
+ (void) mvprintw(HYBASE + 6, HXBASE,
+ " ");
(void) prompt(0, "Press any key to start...", "");
(void) getch();
@@ -1099,13 +1099,13 @@
++cpuwon;
else
++plywon;
- j = 18 + strlen(name);
+ j = 15 + strlen(name);
if (plywon >= 10)
++j;
if (cpuwon >= 10)
++j;
(void) mvprintw(1, (COLWIDTH - j) / 2,
- "%s: %d Computer: %d", name, plywon, cpuwon);
+ "%s: %d Computer: %d", name, plywon, cpuwon);
prompt(2, (awinna())? "Want to be humiliated again, %s [yn]? "
: "Going to give me a chance for revenge, %s [yn]? ", name);
Modified: trunk/lib/libncurses/test/gdc.c
===================================================================
--- trunk/lib/libncurses/test/gdc.c 2006-12-24 14:36:33 UTC (rev 1672)
+++ trunk/lib/libncurses/test/gdc.c 2007-01-11 22:46:21 UTC (rev 1673)
@@ -14,7 +14,7 @@
#include <time.h>
#define YBASE 10
-#define XBASE 10
+#define XBASE 5
#define XLENGTH 54
#define YDEPTH 5
Modified: trunk/lib/libncurses/test/hanoi.c
===================================================================
--- trunk/lib/libncurses/test/hanoi.c 2006-12-24 14:36:33 UTC (rev 1672)
+++ trunk/lib/libncurses/test/hanoi.c 2007-01-11 22:46:21 UTC (rev 1673)
@@ -26,9 +26,9 @@
#define TOPLINE 6
#define BASELINE 16
#define STATUSLINE (LINES-3)
-#define LEFTPEG 19
-#define MIDPEG 39
-#define RIGHTPEG 59
+#define LEFTPEG 12
+#define MIDPEG 32
+#define RIGHTPEG 52
#define LENTOIND(x) (((x)-1)/2)
#define OTHER(a,b) (3-((a)+(b)))
@@ -199,11 +199,11 @@
char TileBuf[BUFSIZ];
erase();
- mvaddstr(1, 24, "T O W E R S O F H A N O I");
- mvaddstr(3, 34, "SJR 1990");
+ mvaddstr(1, 17, "T O W E R S O F H A N O I");
+ mvaddstr(3, 27, "SJR 1990");
mvprintw(19, 5, "Moves : %d", NMoves);
attrset(A_REVERSE);
- mvaddstr(BASELINE, 8,
+ mvaddstr(BASELINE, 1,
" ");
for (Line = TOPLINE; Line < BASELINE; Line++) {
Modified: trunk/lib/libncurses/test/knight.c
===================================================================
--- trunk/lib/libncurses/test/knight.c 2006-12-24 14:36:33 UTC (rev 1672)
+++ trunk/lib/libncurses/test/knight.c 2007-01-11 22:46:21 UTC (rev 1673)
@@ -17,14 +17,14 @@
/* where to start the instructions */
#define INSTRY 2
-#define INSTRX 35
+#define INSTRX 34
/* corner of board */
#define BOARDY 2
#define BOARDX 0
/* notification line */
-#define NOTIFYY 21
+#define NOTIFYY 25
/* virtual color values */
#define TRAIL_COLOR 1
@@ -111,21 +111,27 @@
help1(void)
/* game explanation -- initial help screen */
{
- (void) waddstr(helpwin, "Knight's move is a solitaire puzzle. Your\n");
- (void) waddstr(helpwin, "objective is to visit each square of the \n");
- (void) waddstr(helpwin, "chessboard exactly once by making knight's\n");
- (void) waddstr(helpwin, "moves (one square right or left followed \n");
- (void) waddstr(helpwin, "by two squares up or down, or two squares \n");
- (void) waddstr(helpwin, "right or left followed by one square up or\n");
- (void) waddstr(helpwin, "down). You may start anywhere.\n\n");
+ (void) waddstr(helpwin, "Knight's move is a solitaire\n");
+ (void) waddstr(helpwin, "puzzle. Your objective is to\n");
+ (void) waddstr(helpwin, "visit each square of the\n");
+ (void) waddstr(helpwin, "chessboard exactly once by\n");
+ (void) waddstr(helpwin, "making knight's moves (one\n");
+ (void) waddstr(helpwin, "square right or left followed\n");
+ (void) waddstr(helpwin, "by two squares up or down, or\n");
+ (void) waddstr(helpwin, "two squares right or left\n");
+ (void) waddstr(helpwin, "followed by one square up or\n");
+ (void) waddstr(helpwin, "down).You may start anywhere.\n\n");
- (void) waddstr(helpwin, "Use arrow keys to move the cursor around.\n");
- (void) waddstr(helpwin, "When you want to move your knight to the \n");
- (void) waddstr(helpwin, "cursor location, press <space> or Enter.\n");
- (void) waddstr(helpwin, "Illegal moves will be rejected with an \n");
- (void) waddstr(helpwin, "audible beep.\n\n");
- (void) waddstr(helpwin, "The program will detect if you solve the\n");
- (void) waddstr(helpwin, "puzzle; also inform you when you run out\n");
+ (void) waddstr(helpwin, "Use arrow keys to move the\n");
+ (void) waddstr(helpwin, "cursor around. When you want\n");
+ (void) waddstr(helpwin, "to move your knight to the\n");
+ (void) waddstr(helpwin, "cursor location,press <space>\n");
+ (void) waddstr(helpwin, "or Enter. Illegal moves will\n");
+ (void) waddstr(helpwin, "be rejected with an audible\n");
+ (void) waddstr(helpwin, "beep.\n\n");
+ (void) waddstr(helpwin, "The program will detect if\n");
+ (void) waddstr(helpwin, "you solve the puzzle; also\n");
+ (void) waddstr(helpwin, "inform you when you run out\n");
(void) waddstr(helpwin, "of legal moves.\n\n");
(void) mvwaddstr(helpwin, NOTIFYY - INSTRY, 0,
@@ -136,23 +142,28 @@
help2(void)
/* keystroke help screen */
{
- (void) waddstr(helpwin, "Possible moves are shown with `-'.\n\n");
+ (void) waddstr(helpwin, "Possible moves are shown with `-'.\n");
- (void) waddstr(helpwin, "You can move around with the arrow keys or\n");
- (void) waddstr(helpwin, "with the rogue/hack movement keys. Other\n");
- (void) waddstr(helpwin, "commands allow you to undo moves or redraw.\n");
- (void) waddstr(helpwin, "Your mouse may work; try left-button to\n");
- (void) waddstr(helpwin, "move to the square under the pointer.\n\n");
+ (void) waddstr(helpwin, "You can move around with the\n");
+ (void) waddstr(helpwin, "arrow keys or with the rogue/\n");
+ (void) waddstr(helpwin, "hack movement keys. Other\n");
+ (void) waddstr(helpwin, "commands allow you to undo\n");
+ (void) waddstr(helpwin, "moves or redraw.\n");
+ (void) waddstr(helpwin, "Your mouse may work;try left-\n");
+ (void) waddstr(helpwin, "button to move to the square\n");
+ (void) waddstr(helpwin, "under the pointer.\n\n");
- (void) waddstr(helpwin, "x,q -- exit y k u 7 8 9\n");
- (void) waddstr(helpwin, "r -- redraw screen \\|/ \\|/ \n");
- (void) waddstr(helpwin, "bksp -- undo move h-+-l 4-+-6\n");
- (void) waddstr(helpwin, "a -- autojump /|\\ /|\\ \n");
- (void) waddstr(helpwin, " b j n 1 2 3\n");
+ (void) waddstr(helpwin, "x,q - exit y k u 7 8 9\n");
+ (void) waddstr(helpwin, "r - redraw screen \\|/ \\|/\n");
+ (void) waddstr(helpwin, "bksp - undo move h-+-l 4-+-6\n");
+ (void) waddstr(helpwin, "a - autojump /|\\ /|\\\n");
+ (void) waddstr(helpwin, " b j n 1 2 3\n");
- (void) waddstr(helpwin, "\nYou can place your knight on the selected\n");
- (void) waddstr(helpwin, "square with spacebar, Enter, or the keypad\n");
- (void) waddstr(helpwin, "center key. Use F/B to review the path.\n");
+ (void) waddstr(helpwin, "\nYou can place your knight\n");
+ (void) waddstr(helpwin, "on the selected square with\n");
+ (void) waddstr(helpwin, "spacebar, Enter or the keypad\n");
+ (void) waddstr(helpwin, "center key. Use F/B to\n");
+ (void) waddstr(helpwin, "review the path.\n");
(void) mvwaddstr(helpwin, NOTIFYY - INSTRY, 0,
"Press `?' to go to game explanation");
More information about the dslinux-commit
mailing list