LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > peonuser
User Name
Password

Notices


Rate this Entry

The future?

Posted 11-22-2010 at 01:36 AM by peonuser
Updated 11-24-2010 at 08:21 PM by peonuser

Oracle: a silly command line game in bash. Nothing to do with the company. I like to use the pc subroutine as it makes it easy to place text on the screen where one wants. If you set your screen to boot in a higher resolution than normal, you can put a large amount of data on the screen in real time and do it without worrying about scrolling. In the process of writing a spreadsheet, editor and database with bash. Oracle (remember chmod +x oracle)
Code:
####################################
# The oracle
#
#===============================
# Functions
#--------------------------------
# pc = position cursor
function pc () {
tput cup $1 $2
}

function header () {
clear
pc 2 10 ; echo "The Oracle"
}

function footer() {
pc 24 0
}

# end functions
#=================================
# Assignments
# --------------------------------
datafile="odata"
pay=5
a=1
m="not done"
d=" "
# end assignments

#=================================
#
# Data input
#---------------------------------
while read line
do fdata[$a]=$line
let a=a+1
done < $datafile

#===================================
# local variables
#--------------------------------
let nodf=$a
declare -i X=$nodf
# NUM=$[ ( $RANDOM % $X ) + 1 ]
#====================================
# Header
#-----------------------------------
header
#=====================================
# Begin logic
#--------------------------------------
while true; do
let turns=turns+1
clear
pc 4 1
echo " T H E  O R A C L E !"
pc 25 2
echo "Peonuser:(c) 1980 - 2010"
pc 7 1
echo "Please enter your question "
pc 8 1
echo "["
pc 8 2
read q
pc 10 1
echo "The Oracle will show you it's thoughts, then summon your answer."
pc 12 1
echo "So please be patient!"
pc 15 1
echo "***********************************************************************"
pc 16 1
# may have to add spaces
echo "*                                                                     *"
pc 17 1
echo "***********************************************************************"
for (( y = 1;y<=100;y+=1));do
pc 16 1
# may have to add spaces
echo "*                                                                     *"
pc 16 3
NUM=$[ ( $RANDOM % $X ) + 1 ]
echo ${fdata[$NUM]}
done

pc 18 1
echo "Play again (Y/n)"
read -s -n1 d
echo
case $d in
[nN] ) break ;;
esac

done
let owed=$pay*$turns
echo "Please pay the cashier $owed dollars!"
read
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# end of job:
echo
clear
pc 4 1
echo " T H E O R A C L E !"
pc 23 1
echo "Peonuser: (c) 1980 - 2010"
pc 6 1
echo
echo "If you use this program more than several times and would like"
echo "to see more programs like the Oracle and the Cartomancer, please"
echo "let the author know!"
echo

# END
# end logic
#-----------------------------------
# footer
footer
#===================================
# End.
####################################
odata (Data file for oracle)

[data]
Yes, if you are creative.
Hold that thought and let me get back to you.
Anything is possible, but you will have a difficult start.
What a youthful folly to ask!
You must wait and ask again.
Only conflict will come of the result, please pray.
It will take many who are organized to accomplish your request.
Yes, if you keep it together.
Be meek and you will get your answer.
You are lucky to get this far!
You must have the fellowship of men.
In great measure will the possession result.
One must be modest to attain their goal.
You will do good to have enthusiasm for your quest.
Let someone else take the lead to your quest.
Atone for what has been spoiled, then reask your question.
You are too far away to get the answer.
Meditation will lead you to your answer.
Bite through to your goal.
If you handle life with grace!
There is to be a coming apart for fate to be realized.
All must return to what is.
Not knowing the true answer will be better.
You must tame the power of the great.
Watch the corners of the mouth.
The greatest preponderance will be fate.
It will be the abysmals, sorry!
You will be lucky to hold on to what you have.
Influence will be the steeping stone to your quest.
Just be patient for a while.
It is a time for getting away.
The power of the great is upon you.
Yes, there is a progression to be attained.
The crystal ball is losing light and no answer may be attained now.
Everyone close will be part of your answer.
No, there is too much opposition.
Not likely, there are obstructions in the way.
Yes, deliverance will come.
Not as much as you might as supposed.
Yes and more than was planned.
Yes, if there is a breakthrough.
Maybe if you come to meet.
Now is the time to gather together for the answer.
Yes, only if there is a push upward.
No, oppression will stop your quest.
Yes, no, and maybe.......
What the oracle says is opposite to your true answer.
The answer will take longer and you will pay for the wait.
Only through an arousing!
It is not time for a move, you must keep still.
Let fate develop as it will.
You must see the marrying maiden first.
More than you ever imagined.
You may wonder and wander, but it is time to move.
Only if you act gently.
Yes, with great joy!
No, so you must let go of it to spread out.
Only with limitations.
Look within yourself and you can find the answer.
Only with preponderance of the small.
It will come to be after completion.
Only before completion.
I love Elizabeth!
Only God knows...
[/data]
Posted in Uncategorized
Views 947 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 01:42 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration