jeff@hpcnoa.UUCP (jeff) (08/13/85)
The following is NOT a game, but an aid for the game "RAIL BARON." It provides the Payoff chart for the players. Ideally, this aid should be put on a lap-portable, where it won't get in the way of the game (I rewrote it in BASIC and put it on a hp75CX). The table has been spot checked, but not thoroughly checked for accuracy. -- Jeff Wu {ihnp4|hplabs}!hpfcla!hpcnoe!j_wu
jeff@hpcnoa.UUCP (jeff) (08/13/85)
/* * lookup the trip cost between two cities for Rail Baron * 8/8/85 Jeff Wu */ #include <ctype.h> #include <stdio.h> struct cityinfostruct { char * abbrev; char * name; short index; /* city index to the payoff chart */ } cityinfo[] = { "al", "Albany", 1, "at", "Atlanta", 10, "ba", "Baltimore", 2, "bil", "Billings", 48, "bir", "Birmingham", 29, "bo", "Boston", 3, "buf", "Buffalo", 4, "but", "Butte", 49, "ca", "Casper", 50, "charle", "Charleston", 11, "charlo", "Charlotte", 12, "chat", "Chattanooga", 13, "chi", "Chicago", 21, "ci", "Cincinnati", 22, "cl", "Cleveland", 23, "co", "Columbus", 24, "da", "Dallas", 30, "den", "Denver", 40, "des", "Des Moines", 41, "det", "Detroit", 25, "e", "El Paso", 57, "fa", "Fargo", 42, "fo", "Fort Worth", 31, "h", "Houston", 32, "i", "Indianapolis", 26, "j", "Jacksonville", 14, "ka", "Kansas City", 43, "kn", "Knoxville", 15, "la", "Las Vegas", 58, "li", "Little Rock", 33, "los", "Los Angeles", 59, "lou", "Louisville", 34, "me", "Memphis", 35, "mia", "Miami", 16, "mil", "Milwaukee", 27, "min", "Minneapolis", 44, "mo", "Mobile", 17, "na", "Nashville", 36, "newo", "New Orleans", 37, "newy", "New York", 5, "no", "Norfolk", 18, "ny", "New York", 5, "oa", "Oakland", 60, "ok", "Oklahoma City", 45, "om", "Omaha", 46, "phi", "Philadelphia", 6, "pho", "Phoenix", 61, "pi", "Pittsburgh", 7, "poc", "Pocatello", 51, "portlandm", "Portland Me", 8, "portlando", "Portland Ore", 52, "pm", "Portland Me", 8, "po", "Portland Ore", 52, "pu", "Pueblo", 47, "ra", "Rapid City", 53, "re", "Reno", 62, "ri", "Richmond", 19, "sac", "Sacramento", 63, "sal", "Salt Lake City", 54, "sana", "San Antonio", 38, "sand", "San Diego", 64, "sanf", "San Francisco", 60, "sd", "San Diego", 64, "sf", "San Francisco", 60, "se", "Seattle", 55, "sh", "Shreveport", 39, "sp", "Spokane", 56, "stl", "St Louis", 28, "stp", "St Paul", 44, "ta", "Tampa", 20, "tu", "Tucumcari", 65, "w", "Washington", 9, }; /* * Lower triangular (no center diagonal) sparse matrix * of the payoffs */ float payoff[2080] = { 3.5, 2.0, 4.0, 3.0, 4.0, 5.0, 1.5, 2.0, 2.5, 4.0, 2.5, 1.0, 3.0, 4.0, 1.0, 5.5, 3.5, 6.5, 2.5, 4.5, 3.5, 3.0, 5.5, 1.0, 6.0, 3.5, 4.5, 8.0, 3.5, 0.5, 4.5, 4.5, 2.0, 1.5, 3.0, 5.5, 10.0, 7.0, 11.0, 9.5, 8.5, 7.5, 8.0, 12.0, 6.5, 9.5, 5.5, 9.5, 9.5, 7.5, 8.0, 8.0, 11.0, 5.0, 3.0, 7.5, 4.0, 8.5, 8.0, 6.0, 5.0, 6.0, 9.5, 4.0, 2.5, 2.5, 10.0, 6.5, 11.5, 8.0, 8.5, 7.5, 7.0, 12.0, 6.0, 1.5, 4.5, 4.0, 11.0, 8.0, 12.0, 12.0, 10.0, 9.0, 10.5, 13.0, 6.0, 3.5, 2.5, 4.0, 5.0, 8.5, 5.5, 9.5, 7.5, 7.5, 6.5, 6.0, 10.5, 5.0, 2.0, 4.0, 2.5, 1.0, 5.5, 15.0, 11.5, 16.0, 15.5, 13.5, 12.5, 14.0, 17.0, 11.0, 7.0, 6.0, 7.5, 8.5, 3.0, 9.0, 13.5, 10.5, 14.5, 12.0, 12.0, 11.0, 10.5, 14.5, 10.0, 3.5, 6.0, 6.0, 5.0, 4.0, 5.5, 8.5, 6.0, 2.5, 7.0, 6.5, 4.5, 3.5, 5.0, 8.0, 2.5, 5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, 20.0, 10.5, 12.5, 13.5, 13.0, 13.0, 11.5, 10.5, 9.0, 13.5, 8.5, 8.5, 11.0, 11.0, 12.0, 11.0, 12.5, 13.5, 11.0, 10.0, 12.0, 11.5, 14.0, 9.0, 12.5, 11.5, 8.5, 15.0, 11.0, 9.5, 13.0, 11.5, 8.0, 13.0, 9.0, 16.5, 10.0, 13.0, 12.0, 14.5, 3.5, 6.5, 7.0, 7.0, 6.5, 5.5, 3.5, 3.5, 8.0, 7.5, 7.5, 10.0, 7.0, 6.0, 6.5, 6.5, 10.5, 10.0, 8.0, 7.0, 14.5, 14.5, 16.5, 11.5, 15.5, 14.5, 11.0, 17.5, 14.0, 13.5, 16.5, 15.0, 12.5, 17.0, 12.0, 21.0, 14.5, 16.0, 15.0, 19.0, 6.5, 6.0, 10.0, 9.5, 9.0, 8.0, 5.5, 8.0, 13.0, 12.5, 12.5, 15.0, 12.0, 9.5, 11.0, 11.0, 15.0, 15.0, 13.0, 11.5, 5.0, 12.5, 12.0, 14.5, 9.5, 13.5, 12.0, 9.0, 16.0, 11.5, 9.0, 12.0, 11.0, 7.5, 11.5, 8.0, 15.5, 8.5, 13.0, 12.0, 13.5, 4.5, 6.0, 8.0, 6.5, 7.0, 5.0, 5.5, 3.0, 7.5, 5.0, 5.0, 8.0, 5.0, 5.5, 5.0, 6.0, 8.5, 8.0, 5.5, 6.5, 2.0, 7.0, 12.5, 12.0, 14.0, 9.0, 13.0, 12.0, 8.5, 15.5, 11.5, 11.5, 14.0, 12.5, 10.0, 15.0, 9.5, 18.5, 12.5, 13.5, 12.5, 16.5, 4.0, 7.0, 7.5, 7.5, 6.5, 6.0, 3.5, 5.5, 10.5, 10.0, 10.0, 12.5, 9.5, 7.0, 9.0, 8.5, 12.5, 12.5, 8.0, 9.0, 2.5, 2.5, 5.0, 15.5, 14.5, 17.5, 12.5, 16.0, 15.0, 11.5, 18.5, 14.0, 9.0, 12.0, 11.5, 9.0, 12.0, 9.0, 15.5, 8.0, 15.0, 14.0, 13.5, 8.0, 9.0, 10.5, 10.0, 10.5, 7.5, 8.5, 5.5, 7.5, 2.5, 2.5, 5.0, 3.5, 8.5, 5.0, 7.5, 7.5, 5.0, 10.5, 7.5, 5.5, 10.5, 3.5, 8.0, 13.0, 13.0, 15.0, 10.0, 14.0, 13.0, 9.5, 16.0, 12.5, 10.0, 13.5, 12.5, 9.0, 13.5, 9.5, 17.0, 10.5, 14.0, 13.5, 15.0, 5.0, 7.5, 8.5, 8.0, 7.5, 6.5, 5.0, 4.0, 9.0, 7.0, 7.0, 9.5, 7.0, 7.0, 6.5, 7.5, 10.5, 10.0, 7.5, 5.5, 1.5, 6.0, 2.0, 3.5, 5.5, 18.5, 18.0, 21.0, 15.5, 19.5, 18.5, 15.0, 22.0, 18.0, 15.0, 18.5, 18.0, 14.0, 18.0, 14.5, 21.5, 14.0, 19.0, 18.5, 20.0, 10.5, 12.5, 13.5, 13.0, 13.0, 11.5, 11.5, 9.0, 13.5, 7.5, 7.5, 10.0, 10.0, 12.0, 11.0, 12.5, 13.5, 9.5, 10.0, 1.0, 7.0, 12.5, 6.0, 9.5, 7.0, 5.5, 21.0, 21.0, 23.0, 18.0, 22.0, 21.0, 17.5, 24.0, 20.5, 19.0, 22.5, 21.0, 18.0, 22.5, 18.5, 26.0, 19.0, 22.0, 21.5, 24.0, 13.0, 15.5, 16.0, 16.0, 15.5, 14.5, 12.0, 13.0, 18.0, 15.0, 15.0, 17.5, 15.5, 16.0, 15.5, 16.5, 19.0, 17.5, 16.0, 6.5, 10.5, 6.5, 10.5, 9.0, 14.0, 9.0, 7.5, 23.5, 23.0, 25.5, 20.5, 24.0, 23.5, 20.0, 26.5, 22.5, 21.5, 26.0, 17.5, 14.0, 24.5, 21.0, 28.5, 21.0, 25.0, 23.5, 26.5, 15.0, 18.0, 18.5, 18.5, 18.0, 17.0, 14.5, 15.5, 20.0, 17.5, 17.5, 20.0, 18.0, 18.0, 17.5, 18.5, 21.5, 19.5, 18.5, 9.0, 14.0, 9.0, 13.0, 11.0, 16.5, 11.5, 10.0, 2.5, 18.0, 18.0, 20.0, 15.0, 19.0, 18.0, 14.5, 21.5, 17.5, 15.5, 19.0, 17.5, 14.0, 18.5, 14.5, 22.0, 15.5, 16.0, 18.5, 15.0, 10.0, 12.5, 13.5, 13.0, 12.5, 11.5, 10.0, 10.0, 14.0, 11.5, 11.5, 14.5, 11.5, 12.0, 12.0, 12.5, 15.5, 14.0, 12.5, 3.5, 6.5, 7.5, 7.0, 8.0, 10.5, 5.0, 4.5, 3.5, 5.5, 23.5, 23.5, 25.5, 20.5, 24.5, 23.5, 20.0, 27.0, 23.0, 21.0, 24.0, 23.0, 21.5, 23.5, 20.5, 27.5, 22.5, 24.5, 24.0, 25.5, 15.0, 18.0, 19.0, 18.5, 18.0, 17.0, 15.5, 14.5, 20.5, 15.0, 15.0, 17.5, 16.0, 17.5, 17.0, 19.0, 18.5, 17.5, 15.5, 6.0, 12.0, 13.5, 12.5, 13.5, 12.5, 10.5, 7.5, 5.0, 2.5, 7.5, 30.0, 30.5, 32.0, 27.0, 31.0, 30.0, 26.5, 33.5, 30.0, 28.0, 31.0, 30.5, 26.5, 31.5, 27.5, 35.0, 28.5, 32.0, 31.0, 33.0, 22.0, 24.5, 25.5, 25.5, 25.0, 24.5, 21.5, 22.0, 26.5, 22.5, 22.5, 25.0, 24.5, 24.5, 25.0, 25.0, 27.5, 25.0, 24.0, 13.5, 19.0, 16.0, 19.5, 18.0, 21.5, 17.5, 14.5, 9.5, 7.0, 13.0, 7.0, 17.0, 17.0, 20.5, 14.0, 18.0, 17.0, 13.5, 21.5, 18.0, 16.0, 19.0, 18.0, 14.5, 19.0, 15.0, 22.5, 15.0, 19.5, 19.0, 20.5, 9.0, 12.0, 12.5, 13.5, 13.0, 11.0, 9.0, 9.5, 14.5, 12.5, 12.5, 15.5, 12.5, 12.5, 12.5, 13.0, 15.5, 15.0, 13.0, 5.5, 7.0, 4.5, 7.5, 5.0, 9.0, 5.5, 6.5, 5.0, 7.5, 3.0, 10.0, 14.5, 23.5, 23.0, 25.5, 20.5, 24.0, 23.5, 20.0, 26.5, 23.0, 20.5, 23.5, 22.5, 20.5, 23.5, 20.0, 27.0, 19.5, 24.5, 23.5, 25.0, 15.0, 18.0, 18.5, 18.0, 18.0, 17.0, 15.0, 14.5, 16.0, 13.5, 13.5, 16.0, 16.0, 17.0, 16.5, 19.0, 18.5, 16.0, 15.0, 5.5, 11.5, 13.0, 12.0, 13.5, 12.5, 10.5, 6.5, 6.5, 4.5, 7.5, 1.5, 9.0, 9.5, 31.5, 29.5, 31.5, 26.5, 30.5, 29.5, 26.0, 32.5, 29.0, 28.0, 31.5, 30.0, 27.0, 31.5, 27.0, 35.0, 28.0, 31.0, 30.0, 33.0, 21.5, 24.0, 25.0, 25.0, 24.0, 23.0, 21.0, 22.0, 27.0, 24.0, 24.0, 26.5, 26.5, 25.0, 24.5, 25.5, 29.0, 26.5, 26.0, 15.5, 19.5, 15.0, 19.5, 17.5, 23.0, 18.0, 16.0, 9.0, 6.5, 12.5, 9.0, 2.0, 14.0, 10.5, 26.5, 26.5, 28.5, 23.5, 27.5, 26.5, 23.0, 29.5, 26.0, 28.0, 28.0, 27.0, 18.5, 28.0, 24.0, 32.0, 25.0, 28.0, 27.0, 30.0, 18.5, 21.0, 21.5, 21.5, 21.0, 20.0, 18.0, 19.0, 24.0, 21.0, 21.0, 23.5, 23.0, 22.0, 21.5, 22.5, 26.0, 23.5, 22.5, 12.5, 16.5, 12.0, 16.5, 14.5, 20.0, 15.0, 13.0, 6.0, 3.5, 9.0, 6.0, 3.5, 11.0, 8.0, 3.0, 22.0, 21.0, 24.0, 19.0, 23.0, 22.0, 18.5, 25.5, 20.5, 14.5, 19.0, 17.5, 15.5, 17.5, 15.5, 21.5, 13.0, 21.0, 20.5, 19.5, 14.0, 15.5, 17.5, 17.0, 16.5, 15.0, 14.5, 12.0, 13.0, 6.5, 6.5, 8.5, 10.0, 15.0, 11.5, 13.5, 11.5, 6.0, 8.5, 7.5, 11.5, 16.5, 9.5, 14.0, 7.0, 11.5, 6.0, 14.0, 16.0, 9.5, 13.5, 20.0, 13.0, 12.5, 22.0, 20.0, 28.0, 27.5, 30.0, 25.0, 28.0, 28.0, 24.5, 26.0, 27.5, 23.0, 26.5, 26.0, 24.0, 26.0, 24.5, 30.0, 21.5, 29.0, 28.0, 28.5, 19.5, 22.5, 23.0, 22.5, 22.5, 21.5, 19.5, 19.0, 23.5, 16.0, 16.0, 17.0, 19.0, 21.5, 21.0, 22.0, 20.0, 14.5, 17.0, 10.0, 16.0, 17.5, 16.5, 18.0, 15.5, 15.0, 11.0, 11.0, 9.0, 12.0, 6.0, 13.5, 14.0, 4.5, 15.0, 17.0, 13.0, 30.5, 29.0, 32.5, 27.5, 31.0, 30.0, 26.5, 33.5, 29.0, 23.0, 26.0, 25.5, 23.5, 26.0, 23.5, 29.5, 21.0, 29.5, 28.5, 27.5, 22.5, 23.5, 25.5, 24.0, 25.0, 22.5, 22.5, 20.5, 21.0, 14.5, 14.5, 16.5, 18.5, 23.0, 19.5, 22.0, 19.5, 14.5, 16.5, 13.5, 19.5, 21.0, 17.5, 21.5, 15.0, 18.0, 13.5, 14.5, 12.0, 15.0, 9.0, 12.0, 17.5, 8.0, 13.5, 15.5, 8.0, 3.0, 31.0, 30.5, 33.0, 28.0, 31.5, 31.0, 27.5, 34.0, 30.5, 27.0, 30.5, 30.0, 27.0, 30.0, 27.0, 33.5, 26.0, 32.0, 31.0, 31.5, 22.5, 25.5, 26.0, 26.5, 25.5, 24.5, 22.5, 22.0, 25.5, 19.5, 19.5, 21.0, 21.5, 24.5, 23.0, 25.5, 24.5, 19.0, 21.5, 13.5, 19.0, 20.5, 19.5, 21.0, 18.0, 17.5, 14.0, 14.0, 12.0, 15.0, 9.0, 7.0, 17.5, 8.0, 9.0, 11.0, 13.0, 6.5, 4.5, 27.5, 27.0, 29.5, 24.5, 28.0, 27.0, 23.5, 30.5, 26.5, 19.0, 22.5, 24.0, 19.0, 22.0, 21.5, 26.0, 17.5, 26.5, 26.5, 24.0, 19.5, 21.0, 22.5, 21.5, 22.0, 20.0, 19.5, 18.0, 17.5, 11.0, 11.0, 13.0, 16.0, 22.5, 17.5, 19.5, 16.0, 10.5, 13.0, 10.5, 17.0, 22.0, 15.0, 19.5, 12.5, 16.0, 9.5, 19.0, 16.5, 14.0, 14.0, 16.0, 16.0, 12.0, 18.0, 20.0, 4.5, 7.5, 4.5, 9.0, 25.5, 28.5, 30.5, 25.5, 29.5, 28.5, 25.0, 31.5, 28.0, 26.0, 29.5, 27.5, 24.5, 27.5, 25.0, 33.0, 25.0, 28.5, 28.0, 31.0, 20.0, 23.0, 23.5, 23.5, 23.0, 22.0, 20.5, 20.5, 23.0, 19.0, 19.0, 22.0, 21.5, 22.5, 20.5, 23.0, 22.0, 20.0, 21.0, 11.5, 17.0, 15.0, 17.5, 19.0, 16.0, 15.5, 12.0, 12.0, 9.5, 12.5, 7.0, 7.5, 15.5, 5.5, 9.5, 11.0, 10.5, 8.0, 6.0, 2.5, 10.5, 27.0, 30.0, 32.0, 27.0, 21.0, 20.0, 26.5, 33.5, 29.5, 27.0, 31.0, 29.0, 26.0, 29.0, 26.5, 33.5, 26.0, 31.0, 30.5, 30.5, 22.0, 24.5, 25.0, 25.0, 24.5, 23.5, 22.0, 21.0, 24.0, 19.5, 19.5, 21.0, 21.5, 24.0, 22.0, 24.5, 23.5, 19.0, 21.5, 13.0, 18.0, 20.0, 19.0, 20.5, 17.5, 17.0, 13.5, 13.5, 11.0, 14.0, 8.5, 6.5, 17.0, 7.0, 8.5, 10.0, 12.0, 6.5, 5.0, 1.0, 9.0, 1.5, 31.5, 28.5, 32.5, 27.0, 30.5, 29.5, 26.0, 33.5, 28.5, 22.5, 26.0, 25.5, 23.5, 25.5, 23.5, 29.0, 21.0, 28.0, 28.5, 27.0, 22.0, 23.5, 25.0, 24.0, 24.5, 22.5, 23.0, 20.0, 21.0, 14.5, 14.5, 16.0, 18.0, 22.5, 19.0, 21.5, 19.5, 17.0, 16.5, 14.5, 20.5, 22.0, 17.5, 22.5, 14.5, 19.0, 13.5, 15.5, 13.0, 16.5, 11.0, 13.0, 18.5, 9.0, 15.0, 17.0, 8.0, 4.5, 1.5, 6.0, 4.0, 8.5, 6.5, 18.5, 18.5, 21.0, 16.5, 20.0, 19.0, 15.5, 22.0, 18.0, 13.0, 16.0, 15.5, 13.0, 16.0, 13.0, 19.5, 11.5, 18.5, 18.0, 17.5, 11.0, 12.5, 14.5, 14.0, 14.0, 11.5, 11.0, 9.5, 11.5, 5.0, 5.0, 8.0, 7.5, 12.0, 8.5, 11.0, 10.0, 7.0, 6.5, 4.5, 9.0, 14.0, 6.5, 11.5, 4.0, 8.5, 3.5, 11.0, 13.5, 8.0, 11.0, 18.5, 11.0, 9.5, 20.5, 17.5, 3.5, 9.5, 11.5, 14.5, 8.5, 15.5, 14.5, 11.0, }; /* * lookup the entry in the lower triangular matrix */ float tablelookup( entry1, entry2 ) register short entry1, entry2; { if (entry1<1 || entry1>65 || entry2<1 || entry2>65) { fprintf(stderr,"range error\n"); exit(-1); } if (entry1 == entry2) { return(0); } else if (entry1 > entry2) { return( payoff[(entry1-2)*(entry1-1)/2 + entry2 - 1] ); } else { return( payoff[(entry2-2)*(entry2-1)/2 + entry1 - 1] ); } } /* * Remove all non-alpha's and lowercase all characters. * Null and ',' are terminators * Returns a pointer to the rest of the string. * Current string is truncated and null terminated. */ char * compact( line ) char *line; { register char *i, *j; i = j = line; while ( *i != '\0' && *i != ',') { if ( isalpha(*i) ) { /* copy only letters */ *j++ = tolower(*i); } i++; } if (*i == ',') i++; *j = '\0'; return(i); } /* * lookup the input 'line' and see if it matches any of the * abbreviations. * If found this routine will return the index as its function * value and return the full name of the city in return parameter name. * If not found this routine will return 0. */ short lookup( line, name ) char *line; char **name; { short i; for ( i = 0; i < sizeof(cityinfo)/sizeof(struct cityinfostruct); i++) { if ( !strncmp( line, cityinfo[i].abbrev, strlen(cityinfo[i].abbrev) ) ){ *name = cityinfo[i].name; return(cityinfo[i].index); } } return(0); } main() { char line[125]; short city1, city2; char *name1, *name2; char *leftover; register short i; for(;;) { do { printf("Enter cities: "); if (gets( line ) == '\0') { printf("\n"); exit(0); } leftover = compact( line ); city1 = lookup( line, &name1 ); } while ( !city1 ); do { if (*leftover == '\0') { printf("Enter 2nd City: "); if (gets( line ) == '\0') { printf("\n"); exit(0); } (void) compact( line ); city2 = lookup( line, &name2 ); } else { (void) compact( leftover ); city2 = lookup( leftover, &name2 ); *leftover = '\0'; } } while ( !city2 ); printf("%s to %s makes $%4.1fK\n", name1, name2, tablelookup(city1, city2)); } }
dat@hpcnoa.UUCP (dat) (08/13/85)
That's all very nice, Jeff, but ... Does it do windows??? -- Dave
electrohome@watcgl.UUCP (electrohome) (08/18/85)
I think that these sorts of things are *great* ideas! I am in the process of converting the Move generator for sail(1) to BASIC so that you can play Wooden Ships and Iron Men solitaire without having to play sail. Once I get it done, I'll post it (although I would encourage anyone who has already done it to feel free to post their version). I would encourage other people who have board game aids to do the same. --- Carlo Sgro ...![ihnp4||decvax||allegra||clyde||utcsri||utzoo]!watmath!watcgl!electro!carlo Computer Graphics Division Electrohome Canada Kitchener, Ontario