#include<stdlib.h>
#include<time.h>
#include<conio.h>
#include<stdio.h>
#include<bios.h>
#include<string.h>
#include<iostream.h>


int main(void)
{

char buffer[100], ch = '1', gr[8];
long ranx, t;
FILE *fp, *np;
long m, x;
int hc, wc, index, ran, ranh, n, h, u, r;
gr[0] = 'N';
gr[8] = 'Y';


randomize();
ranx = (rand () % 31101) + 1;

fp = fopen("c:\\thebible\\thebible.doc", "rt");
np = fopen("c:\\thebible\\jonny.doc", "rb");       //, "w+b");

//                fseek(fp, 0, SEEK_SET);
//                m = ftell(fp);
//                fwrite(&m, sizeof(long), 1, np);

//                for(t = 1;t <= 31102;)
//                        {
//                        fgets(buffer, 100, fp);
//                        if(buffer[0] == 10)
//                                {
//                                m = ftell(fp);
//                                fwrite(&m , sizeof(long), 1, np);
//                                t++;
//                                }
//                        }

clrscr();
struct text_info ti;
gettextinfo(&ti);
gotoxy(1, ti.screenheight/3);
_setcursortype(_NOCURSOR);


cprintf("Get a random-number-generator-inspired  passage from Scripture.\r\n");
cprintf("For successive random verses, press spacebar.  For a random-number-\r\n");
cprintf("generator-inspired Yes or No answer to questions, press Enter.\r\n");
cprintf("To quit, press q.\r\n");
cprintf("\r\nTo start, press spacebar. \r\n");
ch = bioskey(0);

clrscr();

hc = ti.screenheight*3/4;
wc = ti.screenwidth/2;
r = 1;

while(ch != 'q')
{
if(r == 1)
goto a;

if(ch == 13)
{
a: r = 2;
ranh = rand () % 9;
ran = ranh;
gotoxy(1, hc+4);
for(index = 1; index < 8; index++)
gr[index] = 254;
gotoxy(wc-4, hc);
for(index = 0; index < ranh; index++)
{
textcolor(15);
cprintf("%c", gr[index]);
}
for(index = ran; index == ran; ran++)
{
textcolor(4);
cprintf("%c", gr[ranh]);
}
for(index = ranh+1; index < 9; index++)
{
textcolor(15);
cprintf("%c", gr[index]);
}
textcolor(7);
}


if(ch == 32)
{
gotoxy(1, ti.screenheight/4);
ranx = (rand() % 31101) + 1;
x = (ranx-1)*4;
fseek(np, x, SEEK_SET);
fread(&m, 4, 1, np);
fseek(fp, m, SEEK_SET);
h=1;
while(strlen(fgets(buffer, 100, fp)) > 2)
        {
        textcolor(7);
        printf("%s", buffer);
        h++;
        }
}
ch = bioskey(0);
if(ch == 32)
{
gotoxy(1, ti.screenheight/4);
for(u=0; u<h; u++)
        {
        gotoxy(1, ti.screenheight/4 + u);
        clreol();
        }
}
}
fclose(fp);
fclose(np);
clrscr();
textcolor(7);
exit(0);
}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

DIRECTIONS:

To install Random Verse Generator on newer computers:

1.Download http://www.stonetabernacle.com/files/thebible.zip

2.unzip thebible.zip Take note of where the files are saved.

3.Open Windows Explorer

4.Create the directory C:\thebible\

5.Copy and paste the three unzipped files into this directory:

thebible.doc
jonny.doc
bibl92.exe

These three files must be in the same directory for the program to run.

6.Download DOSBox from
http://www.dosbox.com/download.php?main=1

7. click Start, All Programs, DOSBox0.74, Options, DOSBox0.74 Options,

8.Enter the following under [sdl] and [autoexec] in the DOSBox configuration file:


[sdl]
fullscreen=true

[autoexec]
mount c c:\thebible\
c:
bibl92.exe

9.save and exit

10.Click on DOSBox and the program will start itself.

*press spacebar to generate a random Bible verse
*press Enter to generate a random Yes/No answer (and the spectrum in between)
*press q to quit
*press Alt+Enter to exit full screen mode.

For older computers follow 1. to 5. and click on bibl92.exe to start program.

Programming Directions: (Optional) :

Open
THEBIBLE.DOC and save it as, C:\thebible\THEBIBLE.DOC

Open
JONNY.DOC and save it as, C:\thebible\JONNY.DOC

REPLACE THE LINE,

np = fopen("c:\\thebible\\jonny.doc", "rb");       //, "w+b");

with

np = fopen("c:\\thebible\\jonny.doc", "w+b");

remove the rest of the "\\" (comment delimiters only, not in fp and np)

compile and run the program BIBL91.EXE

restore all "\\" as they were before.

compile and run the program BIBL92.EXE

THIS PROGRAM RANDOMLY DISPLAYS ONE OF THE BIBLE'S 31,102 VERSES AND DISPLAYS A RANDOM
YES/NO GENERATOR WHEN THE SPACEBAR OR ENTER KEYS ARE PRESSED.  THIS WAS CREATED IN 1995 SO
IT ONLY WORKS ON OLDER PC'S.

MECHANISM:

THE PROGRAM ANALYZES THEBIBLE.DOC AND SAVES FORMATTING INFORMATION IN IT IN JONNY.DOC.  
USING THIS INFORMATION THE PROGRAM THEN SEARCHES FOR THE RANDOM BIBLE VERSE SELECTED AND
DISPLAYS IT.  A SEPARATE RANDOMIZING FUNCTION DISPLAYS THE YES/NO OUTPUT.  JONNY.DOC
CONTAINS DATA ABOUT WHITE SPACE,NEWLINES AND TEXT IN THEBIBLE.DOC AND USES IT TO POINT TO
THE CALCULATED RANDOM VERSE. IT IS GENERALLY UNREADABLE AND IS ONLY USED AS SUPPLEMENTAL
PROGRAM DATA FOR BIBL92.EXE  JONNY.DOC ONLY NEEDS TO BE MADE ONCE.

COMPILED AND RUN WITH BORLAND C++,
intrepid@bellaire.tv

The Bible
IMPROVEMENTS:

Some word processing is needed in the display of the verses so words don't get
chopped off at the end of the line.

The verses might be grouped into coherent concepts and randomly displayed into small
lessons, possibly with the ability to display the verse before and the verse after the
random verse to put it in context.  The verse(s) may also be supplemented with a
meditation/prayer.

The words of God/Jesus might be displayed in red.  There may be an option to display
only random verses containing the words of God/Jesus.

The text may be read, spoken and crafted into a telephone message for callers to hear
their daily random scripture and meditation, and select more random readings if they
choose.
© 2014 Jon L. Giffen

home