A8DOG

A8DOG

随便写写,记录折腾过程!
telegram

Double Color Ball Winning Verification Python Code + Randomly Generated Lottery Numbers

I previously saw a marketing account post a video about the current situation of young people in South Korea, who don't want to get married or buy a house and just want to lay flat, buying scratch cards for fun and hoping to win a big prize to continue laying flat happily.

After entering society for 6 or 7 years, the once naive little boy is no longer young, and the promises of the past have become all about money!

So I plan to spend a few tens of dollars every day to buy some lottery tickets, maybe I can win a big prize and continue to lay flat (I think my luck has been pretty good over the years, except for gambling luck...).

https://img.a8dog.com/i/2023/09/04/pfr33c.webp

Generate Random Lottery Numbers#

The code was written by chatgpt...

Double Color Ball#

import random
import time

def generate_double_color_balls(num_tickets=5):
    tickets = []
    for _ in range(num_tickets):
        current_time = int(time.time())  # Get current timestamp
        random.seed(current_time)  # Use current timestamp as random seed

        # Generate red ball numbers, randomly select 6 non-repeating numbers from 1 to 33
        red_balls = random.sample(range(1, 34), 6)
        # Sort red ball numbers
        red_balls.sort()
        
        # Generate blue ball number, randomly select 1 number from 1 to 16
        blue_ball = random.randint(1, 16)
        
        tickets.append((red_balls, blue_ball))
    
    return tickets

if __name__ == "__main__":
    num_tickets = 5  # Generate 5 sets of double color ball numbers
    tickets = generate_double_color_balls(num_tickets)
    
    for i, (red_balls, blue_ball) in enumerate(tickets, 1):
        print(f"Set {i} double color ball numbers:")
        print("Red balls:", red_balls)
        print("Blue ball:", blue_ball)
        print()

Fucai 3D#

import random
import time

def generate_fc3d_numbers():
    current_time = int(time.time())  # Get current timestamp
    random.seed(current_time)  # Use current timestamp as random seed
    numbers = [random.randint(0, 9) for _ in range(3)]  # Generate 3 random numbers between 0 and 9
    return numbers

if __name__ == "__main__":
    fc3d_numbers = generate_fc3d_numbers()
    print(f"Fucai 3D numbers: {''.join(map(str, fc3d_numbers))}")

Qilecai#

import random
import time

def generate_qlc_numbers():
    numbers = []
    current_time = int(time.time())  # Get current timestamp
    random.seed(current_time)  # Use current timestamp as random seed

    for _ in range(5):
        # Generate 7 non-repeating red ball numbers (range from 1 to 30) randomly
        red_balls = random.sample(range(1, 31), 7)
        
        # Shuffle the order of red ball numbers randomly
        random.shuffle(red_balls)
        
        numbers.append(red_balls)
    return numbers

if __name__ == "__main__":
    qlc_numbers = generate_qlc_numbers()
    for i, red_balls in enumerate(qlc_numbers, start=1):
        print(f"Set {i} Qilecai numbers:")
        print("Red balls:", red_balls)
        print()

Lottery Number Verification#

I spent 10 dollars to play 5 sets of numbers, but I'm too lazy to check them one by one. I'm also afraid that if I win by some miracle, I won't be able to find out...

API application address: https://www.mxnzp.com/doc/detail?id=3

import requests

def check_lottery_result(api_url, app_id, app_secret, lottery_code, expect, lottery_no):
    # Build request parameters
    params = {
        'code': lottery_code,   # Lottery type
        'expect': expect,       # Lottery period number
        'lotteryNo': lottery_no,  # User-selected numbers
        'app_id': app_id,       # Your API application ID
        'app_secret': app_secret  # Your API application secret key
    }

    # Send GET request
    response = requests.get(api_url, params=params)

    if response.status_code == 200:
        result = response.json()
        return result
    else:
        print("Request failed")
        return None

if __name__ == "__main__":
    # API URL
    api_url = "https://www.mxnzp.com/api/lottery/common/check"
    
    # Application address: https://www.mxnzp.com/doc/detail?id=3
    app_id = "xxx"
    app_secret = "xxxxxx"

    while True:
        # User-selected lottery type
        print("Please select the lottery type:")
        print("1. Double Color Ball (ssq)")
        print("2. Qilecai (qlc)")
        choice = input("Enter the number to choose the lottery type (1 or 2): ")

        if choice == "1":
            lottery_code = "ssq"
        elif choice == "2":
            lottery_code = "qlc"
        else:
            print("Invalid choice, please enter again")
            continue

        user_input_expect = input("Enter the period number (without prefix 23): ")  # Manually enter the period number (without prefix 23)
        
        # Add "23" in front of the user input period number
        expect = "23" + user_input_expect
        
        red_balls = input("Enter the red ball numbers (separated by spaces): ").split()  # Manually enter the red ball numbers
        blue_ball = input("Enter the blue ball number: ")  # Manually enter the blue ball number

        # Build the user-selected numbers
        lottery_no = ",".join(red_balls) + "@" + blue_ball

        # Check the result
        result = check_lottery_result(api_url, app_id, app_secret, lottery_code, expect, lottery_no)
        
        if result:
            if result["code"] == 1:
                print("Query successful")
                print("Winning information: " + result["data"]["resultDetails"])  # Display winning information and the queried numbers
            else:
                print("Query failed:", result["msg"])
        else:
            print("Query failed")

        another = input("Do you want to continue querying? (Enter y to continue, any other key to exit): ")
        if another.lower() != 'y':
            break

It's best not to have too high expectations for these things, just have some fun, and don't get involved in gambling (whether online or offline).

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.