Version 2 of Hamurabi.tcl Text Adventure Game and TCL Demo Example

Updated 2020-10-08 20:03:40 by gold

Hamurabi.tcl Text Adventure Game and TCL Demo Example

This page is under development. Constructive comments are welcome, but please load any constructive comments in the comments section at the bottom of the page. Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Aside from your courtesy, your wiki MONIKER and date as a signature and minimal good faith of any internet post are the rules of this TCL-WIKI. Its very hard to reply reasonably without some background of the correspondent on his WIKI bio page. Thanks, gold 08Jul2020


Preface


gold Here are some TCL calculations for.


Introduction

The


From the references, .






Procedures


In the




Pseudocode Section

   
            # end of file, pseudocode:

 

Testcases Section

In planning any software, it is advisable to gather a number of testcases to check the results of the program. The math for the testcases can be checked by pasting statements in the TCL console. Aside from the TCL calculator display, when one presses the report button on the calculator, one will have console show access to the capacity functions (subroutines).


Testcase 1 , !st right sided trapezoid


The


Testcase 2 , d



Testcase 3 , B


The following scenari


Testcase 4 ,

Testcase 5 ,


The following scenario was used for the _th testcase.


Testcase 6 , e



The following scenario was used for the 6th testcase. There is Astrology software available to derive some testcases from modern numbers. It turns out that the year 2020 offers an interesting retrograde of Jupiter in astrology.



Screenshots Section


figure 1a.


bablylonian_trapezoid_cal

figure 1b. Babylonian Astronomy Trapezoid Area Concept & Formulas


bablylonian_trapezoid

figure 1c. Previous sample of vaporware

Babylonian Square rule for Trapezoid Area png panel

figure 1d., previous sample vaporware

Babylonian Square Side Rule png

figure 2.

Babylonian Square rule for Trapezoid Area png printout

figure 3.

Babylonian Square rule for Trapezoid Area png more concept

figure 4.

Babylonian Square rule for Trapezoid Area png concept

figure 5.

Babylonian Combined Market Rates png trapezoidal prism concept diagram 3

figure 6.

Babylonian Combined Market Rates png concept diagram 2

figure 7.

Babylonian Square rule for Trapezoid Area png geometry grid overlay

figure 8.

Babylonian Square rule for Trapezoid Area png geometric figure trapeziod band

figure 9.

Babylonian Trapezoid Bisection Algorithm and eTCL demo small scale fields png

figure 10.

Babylonian Trapezoid Bisection Algorithm large scale fields

figure 11.

Babylonian Trapezoid Bisection Algorithm and eTCL demo smallest plots png


figure 12.Babylonian_zigzag_function_for_full_moon_eclipses

Babylonian_moon_zigzag

figure 13.Babylonian_step_function_for_full_moon_eclipses

Babylonian_moon2

figure 14.Babylonian_step_functions_with_quadratic_zigzags_overlay_for_Jupiter_occultation_of_star

Babylonian_Expansion_jupiter

figure 15.Babylonian_Expansion_Procedure_120_day_chart

Babylonian_Expansion_Procedure_120_day_chart

figure 16.Contrast in 2 Different Prediction Algorithms (meaning, 2 possibilities)

Babylonian_Expansion_Procedure_Jupiter_velocity


figure 16.quadratic_regression

          0               0.2           
         60               0.1583      
        120               0.0250    

Babylonian_Expansion_quadratic_regression_correction


figure 17.image of Jupiter taken by NASA's Hubble Space Telescope


Babylonian_Expansion_Procedure_image_Jupiter_NASA


References:


More References



Table, Math Terms Associated with Babylonian Trapezoids

Table , Math Terms Associated with Babylonian Trapezoids printed in tcl formatmodern equivalent, English comment if any
sag ki.gu : side earth trapezoid
sag ki.ta : side earth its , possessive case upper front of the trapezoid
sag an.na :side upper upper front of the trapezoid
us gi.na : length front true length of the trapezoid
sag gi.na : side front true front of trapezoid
N1 kus i-ku-lu : N1 cubit in eats it (it or man), read left to right feed parameter of the trapezoid noun derived from Sumerian SOV phrase
sag du : side triangle
N1 arakarum : N1 multiply transformation coefficient, usually scale up

Note. These Math Terms cover 4 or 5 cuneiform languages, and 5000 years of history. Math Terms are best understanding of context and math connotation here,not blessed by linguists and cuneiform dictionaries.



Appendix Code

appendix TCL programs and scripts


       # pretty print from autoindent and ased editor
        # Babylonian Astronomy Trapezoid Area  V2
        # written on Windows 10 on TCL
        # working under TCL version 8.6
        # gold on  TCL Club, 4Jul2020
        package require Tk
        package require math::numtheory
        namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory }
        set tcl_precision 17
        frame .frame -relief flat -bg aquamarine4
        pack .frame -side top -fill y -anchor center
        set names {{} {side height1 , degrees per day:} }
        lappend names {side height2 , degrees per day:}
        lappend names {base line length1, days: }
        lappend names {base line length2, days: }
        lappend names { answers, bisection velocity_c degrees per day:}
        lappend names { bisection, half area displacement degrees:}
        lappend names { bisection_time_c  days:}
        lappend names { area displacement degrees:}
        foreach i {1 2 3 4 5 6 7 8} {
            label .frame.label$i -text [lindex $names $i] -anchor e
            entry .frame.entry$i -width 35 -textvariable side$i
            grid .frame.label$i .frame.entry$i -sticky ew -pady 2 -padx 1 }
        proc about {} {
            set msg "Calculator for Babylonian Astronomy Trapezoid Area  V2
            from TCL ,
            # gold on  TCL Club, 10Jul2020 "
            tk_messageBox -title "About" -message $msg }
        proc self_help {} {
            set msg "Calculator for Babylonian Astronomy Trapezoid Area V2
            from TCL ,
            # self help listing
            # 4 givens follow.
            1) side height1 , degrees per day
            2) side height2 , degrees per day
            3) base line length1, days 
            4) base line length2, days
            The solution from the clay tablets
            is genuine antique method from 1600 BCE
            and different looking from modern math methods.
            # The Babylonians did not use modern algebraic notation,
            # so the reader will have to bear some anachronisms in the TCL code.
            # Comparing conventional formula(s) for trapezoid area
            # to Babylonian square rule for trapezoid area.
            # For comparison, code will include redundant paths & formulas
            # to compute trapezoid area. The calculator uses modern
            # units  for convenience to modern users and textbooks.
            # Any convenient and consistent in/output units might be used
            # like inches, feet, nindas, cubits, or dollars to donuts.
            # Equations
            1) median = .5*(l+s)                        conventional
            2) trapezoid area = .5*(l+s)*h              conventional
            3) feed = (l-s)/h                           trapezoid_area_sq_law
            4) h = (l-s)/f                              trapezoid_area_sq_law
            5) trapezoid area = (l**2-s**2)/(2.*feed)   trapezoid_area_sq_law
            # Also, the B. square rule for trapezoid area
            # was extended to volumes by *width.
            6) trapezoidal volume = .5*(l+s)*h*w              conventional
            7) trapezoidal volume = w*(l**2-s**2)/(2.*feed)   trapezoid_area_sq_law
            # Recommended procedure is push testcase and fill frame,
            # change first three entries etc, push solve,
            # and then push report. Report allows copy and paste
            # from console to conventional texteditor. For testcases
            # testcase number is internal to the calculator and
            # will not be printed until the report button is pushed
            # for the current result numbers.
            # This posting, screenshots, and TCL source code is
            # copyrighted under the TCL/TK 8.6 license terms.
            # Editorial rights retained under the TCL/TK license terms
            # and will be defended as necessary in court.
            Conventional text editor formulas or  grabbed from internet
            screens can be pasted into green console.
            Try copy and paste following into green screen console
            set answer [* 1. 2. 3. 4. 5. ]
            returns  120
            # gold on  TCL Club, 10jul2020 "
            tk_messageBox -title "About" -message $msg }
        # following proc is  not used now
        proc trapezoid_solution { long_side short_side feed width} {
            global trapezoid_area height_calc feed_calc median trapezoidal_vol
            set median [* .5 [+ $long_side $short_side ]]
            set height_calc [/ [- $long_side $short_side] $feed ]
            set trapezoid_area [/ [- [* $long_side $long_side] [* $short_side $short_side] ] [* 2. $feed ] ]
            set trapezoidal_vol [* $width [/ [- [* $long_side $long_side] [* $short_side $short_side] ] [* 2. $feed ] ]]
            set feed_calc [ expr {  ($long_side-$short_side)/ $height_calc } ]
            puts "  check  $long_side $short_side $feed height_calc= $height_calc area= $trapezoid_area feed= $feed_calc  "
            return $trapezoid_area  }
        proc calculate {     } {
            global answer2
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global testcase_number
            incr testcase_number
            set side1 [* $side1 1. ]
            set side2 [* $side2 1. ]
            set side3 [* $side3 1. ]
            set side4 [* $side4 1. ]
            set side5 [* $side5 1. ]
            set side6 [* $side6 1. ]
            set side7 [* $side7 1. ]
            set side8 [* $side8 1. ]
            set side5 1.
            set side6 1.
            set side7 1.
            set side8 1.
            set velocity_0 $side1
            set velocity_1 $side2
            set base_line [ expr { abs (  $side4 - $side3 )} ]
            set calculation_1 [ expr { .5 * ( $side1 + $side2 ) * 60. } ]
            set bisection_1 [ expr { .5 * $calculation_1 } ]
            set bisection_velocity_c [ expr {  ((($velocity_0)**2 +($velocity_1)**2)/2.)**.5 }]
            set bisection_time_c [ expr { $base_line * (  $velocity_0 -  $bisection_velocity_c  ) /  ( $velocity_0 -  $velocity_1  )  }]
            set side5 $bisection_velocity_c
            set side6 $bisection_1
            set side7 $bisection_time_c
            set side8 $calculation_1
        }
        proc fillup {aa bb cc dd ee ff gg hh} {
            .frame.entry1 insert 0 "$aa"
            .frame.entry2 insert 0 "$bb"
            .frame.entry3 insert 0 "$cc"
            .frame.entry4 insert 0 "$dd"
            .frame.entry5 insert 0 "$ee"
            .frame.entry6 insert 0 "$ff"
            .frame.entry7 insert 0 "$gg"
            .frame.entry8 insert 0 "$hh"
        }
        proc clearx {} {
            foreach i {1 2 3 4 5 6 7 8 } {
                .frame.entry$i delete 0 end } }
        proc reportx {} {
            global side1 side2 side3 side4 side5
            global side6 side7 side8
            global testcase_number
            console show;
            console eval {.console config -bg palegreen}
            console eval {.console config -font {fixed 20 bold}}
            console eval {wm geometry . 40x20}
            console eval {wm title . " Babylonian Astronomy Trapezoid  V2 Report , screen grab and paste from console 2 to texteditor"}
            console eval {. configure -background orange -highlightcolor brown -relief raised -border 30}
            puts "%|table $testcase_number|printed in| tcl format|% "
            puts "&| quantity| value| comment, if any|& "
            puts "&| $testcase_number:|testcase_number | |&"
            puts "&| $side1 :|side height1 , degrees per day: |   |&"
            puts "&| $side2 :|side height2 , degrees per day: | |& "
            puts "&| $side3 :|base line length1, days: | |& "
            puts "&| $side4 :|base line length2, days: | |&"
            puts "&| $side5 :|answers, bisection velocity_c degrees per day:| |  |&"
            puts "&| $side6 :|bisection, half area displacement degrees:| |  |&"
            puts "&| $side7 :|bisection_time_c days:| |  |&"
            puts "&| $side8 :|area displacement degrees:| |  |&"
            
        }
        frame .buttons -bg aquamarine4
        ::ttk::button .calculator -text "Solve" -command { calculate   }
        ::ttk::button .test2 -text "Testcase1" -command {clearx;fillup 0.2 0.1583 0.  60.  0.1803 5.3745  28.2601  10.75 }
        ::ttk::button .test3 -text "Testcase2" -command {clearx;fillup 0.1583 0.0250  60.  120.  5.5 2.74949  20.2450  5.5 }
        ::ttk::button .test4 -text "Testcase3" -command {clearx;fillup 0.2 0.0250 0.  120.  0.1425 3.375  39.4135  6.75  }
        ::ttk::button .clearallx -text clear -command {clearx }
        ::ttk::button .about -text about -command {about}
        ::ttk::button .self_help -text self_help -command {self_help}
        ::ttk::button .console2 -text report -command { reportx }
        ::ttk::button .exit -text exit -command {exit}
        pack .calculator  -in .buttons -side top -padx 10 -pady 5
        pack  .clearallx .console2 .self_help .about .exit .test4 .test3 .test2   -side bottom -in .buttons
        grid .frame .buttons -sticky ns -pady {0 10}
        . configure -background aquamarine4 -highlightcolor brown -relief raised -border 30
        wm title . "Babylonian Astronomy Trapezoid Area  V2"
        # gold on TCL Club, 8Jul2020
        # This posting, screenshots, and TCL source code is
        # copyrighted under the TCL/TK 8.6 license terms.
        # Editorial rights retained under the TCL/TK license terms
        # and will be defended as necessary in court.
        # end of file

Pushbutton Operation

For the push buttons, the recommended procedure is push testcase and fill frame, change first three entries etc, push solve, and then push report. Report allows copy and paste from console.

For testcases in a computer session, the eTCL calculator increments a new testcase number internally, eg. TC(1), TC(2) , TC(3) , TC(N). The testcase number is internal to the calculator and will not be printed until the report button is pushed for the current result numbers. The current result numbers will be cleared on the next solve button. The command { calculate; reportx } or { calculate ; reportx; clearx } can be added or changed to report automatically. Another wrinkle would be to print out the current text, delimiters, and numbers in a TCL wiki style table as

  puts " %| testcase $testcase_number | value| units |comment |%"
  puts " &| volume| $volume| cubic meters |based on length $side1 and width $side2   |&"  

Console program under test.


gold This page is copyrighted under the TCL/TK license terms, this license .

Hidden Comments Section

Please place any comments here, Thanks.