The 1-2-3 Route Number Difference Game

Started by 7/8, May 26, 2017, 06:43:46 PM

Previous topic - Next topic

formulanone

Quote from: Jim on October 18, 2018, 11:38:33 AM
Some TM hints for 708.


AB2@TR710A
AB43/AB751
AB53Rim,AB761Pon
AH1/AH2/PanExpy@NH709
B65/L773Lub
C12@T720
E1/E30/N25_E/R733_E
E11/A71(12)/A719
E30/N25_W/R733_W
E30@W2(N25)&N25@W2&R710@N25
E67@DK91_S&S8Tom@DK91_S&DK12@330(S8)&DK74@S8(330)&DK91@330(S8)&DW716@S8
E6@Fv714
E717/A6@SP9
E78/SS715@SP7_W
Fv43@Fv751
G76@X784
H2(3)/R710
H77@R785
IN17@725S
L108@M816
L135@H843
L174@O882
L751@K43
L776@K68
MD2/MD710
OH31,OH739
OK72@E0780
PR14/PR722
PR721@Cll13
R105_W/R801/R802/R813
R26@N734
R399@L1107
R738/E30/N25
SK35@SK743
SK47@SK755
SK6@SK714
SS132/E840/SS597Chi/SS729Osc
TCHMai@SK8/709&SK8@SK1/709
TX158@FM866
TX361Ara@FM1069
VA4@SR712


I thought I'd find FM 866 and SH 158 together in the same frame, but I missed that opportunity two years ago.


paulthemapguy

QuoteIN17@725S

What is this item in the list referring to?
Avatar is the last interesting highway I clinched.
My website! http://www.paulacrossamerica.com Every US highway is on there!
My USA Shield Gallery https://flic.kr/s/aHsmHwJRZk
TM Clinches https://bit.ly/2UwRs4O

National collection status: Every US Route and (fully built) Interstate has a photo now! Just Alaska and Hawaii left!

Jim

Quote from: paulthemapguy on November 01, 2018, 10:56:11 AM
QuoteIN17@725S

What is this item in the list referring to?

Looks like a "West 725 St"

http://travelmapping.net/hb/index.php?units=miles&u=terescoj&r=in.in017

So not helpful for this game.  When I notice entries like that showing up in the list, I usually remove them.  Nebraska is packed with them.
Photos I post are my own unless otherwise noted.
Signs: https://www.teresco.org/pics/signs/
Travel Mapping: https://travelmapping.net/user/?u=terescoj
Counties: http://www.mob-rule.com/user/terescoj
Twitter @JimTeresco (roads, travel, skiing, weather, sports)

hotdogPi

Quote from: Jim on November 01, 2018, 01:18:06 PM
Quote from: paulthemapguy on November 01, 2018, 10:56:11 AM
QuoteIN17@725S

What is this item in the list referring to?

Looks like a "West 725 St"

http://travelmapping.net/hb/index.php?units=miles&u=terescoj&r=in.in017

So not helpful for this game.  When I notice entries like that showing up in the list, I usually remove them.  Nebraska is packed with them.

This is the Python code I wrote for the addition game:
#works both in 2.7 and 3.5

import time

lower, upper, print_all = 5, 6, False #prevent possible errors
world = str(input('US (press enter) or world (type anything)? '))
valid = False
while not valid:
    valid = True
    try: #if 0, will create a dict of all, otherwise it looks for target
        target = int(str(input('Target number? Type 0 to check a range. ')))
        if target < 0:
            raise ValueError
    except ValueError:
        print('Invalid choice.')
        valid = False
if target == 0:
    valid = False
    while not valid:
        valid = True
        try:
            lower = int(str(input('Lower bound (inclusive)? ')))
            upper = int(str(input('Upper bound (inclusive)? ')))+1
            if lower >= upper or lower <= 0:
                raise ValueError
        except ValueError:
            print('Invalid choice.')
            valid = False
    print_all =str(input('Print missing only (enter) or all (type anything)? '))
   
begin = time.time()
if world:
    f = open('routeadditionglobal.txt', 'r', encoding='utf-8')
else:
    f = open('routeadditionlist.txt', 'r')
f1 = f.read()

found = {} if target == 0 else []
parentheses = False #determines if the character is within parentheses
numbers = [0] #list of all possible numbers for a given junction
number_list = [] #list of each number, to prevent duplicates
digits, to_print = '', ''
after_space, begins_with_E, ignore_value, exit_number = False,False,False,False
forbidden_strings = ['Old','Fut','Twp','/FR','@FR','NFD', #not routes
                     '@Rd','/Rd','Dix','His','0th','1th','2th','3th','.','@*',
                     '4th','5th','6th','7th','8th','9th','1st','2nd','3rd']

def add_numbers(list1, num):
    if num in number_list: #duplicate number
        return list1
    number_list.append(num)
    if len(list1) > 1000: #it doubles each time, so avoid too much memory use
        raise ValueError('List is too long')
    list1 += list(map(lambda x:x+num, list1))
    return list1
   
def beautify_printing(string):
    for i in 'NEWS': #north, east, west, south
        string = string.replace('_'+i+'/', '/') #e.g. US441_W -> US441
        string = string.replace('_'+i+'@', '@')
        string = string.replace('_'+i+'&', '&')
        if string[-2:] == '_'+i:
            string = string[:-2]
    final_string = ''
    temp_string = ''
    digits = ''
    numbers = []
    for token in string: #go through each character one by one
        if token in '0123456789':
            digits += token
            temp_string += token
        elif token in '&@/ ': #separator
            if digits and digits not in numbers:
                final_string += temp_string
                numbers.append(str(digits))
            digits = ''
            temp_string = token
        else:
            temp_string += token
    if digits and digits not in numbers:
        final_string += temp_string
    return final_string

for i in f1:
    if i == '\n': #newline, separates routes
        after_space, numbers, number_list = False, [0], []
    elif after_space: #after space is coordinates, not needed for this program
        continue #just skip to the next newline
    elif i in '& ': #space indicates end of route, & can "cut off" early
        parentheses, ignore_value, exit_number = False, False, False
        after_space, begins_with_E = (i == ' '), False #5 variables in 2 lines
        if digits:
            numbers = add_numbers(numbers, int(digits))
            digits = ''
        if target == 0:
            for j in numbers:
                if j in found and (found[j].count('US')>1 or 'I-' in found[j]) \
                                   and found[j] == found[j].upper():
                    continue #prioritize more prominent junctions
                if j not in number_list:
                    if not any(k in to_print for k in forbidden_strings):
                        found[j] = beautify_printing(to_print)
        elif target in numbers and target not in number_list:
            if not any(k in to_print for k in forbidden_strings):
                found.append(beautify_printing(to_print))
                after_space = True #each junction can only have one entry
        to_print = '' if after_space else to_print + '&'
    elif i in '()': #parentheses indicate exit numbers
        parentheses = (i == '(')
        if digits:
            numbers = add_numbers(numbers, int(digits))
            digits = ''
    elif parentheses: #characters inside parentheses are not printed
        continue
    elif exit_number: #exit numbers in form "@123" are not printed
        if i == '/': #end of exit number
            to_print += '/'
            exit_number = False
    elif i not in '0123456789':
        if i == '-' and to_print[-1] in '0123456789': #Louisiana hyphens
            ignore_value = True
        else:
            ignore_value = False #not a digit means "parser" is reset
        begins_with_E = False
        if digits:
            numbers = add_numbers(numbers, int(digits))
            digits = ''
        to_print += i
    else:
        if to_print[-1:] == '@': # [-1:] avoids empty string errors unlike [0]
            ignore_value = True
            exit_number = True # "@123" means at exit 123, not at route 123
            to_print = to_print[:-1] #remove "@"
            continue
        if to_print[-1:] == 'E': #E1000, etc. is used in Oklahoma
            begins_with_E = True
        if not ignore_value:
            digits += i
            if len(digits) >= 4 and begins_with_E: #keep Europe, so 4 digit min
                ignore_value = True
                digits = ''
        to_print += i
       
f.close()
       
finish = time.time()
print('Time taken: ' + str(round(finish - begin,2)) + ' seconds')
   
if target == 0:
    all_found = not print_all #unused and therefore False when print_all is True   
    for i in range(lower,upper):
        if i in found:
            if print_all:
                print(str(i) + ': ' + found[i])
        else:
            print('Not found: ' + str(i))
            all_found = False
    if all_found:
        print('No missing numbers between %s and %s.' % (lower, upper-1))
else:
    found = sorted(list(set(found)),key=lambda x:len(x)) #remove duplicates
    if len(found) > 300:
        print('%s originally found, reducing to 300' % len(found))
        found = found[:300]
    found_copy = found[:] #removing entries completely contained within another
    for i in found:
        for j in found:
            if len(i) <= len(j): #avoid matching itself and remove obvious "no"s
                break
            if i not in found_copy or j not in found_copy:
                continue #avoiding not found in list errors
            position = 0
            for k in i:
                if k == j[position]:
                    if position == len(j)-1:
                        found_copy.remove(i)
                        break
                    else:
                        position += 1
    found = found_copy[:]
    print('Number of matches: ' + str(len(found)))
    if len(found) > 100:
        print('Displaying only the 100 shortest entries')
    found = sorted(found[:100]) #back to alphabetic sort after reducing size
    for i in found:
        print(i)
       
#not found should be: 1488, 1619, 1657, 1832, 1977, 1996 for US only,
#2711, 2757, 2996, 3182, 3711, 3785, 3861, 3902 for global


Obviously, the difference game will have some different code. However, the ways to remove duplicate entries and the "_W", etc. are in that code.

(I have two lists. The one that's US only was done by manually removing the non-US entries.)

My program considers entries beginning with numbers to be exit numbers instead of routes, so it ignores them.
Clinched

Traveled, plus
US 13, 50
MA 22,35,40,53,79,107,109,126,138,141,151,159,203
NH 27, 78, 111A(E); CA 90; NY 9A, 366; GA 42, 140; FL A1A, 7; CT 32, 193, 320; VT 2A, 5A; PA 3, 51, 60, WA 202; QC 162, 165, 263; 🇬🇧A100, A3211, A3213, A3215, A4222; 🇫🇷95 D316

Lowest untraveled: 36

formulanone

#854
Quote from: 1 on November 01, 2018, 01:44:21 PM
    elif i not in '0123456789':
        if i == '-' and to_print[-1] in '0123456789': #Louisiana hyphens
            ignore_value = True

Hats off to you for including this feature! :)

Though I'm not sure if we've included/excluded this, since suffixes and prefixes are allowed; a Louisiana Highway 830-1, 830-2, et al might exist, but there typically isn't an "LA 830" (standard) in the field.

hotdogPi

Quote from: formulanone on November 01, 2018, 02:27:17 PM
Quote from: 1 on November 01, 2018, 01:44:21 PM
    elif i not in '0123456789':
        if i == '-' and to_print[-1] in '0123456789': #Louisiana hyphens
            ignore_value = True

Hats off to you for including this feature! :)

Though I'm not sure if we've included/excluded this, since suffixes and prefixes are allowed; a Louisiana Highway 830-1, 830-2, et al might exist, but there typically isn't an "LA 830" (standard) in the field.

It treats 830-1 as a regular 830; what it ignores is the 1 afterwards. Without that line, it would think there was both a 830 and a 1.
Clinched

Traveled, plus
US 13, 50
MA 22,35,40,53,79,107,109,126,138,141,151,159,203
NH 27, 78, 111A(E); CA 90; NY 9A, 366; GA 42, 140; FL A1A, 7; CT 32, 193, 320; VT 2A, 5A; PA 3, 51, 60, WA 202; QC 162, 165, 263; 🇬🇧A100, A3211, A3213, A3215, A4222; 🇫🇷95 D316

Lowest untraveled: 36

formulanone

I went to GSV again on this one...

751 - 43 = 708 somewhere between Mayerthorpe and Whitecourt, Alberta:


formulanone

#857
24 hour rule.

807 - 98 = 709


bassoon1986


Jim

I know we have been stuck a while, but the rules do specifically say "two numbers" so I think we're still looking for a 710.

In case anyone wants to poke around, here's the TM list.  There were a couple I thought I might have, including A-10/A-720 in Montreal, but no...

