summaryrefslogtreecommitdiffstats
path: root/cddl/contrib/dtracetoolkit/Examples/guess_example.txt
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/contrib/dtracetoolkit/Examples/guess_example.txt')
-rw-r--r--cddl/contrib/dtracetoolkit/Examples/guess_example.txt39
1 files changed, 39 insertions, 0 deletions
diff --git a/cddl/contrib/dtracetoolkit/Examples/guess_example.txt b/cddl/contrib/dtracetoolkit/Examples/guess_example.txt
new file mode 100644
index 0000000..74be8b3
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Examples/guess_example.txt
@@ -0,0 +1,39 @@
+The following is a demonstration of the guess.d script,
+
+
+guess.d is a guessing game written in DTrace. It goes like this,
+
+ # ./guess.d
+ guess.d - Guess a number between 1 and 100
+
+ Enter guess 1: 50
+ Lower...
+ Enter guess 2: 25
+ Higher...
+ Enter guess 3: 37
+ Higher...
+ Enter guess 4: 44
+ Higher...
+ Enter guess 5: 48
+ Lower...
+ Enter guess 6: 46
+ Lower...
+ Enter guess 7: 45
+ Correct! That took 7 guesses.
+
+ Please enter your name: Brendan Gregg
+
+ Previous high scores,
+ Fred Nurk 7
+ Brendan Gregg 7
+
+It was written as a demonstration of the same code written in dozens of
+languages. It makes a good demonstration, as it covers integer and string
+variables, conditional statements, loops, keyboard input, screen output,
+and file input and output.
+
+Written in DTrace however, is not such a good demonstration! DTrace doesn't
+have loops (it doesn't really need them either) which made the code a
+little odd. DTrace also doesn't have keyboard input... So this script is
+somewhat amusing as an example, but not terribly useful.
+
OpenPOWER on IntegriCloud