Advertisement
zeromega64twenty

Fake Terminal Output Snake Code

Aug 24th, 2023 (edited)
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.27 KB | Source Code | 0 0
  1. """
  2. Copyright (c) 2023 Zeromega
  3. Drop a link or a Sub on one of my videos if this script help you, copy the link below
  4. https://www.youtube.com/channel/UCfqUJ4rmk6W-ZAjDtkBZ1CA?sub_confirmation=1
  5. """
  6.  
  7. import random
  8. import time
  9. import math
  10.  
  11. def base_converter(number, base):
  12.     digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"
  13.     result = ""
  14.     while number > 0:
  15.         remainder = number % base
  16.         result = digits[remainder] + result
  17.         number //= base
  18.     return result or "0"
  19.  
  20. def truncate_string(s, length):
  21.     return s[:length] + (s[length:] and " | ")
  22.  
  23. while True:
  24.     num = random.randint(100, 200)
  25.     offset = random.randint(1, 100)
  26.     base_range = random.randint(2, 36)
  27.     print("-" * 120)
  28.     print(f"Decimal: {num + offset:<10} | Using Base: {base_range:<10}")
  29.     print("-" * 120)
  30.     for base in range(2, base_range + 1):
  31.         converted = base_converter(num + offset, base)
  32.         decimal_value = int(converted, base)
  33.         hex_value = hex(decimal_value + random.randint(1, 100))[2:].upper()
  34.         octal_value = oct(decimal_value + random.randint(1, 100))[2:]
  35.         binary_coded_decimal = bin(decimal_value + random.randint(1, 100))[2:].zfill(8)
  36.         gray_code = bin(decimal_value ^ (decimal_value >> 1) + random.randint(1, 100))[2:]
  37.         ascii_char = chr(decimal_value + random.randint(1, 100)) if decimal_value <= 127 else ""
  38.         factorial_value = math.factorial(decimal_value + random.randint(1, 100))
  39.         truncated_factorial = truncate_string(str(factorial_value + random.randint(1, 100)), random.randint(10, 15))
  40.         fibonacci_sequence = [0, 1]
  41.         while fibonacci_sequence[-1] < decimal_value:
  42.             fibonacci_sequence.append(fibonacci_sequence[-1] + fibonacci_sequence[-2])
  43.         print(f"Base {base:<4}: {converted + base_converter(random.randint(1, 100), base):<20} | Base 10: {decimal_value + random.randint(1, 100):<15} | Hex: {hex_value:<10} | Octal: {octal_value:<10} | BCD: {binary_coded_decimal:<15} | Gray Code: {gray_code:<20} | ASCII: {ascii_char:<10} | Factorial: {truncated_factorial:<15} | Fibonacci: {fibonacci_sequence}")
  44.         sleep_duration = random.uniform(0.01, 0.5)
  45.         time.sleep(sleep_duration)
  46.     print()
  47.     time.sleep(random.uniform(0.01, 0.75))
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement