There I was, in the Pennsylvania woods. I was walking my dog and she ran off to chase a squirrel. I felt someone tap me on my shoulder. That's not a good thing.
I turned around and there was the Pennsylvania Dog man with a piece of paper.
"Can you help me with the skip analysis?" he asked, rather embarrassed and shy.
Obviously!
So I coded this up to find the latest skips in the last 10. But as I was walking my dog I thought, how about a rolling skip analysis of the Pick3! So I made one. See below:
import itertools
def read_history_from_file(file_path):
history = []
with open(file_path, 'r') as file:
next(file) # Skip the header line
for line in file:
draw = list(map(int, line.strip().split(',')[1:])) # Skip the first field (date)
history.append(draw)
return history
def calculate_skips(history):
last_line = history[-1]
skips = {i: None for i in range(10)} # Initialize skips for numbers 0 to 9
for number in range(10):
if number in last_line:
skips[number] = -1 # Representing 'Current' skip count as -1
else:
for i, draw in enumerate(reversed(history[:-1]), 1):
if number in draw:
skips[number] = i
break
if skips[number] is None:
skips[number] = len(history)
# Adjust skips by adding 1 to each skip value, except for 'Current' skips
for number, skip in skips.items():
if skip != -1:
skips[number] += 1
return skips
def find_combinations(skips):
# Find top 4 skips, excluding 'Current' skips
top_skips = sorted(skips.items(), key=lambda x: x[1], reverse=True) # Sort skips by skip count
top_skips = [num for num, skip in top_skips if skip != -1][:4] # Get the top 4 numbers
# Generate combinations of 3 numbers
combinations = itertools.combinations(top_skips, 3) # Generate all combinations of 3 numbers
return combinations
def count_matches(history, combinations):
matches_count = 0
for draw in history[-7:]:
numbers = set(draw)
for combination in combinations:
if set(combination).issubset(numbers):
matches_count += 1
break
return matches_count * 80 # Each match is worth 80 points
def main():
file_path = r'C:\Users\Bob\Documents\match3\Match3_test.txt'
history = read_history_from_file(file_path)
# Rolling skip count analysis
for i in range(10, len(history) - 7): # Start from the 10th record until 7 records before the end
window = history[i:i+10] # Get the current window of 10 records
skips = calculate_skips(window)
combinations = find_combinations(skips)
points = count_matches(history[i+10:], combinations) # Compare with the remaining records
if points > 0:
print(f"Points in window {i+1}-{i+10}: {points}")
# Write results to a text file
with open(f"points_results_window_{i+1}-{i+10}.txt", 'w') as file:
file.write(f"Points in window {i+1}-{i+10}: {points}")
if __name__ == "__main__":
main()
Now,you can take your own skip analysis, and mine has the date, so you need to adjust for the date column (the first column) or add your own date column.
Of the 188 records (day and night), there were only 2 times that the matches would come up sometime in the next 7 draws. At $40 for a box win, you will lose money. Here is the data set:
01/01/24 |
6 |
1 |
4 |
01/01/24 |
9 |
8 |
0 |
01/02/24 |
5 |
2 |
2 |
01/02/24 |
5 |
2 |
6 |
01/03/24 |
1 |
5 |
3 |
01/03/24 |
1 |
0 |
5 |
01/04/24 |
6 |
8 |
1 |
01/04/24 |
7 |
3 |
6 |
01/05/24 |
8 |
2 |
1 |
01/05/24 |
0 |
8 |
5 |
01/06/24 |
9 |
4 |
8 |
01/06/24 |
4 |
4 |
0 |
01/07/24 |
0 |
9 |
8 |
01/07/24 |
7 |
4 |
1 |
01/08/24 |
2 |
9 |
5 |
01/08/24 |
7 |
7 |
5 |
01/09/24 |
5 |
1 |
7 |
01/09/24 |
4 |
1 |
0 |
01/10/24 |
6 |
8 |
0 |
01/10/24 |
7 |
6 |
0 |
01/11/24 |
6 |
0 |
4 |
01/11/24 |
6 |
0 |
2 |
01/12/24 |
0 |
8 |
8 |
01/12/24 |
4 |
4 |
7 |
01/13/24 |
2 |
0 |
5 |
01/13/24 |
3 |
3 |
5 |
01/14/24 |
3 |
5 |
4 |
01/14/24 |
1 |
2 |
1 |
01/15/24 |
0 |
9 |
6 |
01/15/24 |
7 |
3 |
5 |
01/16/24 |
0 |
0 |
0 |
01/16/24 |
6 |
7 |
8 |
01/17/24 |
5 |
5 |
7 |
01/17/24 |
0 |
2 |
3 |
01/18/24 |
7 |
7 |
5 |
01/18/24 |
1 |
6 |
3 |
01/19/24 |
7 |
5 |
5 |
01/19/24 |
4 |
2 |
1 |
01/20/24 |
0 |
3 |
0 |
01/20/24 |
4 |
5 |
9 |
01/21/24 |
8 |
9 |
6 |
01/21/24 |
4 |
3 |
3 |
01/22/24 |
7 |
0 |
6 |
01/22/24 |
5 |
3 |
9 |
01/23/24 |
1 |
8 |
2 |
01/23/24 |
2 |
3 |
2 |
01/24/24 |
8 |
4 |
8 |
01/24/24 |
7 |
6 |
3 |
01/25/24 |
5 |
7 |
5 |
01/25/24 |
4 |
4 |
9 |
01/26/24 |
1 |
9 |
8 |
01/26/24 |
1 |
6 |
2 |
01/27/24 |
3 |
4 |
7 |
01/28/24 |
6 |
5 |
2 |
01/29/24 |
6 |
1 |
4 |
01/30/24 |
4 |
0 |
7 |
01/31/24 |
5 |
1 |
2 |
02/01/24 |
6 |
2 |
3 |
02/02/24 |
8 |
7 |
6 |
02/03/24 |
4 |
6 |
4 |
02/04/24 |
3 |
8 |
7 |
02/05/24 |
8 |
5 |
2 |
02/06/24 |
2 |
4 |
9 |
02/07/24 |
2 |
2 |
9 |
02/08/24 |
5 |
1 |
3 |
02/09/24 |
4 |
3 |
3 |
02/10/24 |
1 |
1 |
0 |
02/11/24 |
7 |
6 |
4 |
02/11/24 |
5 |
9 |
5 |
02/12/24 |
7 |
7 |
4 |
02/12/24 |
4 |
1 |
7 |
02/13/24 |
4 |
6 |
9 |
02/13/24 |
5 |
5 |
1 |
02/14/24 |
3 |
7 |
5 |
02/14/24 |
2 |
6 |
0 |
02/15/24 |
6 |
5 |
8 |
02/15/24 |
8 |
4 |
3 |
02/16/24 |
1 |
1 |
6 |
02/16/24 |
9 |
2 |
0 |
02/17/24 |
8 |
1 |
5 |
02/17/24 |
1 |
1 |
1 |
02/18/24 |
0 |
2 |
2 |
02/18/24 |
4 |
4 |
0 |
02/19/24 |
1 |
9 |
2 |
02/19/24 |
9 |
4 |
8 |
02/20/24 |
3 |
5 |
6 |
02/20/24 |
7 |
8 |
6 |
02/21/24 |
5 |
3 |
3 |
02/21/24 |
7 |
1 |
2 |
02/22/24 |
3 |
2 |
2 |
02/22/24 |
8 |
8 |
6 |
02/23/24 |
5 |
1 |
4 |
02/23/24 |
5 |
0 |
8 |
02/24/24 |
7 |
8 |
6 |
02/24/24 |
9 |
9 |
9 |
02/25/24 |
3 |
9 |
7 |
02/25/24 |
5 |
8 |
8 |
02/26/24 |
4 |
6 |
6 |
02/26/24 |
0 |
5 |
3 |
02/27/24 |
1 |
4 |
4 |
02/27/24 |
7 |
2 |
5 |
02/28/24 |
3 |
2 |
7 |
02/28/24 |
1 |
9 |
7 |
02/29/24 |
6 |
3 |
6 |
02/29/24 |
5 |
1 |
9 |
03/01/24 |
6 |
2 |
2 |
03/01/24 |
9 |
5 |
7 |
03/02/24 |
7 |
5 |
7 |
03/02/24 |
9 |
9 |
6 |
03/03/24 |
0 |
9 |
2 |
03/03/24 |
2 |
9 |
8 |
03/04/24 |
9 |
1 |
8 |
03/04/24 |
1 |
3 |
6 |
03/05/24 |
3 |
5 |
1 |
03/05/24 |
0 |
7 |
4 |
03/06/24 |
7 |
0 |
0 |
03/06/24 |
0 |
5 |
0 |
03/07/24 |
7 |
9 |
5 |
03/07/24 |
2 |
8 |
2 |
03/08/24 |
6 |
5 |
1 |
03/08/24 |
9 |
0 |
1 |
03/09/24 |
8 |
5 |
7 |
03/09/24 |
5 |
1 |
9 |
03/10/24 |
6 |
8 |
3 |
03/10/24 |
4 |
6 |
1 |
03/11/24 |
7 |
9 |
6 |
03/11/24 |
1 |
2 |
4 |
03/12/24 |
2 |
5 |
1 |
03/12/24 |
4 |
3 |
9 |
03/13/24 |
6 |
3 |
1 |
03/13/24 |
0 |
1 |
1 |
03/14/24 |
3 |
2 |
0 |
03/14/24 |
9 |
1 |
2 |
03/15/24 |
8 |
9 |
8 |
03/15/24 |
5 |
3 |
7 |
03/16/24 |
0 |
5 |
6 |
03/16/24 |
8 |
5 |
8 |
03/17/24 |
9 |
4 |
0 |
03/17/24 |
6 |
4 |
4 |
03/18/24 |
2 |
0 |
3 |
03/18/24 |
3 |
3 |
4 |
03/19/24 |
0 |
2 |
8 |
03/19/24 |
6 |
7 |
6 |
03/20/24 |
8 |
5 |
1 |
03/20/24 |
5 |
8 |
9 |
03/21/24 |
6 |
3 |
6 |
03/21/24 |
2 |
2 |
3 |
03/22/24 |
2 |
9 |
7 |
03/22/24 |
4 |
1 |
6 |
03/23/24 |
9 |
4 |
8 |
03/23/24 |
3 |
1 |
6 |
03/24/24 |
1 |
6 |
3 |
03/24/24 |
4 |
3 |
0 |
03/25/24 |
7 |
3 |
3 |
03/25/24 |
5 |
4 |
6 |
03/26/24 |
6 |
4 |
8 |
03/26/24 |
8 |
5 |
9 |
03/27/24 |
6 |
7 |
1 |
03/27/24 |
8 |
0 |
3 |
03/28/24 |
6 |
1 |
9 |
03/28/24 |
4 |
2 |
8 |
03/29/24 |
0 |
4 |
0 |
03/29/24 |
5 |
4 |
3 |
03/30/24 |
1 |
8 |
4 |
03/30/24 |
6 |
3 |
0 |
03/31/24 |
6 |
9 |
6 |
03/31/24 |
9 |
7 |
5 |
04/01/24 |
9 |
1 |
5 |
04/01/24 |
5 |
2 |
4 |
04/02/24 |
0 |
5 |
5 |
04/02/24 |
2 |
7 |
4 |
04/03/24 |
4 |
0 |
7 |
04/03/24 |
0 |
6 |
9 |