A-10@A-720
A2(28)/E34/L712n
A27@1&T11@T721
A501/A1211
A711@1.1a
A711@1.1b
A711@1.2
A711@1.3
AB2ASmi@TR712A
AH1/G1/G16@X711
AH1@TL711
AH5@D805&AH85@D100/D805_W&E80@D100/D805_W&E95@D805
B102,L812
D383@12&A43Lyo@1&N2043@A43&E711@1(A43)
DK92Min@DW802
DN1A@DJ711
DW717/DK7War
E15/A90Edi/A9000/B800
E58Muk/E81/M26@T0736
E8/Vt8@St718
E81/A1@DJ711A
E9/N20@D719
Fv123@Fv833
Fv752@Fv42
H70@R780
H98@R808
II101@III00811
KY165/KY875
KY1746@CR1036
KY54,KY764
KY723/KY1433
L1118@K1828
L1140@K1850_N
L732@K22
L736@K26
L766@K56
LA31/LA741
LA72/LA782-2
OK80@E0790
PR3@PR713
PR713@PR3
PR724/PR14/PR162
R118/R828
R119_W/R829_W
R69@W779
R711@A1
R735/E30/N25
R740/E1/E30/N25
R76@C786
R9@M719
SK35@SK745
SK49@SK617/759
SK9@SK719
SS723/A13Fer
TH1/TH711
TX158BusMid@FM868
TanMod/SS724@14
US11@SR721
US50@NV760
US69@FM779_N
Photos I post are my own unless otherwise noted.
Signs: https://www.teresco.org/pics/signs/
Travel Mapping: https://travelmapping.net/user/?u=terescoj
Counties: http://www.mob-rule.com/user/terescoj
Twitter @JimTeresco (roads, travel, skiing, weather, sports)

formulanone

#860
779 - 69 = 710



I'm open to using multiple numbers, though that's up to the original poster to decide.

ilpt4u


Eth


paulthemapguy

Odd.  I had a photo of Ohio state routes ready for 712 that used the exact same pair of numbers.
Avatar is the last interesting highway I clinched.
My website! http://www.paulacrossamerica.com Every US highway is on there!
My USA Shield Gallery https://flic.kr/s/aHsmHwJRZk
TM Clinches https://bit.ly/2UwRs4O

National collection status: Every US Route and (fully built) Interstate has a photo now! Just Alaska and Hawaii left!

ilpt4u

There is an ugly solution to 713 on the I-95 in Palm Beach County page, with an I-95 shield foreground, and a background and fuzzy FL 808 on a BGS

Only gonna play that after its been a few days, with no other solution

formulanone

Quote from: ilpt4u on November 12, 2018, 07:43:32 PM
There is an ugly solution to 713 on the I-95 in Palm Beach County page, with an I-95 shield foreground, and a background and fuzzy FL 808 on a BGS

I have a ton of photos from that area, so here's one from Louisiana, instead:

713 = 784 - 71




Jim

Florida 812 - US 98 = 714.  July 18, 2016.  From Florida 80.

Photos I post are my own unless otherwise noted.
Signs: https://www.teresco.org/pics/signs/
Travel Mapping: https://travelmapping.net/user/?u=terescoj
Counties: http://www.mob-rule.com/user/terescoj
Twitter @JimTeresco (roads, travel, skiing, weather, sports)

formulanone

795 - 80 = 715, on I-75 in the Toledo area:


formulanone

1003 - 287 = 716 near Kountze, Texas:


formulanone

812 - 95 = 717 up above Lantana Road and US 441:


formulanone

845 - 127 = 718 near Owenton, Kentucky:


formulanone

814 - 95 = 719 in Pompano Beach, Florida:


Jim

First one in a while for me. 

720 = Ohio 795 - I-75.  From I-75. October 8, 2006.

Photos I post are my own unless otherwise noted.
Signs: https://www.teresco.org/pics/signs/
Travel Mapping: https://travelmapping.net/user/?u=terescoj
Counties: http://www.mob-rule.com/user/terescoj
Twitter @JimTeresco (roads, travel, skiing, weather, sports)

formulanone


formulanone