NaiViewer - a program for simulating outer-totalistic naiverules

For scripts to aid with computation or simulation in cellular automata.
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

In this thread, I want to share a Python program that I wrote to simulate 2-state outer-totalistic naiverules (e.g. NaiveLife):

Code: Select all

import pygame

import random

world = []

cursorpos = [100, 100]

buffer = ""

rule = input("Rule: ")

if (rule == ""):
	
	bconds = [3]
	
	sconds = [2, 3]
	
else:
	
	bstr = rule[1:rule.index("/")]
	
	bconds = []
	
	sconds = []
	
	if rule[-1] != "S":
		
		sstr = rule[rule.index("S") + 1:]
			
		for condition in sstr:
			
			sconds.append(int(condition))
			
	for condition in bstr:
			
			bconds.append(int(condition))

for y in range(0, 200):
	
	world.append([0] * 200)
	
def makeworld(rle): # Assists in the conversion of an RLE to a matrix
	
	rlel = list(rle)
	
	mat = []
	
	for y in range(0, 200):
		
		mat.append([])
		
		for x in range(0, 200):
			
			mat[-1].append(0)
	
	digits = "0123456789"
	
	y = 0
	
	x = 0
	
	num = 0
	
	for char in rlel:
		
		if char in digits:
			
			num = num * 10 + int(char)
			
		else:
			
			if char == "b":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[x][y] = 0
					
					x += 1
					
			if char == "o":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[x][y] = 1
					
					x += 1
					
			if char == "$":
				
				x = 0
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					y += 1
					
			num = 0
			
	return(mat)
	
def makerle(mat): # Does the opposite of the previous function
	
	rlel = []
	
	num = 1
	
	for row in mat:
		
		for cell in row:
			
			if cell == 0:
				
				rlel.append("b")
				
			else:
				
				rlel.append("o")
				
		rlel.append("$")
		
	rlel[len(rlel) - 1] = "!"
	
	listinit = rlel
		
	rle = "".join(listinit)
	
	return(rle)

rle = input("RLE (must be headerless, may be empty): ")

world = makeworld(rle)

pygame.init()

screen = pygame.display.set_mode((1000, 1000))

rectworld = []

for y in range(0, 200):
	
	rectworld.append([])
	
	for x in range(0, 200):
		
		rectworld[-1].append(pygame.Rect(y * 5, x * 5, 5, 5))
		
clock = pygame.time.Clock()

step = 0

running = True

dt = 0

def advance(world):
	
	global sconds
	
	neigh = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]]
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			neighs = 0
			
			for n in range(0, 8):
				
				newx = (x + neigh[n][1]) % 200
				
				newy = (y + neigh[n][0]) % 200
				
				if (world[newy][newx] == 1):
					
					neighs += 1
					
			if world[y][x] == 0 and (neighs in bconds):
				
				world[y][x] = 1
				
				continue
				
			if world[y][x] == 1 and (neighs not in sconds):
				
				world[y][x] = 0
				
	return world
	
def show(world):
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			if world[y][x] == 1:
				
				pygame.draw.rect(screen, "white", rectworld[y][x])
				
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 1:
				
				pygame.draw.rect(screen, "red", rectworld[y][x])
				
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
				
				pygame.draw.rect(screen, "maroon", rectworld[y][x])
				
def randfill():
	
	global world
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			world[y][x] = random.randint(0, 1)
			
	return world
	
while running:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			running = False
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_q:
				running = False
			if event.key == pygame.K_r:
				world = randfill()
			if event.key == pygame.K_c:
				print(makerle(world))
				buffer = makerle(world)
			if event.key == pygame.K_v:
				world = makeworld(buffer)
			if event.key == pygame.K_EQUALS:
				world = advance(world)
			if event.key == pygame.K_UP:
				cursorpos[1] -= 1
				cursorpos[1] %= 200
			if event.key == pygame.K_DOWN:
				cursorpos[1] += 1
				cursorpos[1] %= 200
			if event.key == pygame.K_LEFT:
				cursorpos[0] -= 1
				cursorpos[0] %= 200
			if event.key == pygame.K_RIGHT:
				cursorpos[0] += 1
				cursorpos[0] %= 200
			if event.key == pygame.K_RETURN:
				world[cursorpos[0]][cursorpos[1]] += 1
				world[cursorpos[0]][cursorpos[1]] %= 2
				
		keys = pygame.key.get_pressed()
		
		if keys[pygame.K_SPACE]:
			world = advance(world)
			
	screen.fill("black")
	
	show(world)
	
	pygame.display.flip()
	
	dt = clock.tick(60) / 1000
	
pygame.quit()
My code is still extremely basic, but it can:

- Be used to edit patterns with the arrow keys and Enter,

- Generate pseudorandom soups with the R key,

- Advance patterns in 200x200 toroidal naiverules,

- Copy and paste patterns,

- Get input patterns in RLE format,

and most of all,

- Be improved.

It is currently in development and Pygame is required to run it. Feel free to post any discoveries made using my program here, as well as potential improvements to its code!

Until then, happy exploring!
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

v1.0.1 is out now:

Code: Select all

import pygame

import random

color = False

colors = ["black", "gray", "white", "red", "green", "navy", "orange", "purple", "yellow", "magenta"]

world = []

cursorpos = [100, 100]

buffer = ""

rule = input("Rule: ")

if (rule == ""):
	
	bconds = [3]
	
	sconds = [2, 3]
	
else:
	
	bstr = rule[1:rule.index("/")]
	
	bconds = []
	
	sconds = []
	
	if rule[-1] != "S":
		
		sstr = rule[rule.index("S") + 1:]
			
		for condition in sstr:
			
			sconds.append(int(condition))
			
	for condition in bstr:
			
			bconds.append(int(condition))

for y in range(0, 200):
	
	world.append([0] * 200)
	
def makeworld(rle): # Assists in the conversion of an RLE to a matrix
	
	rlel = list(rle)
	
	mat = []
	
	for y in range(0, 200):
		
		mat.append([])
		
		for x in range(0, 200):
			
			mat[-1].append(0)
	
	digits = "0123456789"
	
	y = 0
	
	x = 0
	
	num = 0
	
	for char in rlel:
		
		if char in digits:
			
			num = num * 10 + int(char)
			
		else:
			
			if char == "b":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 0
					
					x += 1
					
			if char == "o":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 1
					
					x += 1
					
			if char == "$":
				
				x = 0
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					y += 1
					
			num = 0
			
	return(mat)
	
def makerle(mat): # Does the opposite of the previous function
	
	rlel = []
	
	num = 1
	
	for row in mat:
		
		for cell in row:
			
			if cell == 0:
				
				rlel.append("b")
				
			else:
				
				rlel.append("o")
				
		rlel.append("$")
		
	rlel[len(rlel) - 1] = "!"
	
	listinit = rlel
		
	rle = "".join(listinit)
	
	return(rle)

rle = input("RLE (must be headerless, may be empty): ")

world = makeworld(rle)

pygame.init()

screen = pygame.display.set_mode((1000, 1000))

rectworld = []

for y in range(0, 200):
	
	rectworld.append([])
	
	for x in range(0, 200):
		
		rectworld[-1].append(pygame.Rect(x * 5, y * 5, 5, 5))
		
clock = pygame.time.Clock()

step = 0

running = True

dt = 0

def advance(world):
	
	global color
	
	global sconds
	
	neigh = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]]
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			neighs = 0
			
			for n in range(0, 8):
				
				newx = (x + neigh[n][1]) % 200
				
				newy = (y + neigh[n][0]) % 200
				
				if (world[newy][newx] != 0):
					
					neighs += 1
					
			if world[y][x] == 0 and (neighs in bconds):
				
				if not color:
					
					world[y][x] = 1
					
				else:
					
					world[y][x] = neighs + 1
					
				continue
				
			if world[y][x] != 0 and (neighs not in sconds):
				
				world[y][x] = 0
				
				continue
				
			if world[y][x] != 0 and (neighs in sconds):
				
				if color:
					
					world[y][x] = neighs + 1
					
				else:
					
					if world[y][x] != 1:
						
						world[y][x] = 1
						
	return world
	
def show(world):
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			if world[y][x] != 0:
				
				if not color:
					
					pygame.draw.rect(screen, "white", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, colors[world[y][x]], rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
				
				if world[y][x] == 3:
					
					pygame.draw.rect(screen, "blue", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, "red", rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
				
				pygame.draw.rect(screen, "maroon", rectworld[y][x])
				
def randfill():
	
	global world
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			world[y][x] = random.randint(0, 1)
			
	return world
	
while running:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			running = False
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_k:
				if color:
					color = False
				else:
					color = True
			if event.key == pygame.K_q:
				running = False
			if event.key == pygame.K_r:
				world = randfill()
			if event.key == pygame.K_c:
				print(makerle(world))
				buffer = makerle(world)
			if event.key == pygame.K_v:
				world = makeworld(buffer)
			if event.key == pygame.K_EQUALS:
				world = advance(world)
			if event.key == pygame.K_UP:
				cursorpos[0] -= 1
				cursorpos[0] %= 200
			if event.key == pygame.K_DOWN:
				cursorpos[0] += 1
				cursorpos[0] %= 200
			if event.key == pygame.K_LEFT:
				cursorpos[1] -= 1
				cursorpos[1] %= 200
			if event.key == pygame.K_RIGHT:
				cursorpos[1] += 1
				cursorpos[1] %= 200
			if event.key == pygame.K_RETURN:
				world[cursorpos[0]][cursorpos[1]] += 1
				world[cursorpos[0]][cursorpos[1]] %= 2
				
		keys = pygame.key.get_pressed()
		
		if keys[pygame.K_SPACE]:
			world = advance(world)
		if keys[pygame.K_w]:
			cursorpos[0] -= 1
			cursorpos[0] %= 200
		if keys[pygame.K_s]:
			cursorpos[0] += 1
			cursorpos[0] %= 200
		if keys[pygame.K_a]:
			cursorpos[1] -= 1
			cursorpos[1] %= 200
		if keys[pygame.K_d]:
			cursorpos[1] += 1
			cursorpos[1] %= 200
		
	screen.fill("black")
	
	show(world)
	
	pygame.display.flip()
	
	dt = clock.tick(60) / 1000
	
pygame.quit()
Improvements:

- Added color-by-neighbors viewing (K key)

- Fixed copy/paste bugs

- Fixed orientation bugs

- Added WASD keys for long-range movement and arrow keys for short-range movement

However, there is still much to improve. Support for isotropic non-totalistic rules is planned in the future (so we could have a NaiveHaven or a NaiveTravellingTs).

Feel free to use this thread to post any images made using this program, but most of all, to explore!
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
I6_I6
Posts: 999
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by I6_I6 »

I've tried it out, but I don't quite understand how it's supposed to work. Could you explain the features and keybinds and stuff?

EDIT:
Suggested features:
  • Click/drag to draw
  • Change rule while simulating
I'm not sure if pygame is the best for this (not that I know of any better alternatives (other than maybe creating a website)).

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

I6_I6 wrote: July 2nd, 2026, 3:38 am I've tried it out, but I don't quite understand how it's supposed to work. Could you explain the features and keybinds and stuff?
No problem!

The program will start by asking you for a rule. If you want to specify a rule, write it in B/S format. If you do not specify a rule, B3/S23 will be assumed as the default.

The program will also ask you for an RLE (headerless). If you choose not to write one, an empty pattern is created.

You can draw with the arrow keys and the Enter key. Repeatedly clicking the Enter key will toggle the cell underneath the cursor.

For long-range movement, you can use the WASD keys, which are better for this kind of movement.

To advance a pattern one tick, use the equals key.

To advance a pattern multiple ticks, hold the space key.

You can copy patterns using the C key and paste them from its buffer using the V key.

You can generate random patterns using the R key.

Whenever you copy a pattern, its RLE is printed on the terminal and saved to the buffer in case you want to use it outside the program.

You can also press K to toggle colors. Note that you need to advance the pattern one tick for the colors to take effect.

Was this short guide helpful?
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
I6_I6
Posts: 999
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by I6_I6 »

Thanks for the explanation!
Here's a version with slightly improved rule input:

Code: Select all

import pygame
import random
import re

color = False

colors = ["black", "gray", "white", "red", "green", "navy", "orange", "purple", "yellow", "magenta"]

world = []

cursorpos = [100, 100]

buffer = ""

while True:
    rule = input("Rule: ").strip().lower()

    if (rule == ""):
        bconds = [3]
        sconds = [2, 3]
        break

    else:
        if re.fullmatch(r'b(\d*)/s(\d*)', rule):
            bconds, sconds = [list(map(int, s[1:])) for s in rule.split("/")]
            break

        else:
            print("Invalid rulestring. Please try again.")

for y in range(0, 200):
    world.append([0] * 200)


def makeworld(rle):  # Assists in the conversion of an RLE to a matrix

    rlel = list(rle)

    mat = []

    for y in range(0, 200):

        mat.append([])

        for x in range(0, 200):
            mat[-1].append(0)

    digits = "0123456789"

    y = 0

    x = 0

    num = 0

    for char in rlel:

        if char in digits:

            num = num * 10 + int(char)

        else:

            if char == "b":

                if num == 0:

                    num2 = 1

                else:

                    num2 = num

                for n in range(0, num2):
                    mat[y][x] = 0

                    x += 1

            if char == "o":

                if num == 0:

                    num2 = 1

                else:

                    num2 = num

                for n in range(0, num2):
                    mat[y][x] = 1

                    x += 1

            if char == "$":

                x = 0

                if num == 0:

                    num2 = 1

                else:

                    num2 = num

                for n in range(0, num2):
                    y += 1

            num = 0

    return (mat)


def makerle(mat):  # Does the opposite of the previous function

    rlel = []

    num = 1

    for row in mat:

        for cell in row:

            if cell == 0:

                rlel.append("b")

            else:

                rlel.append("o")

        rlel.append("$")

    rlel[len(rlel) - 1] = "!"

    listinit = rlel

    rle = "".join(listinit)

    return (rle)


rle = input("RLE (must be headerless, may be empty): ")

world = makeworld(rle)

pygame.init()

screen = pygame.display.set_mode((1000, 1000))

rectworld = []

for y in range(0, 200):

    rectworld.append([])

    for x in range(0, 200):
        rectworld[-1].append(pygame.Rect(x * 5, y * 5, 5, 5))

clock = pygame.time.Clock()

step = 0

running = True

dt = 0


def advance(world):
    global color, sconds

    neigh = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]]

    for y in range(0, 200):

        for x in range(0, 200):
            neighs = 0

            for n in range(0, 8):

                newx = (x + neigh[n][1]) % 200
                newy = (y + neigh[n][0]) % 200

                if (world[newy][newx] != 0):
                    neighs += 1

            if world[y][x] == 0 and (neighs in bconds):

                if not color:
                    world[y][x] = 1

                else:
                    world[y][x] = neighs + 1
                continue

            if world[y][x] != 0 and (neighs not in sconds):
                world[y][x] = 0
                continue

            if world[y][x] != 0 and (neighs in sconds):

                if color:
                    world[y][x] = neighs + 1

                else:
                    if world[y][x] != 1:
                        world[y][x] = 1

    return world


def show(world):
    for y in range(0, 200):
        for x in range(0, 200):
            if world[y][x] != 0:

                if not color:
                    pygame.draw.rect(screen, "white", rectworld[y][x])

                else:
                    pygame.draw.rect(screen, colors[world[y][x]], rectworld[y][x])

            if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:

                if world[y][x] == 3:
                    pygame.draw.rect(screen, "blue", rectworld[y][x])

                else:
                    pygame.draw.rect(screen, "red", rectworld[y][x])

            if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
                pygame.draw.rect(screen, "maroon", rectworld[y][x])


def randfill():
    global world

    for y in range(0, 200):

        for x in range(0, 200):
            world[y][x] = random.randint(0, 1)

    return world


while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_k:
                if color:
                    color = False
                else:
                    color = True
            if event.key == pygame.K_q:
                running = False
            if event.key == pygame.K_r:
                world = randfill()
            if event.key == pygame.K_c:
                print(makerle(world))
                buffer = makerle(world)
            if event.key == pygame.K_v:
                world = makeworld(buffer)
            if event.key == pygame.K_EQUALS:
                world = advance(world)
            if event.key == pygame.K_UP:
                cursorpos[0] -= 1
                cursorpos[0] %= 200
            if event.key == pygame.K_DOWN:
                cursorpos[0] += 1
                cursorpos[0] %= 200
            if event.key == pygame.K_LEFT:
                cursorpos[1] -= 1
                cursorpos[1] %= 200
            if event.key == pygame.K_RIGHT:
                cursorpos[1] += 1
                cursorpos[1] %= 200
            if event.key == pygame.K_RETURN:
                world[cursorpos[0]][cursorpos[1]] += 1
                world[cursorpos[0]][cursorpos[1]] %= 2

        keys = pygame.key.get_pressed()

        if keys[pygame.K_SPACE]:
            world = advance(world)
        if keys[pygame.K_w]:
            cursorpos[0] -= 1
            cursorpos[0] %= 200
        if keys[pygame.K_s]:
            cursorpos[0] += 1
            cursorpos[0] %= 200
        if keys[pygame.K_a]:
            cursorpos[1] -= 1
            cursorpos[1] %= 200
        if keys[pygame.K_d]:
            cursorpos[1] += 1
            cursorpos[1] %= 200

    screen.fill("black")
    show(world)
    pygame.display.flip()
    dt = clock.tick(60) / 1000

pygame.quit()
Suggestion: Create a World class.

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

I6_I6 wrote: July 2nd, 2026, 4:06 am Thanks for the explanation!
Here's a version with slightly improved rule input:

[...]
Thank you for uploading this! Your version is now v1.0.2 of NaiViewer.
I6_I6 wrote: July 2nd, 2026, 4:06 am
[...]

Suggestion: Create a World class.
I didn't notice this until I quoted your post to make my reply, but I'll consider it in the future.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

NaiViewer - a program for simulating INT naiverules

Post by MDA »

Beta version v1.1.-1 is out:

Code: Select all

import pygame

import random

color = False

colors = ["black", "gray", "white", "red", "green", "navy", "orange", "purple", "yellow", "magenta"]

world = []

cursorpos = [100, 100]

buffer = ""

rule = input("Rule: ")

def rparse(rule):
	
	# Complete isotropic tables (made by hand) for rule identification.
	
	x0 = ["00000000"]
	x8 = ["11111111"]
	c1 = ["01000000","00010000","00000100","00000001"]
	c2 = ["01010000","00010100","00000101","01000001"]
	c3 = ["01010100","00010101","01000101","01010001"]
	c4 = ["01010101"]
	c5 = ["10101110","10111010","11101010","10101011"]
	c6 = ["10111110","11111010","11101011","10101111"]
	c7 = ["10111111","11101111","11111011","11111110"]
	e1 = ["10000000","00100000","00001000","00000010"]
	e2 = ["10100000","00101000","00001010","10000010"]
	e3 = ["10101000","00101010","10001010","10100010"]
	e4 = ["10101010"]
	e5 = ["01011101","01110101","11010101","01010111"]
	e6 = ["01011111","01111101","11110101","11010111"]
	e7 = ["01111111","11111101","11110111","11011111"]
	k2 = ["10010000","10000100","00100100","00010010","00001001","01001000","01000010","00100001"]
	k3 = ["10100100","10010010","01001010","00101001"]
	k4 = ["10110100","10010110","11010010","10100101","01001011","01101001","00101101","01011010"]
	k5 = ["10110101","11010110","01011011","01101101"]
	k6 = ["10111101","11011110","11110110","10110111","11011011","11101101","01101111","01111011"]
	a2 = ["11000000","01100000","00110000","00011000","00001100","00000110","00000011","10000001"]
	a3 = ["11100000","00111000","00001110","10000011"]
	a4 = ["11110000","01111000","00111100","00011110","00001111","10000111","11000011","11100001"]
	a5 = ["01111100","00111110","10001111","11100011"]
	a6 = ["11111100","01111110","00111111","10011111","11001111","11100111","11110011","11111001"]
	i2 = ["10001000","00100010"]
	i3 = ["11000001","01110000","00011100","00000111"]
	i4 = ["11011000","00110110","10001101","01100011"]
	i5 = ["11111000","00111110","10001111","11100011"]
	i6 = ["01110111","11011101"]
	n2 = ["01000100","00010001"]
	n3 = ["11010000","10000101","00110100","00010110","00001101","01011000","01000011","01100001"]
	n4 = ["01110100","00010111","11010001","11000101","01000111","01110001","00011101","01011100"]
	n5 = ["10111100","10011110","11110010","10100111","11001011","11101001","00101111","01111010"]
	n6 = ["11101110","10111011"]
	y3 = ["10010100","00100101","01001001","01010010"]
	y4 = ["11010100","10010101","01010011","01100101","01001101","01011001","00110101","01010110"]
	y5 = ["01101011","10101101","10110110","11011010"]
	q3 = ["11000100","10010001","00010011","01100100","01001100","00011001","00110001","01000110"]
	q4 = ["11100100","10010011","01001110","00111001"]
	q5 = ["11101100","10011011","10110011","11100110","11001110","10111001","00111011","01101110"]
	j3 = ["10110000","10000110","11000010","10100001","00001011","01101000","00101100","00011010"]
	j4 = ["10101100","10011010","10110010","10100110","11001010","10101001","00101011","01101010"]
	j5 = ["11110100","10010111","11010011","11100101","01001111","01111001","11100101","11010011"]
	r3 = ["11001000","10001001","00100011","01100010","10001100","10011000","00110010","00100110"]
	r4 = ["11101000","10001011","10100011","11100010","10001110","10111000","00111010","00101110"]
	r5 = ["11011100","10011101","01110011","01100111","11001101","11011001","00110111","01110110"]
	t4 = ["10011100","01110010","11001001","00100111"]
	w4 = ["11011000","01100011","10001101","00110110"]
	z4 = ["11001100","10011001","00110011","01100110"]
	
	numstr = "012345678/"
	
	if rule == "":
		
		rule = "B3/S23"
	
	rulelist = list(rule)
	
	blist = rulelist[1:rulelist.index("S")]
	
	slist = rulelist[rulelist.index("S") + 1:]
	
	bconds = []
	
	sconds = []
	
	if "0" in blist:
		
		for c in x0:
			
			bconds.append(c)
			
	if "1" in blist:
		
		if blist[blist.index("1") + 1] in numstr:
			
			for c in c1:
				
				bconds.append(c)
				
			for c in e1:
				
				bconds.append(c)
		
		for n in range(blist.index("1") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist1 = blist[blist.index("1"):n]
				
				break
				
		if "-" in blist1:
			
			B1Negating = True
			
		else:
			
			B1Negating = False
			
		if B1Negating == True:
			
			if "c" not in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" not in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
	if "2" in blist:
		
		if blist[blist.index("2") + 1] in numstr:
			
			for c in c2:
				
				bconds.append(c)
				
			for c in e2:
				
				bconds.append(c)
				
			for c in k2:
				
				bconds.append(c)
				
			for c in a2:
				
				bconds.append(c)
				
			for c in i2:
				
				bconds.append(c)
				
			for c in n2:
				
				bconds.append(c)
				
		for n in range(blist.index("2") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist2 = blist[blist.index("2"):n]
				
				break
				
		if "-" in blist2:
			
			B2Negating = True
			
		else:
			
			B2Negating = False
			
		if B2Negating == True:
			
			if "c" not in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" not in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" not in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" not in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" not in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" not in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
	if "3" in blist:
		
		if blist[blist.index("3") + 1] in numstr:
			
			for c in c3:
				
				bconds.append(c)
				
			for c in e3:
				
				bconds.append(c)
				
			for c in k3:
				
				bconds.append(c)
				
			for c in a3:
				
				bconds.append(c)
				
			for c in i3:
				
				bconds.append(c)
				
			for c in n3:
				
				bconds.append(c)
				
			for c in y3:
				
				bconds.append(c)
				
			for c in q3:
				
				bconds.append(c)
				
			for c in j3:
				
				bconds.append(c)
				
			for c in r3:
				
				bconds.append(c)
				
		for n in range(blist.index("3") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist3 = blist[blist.index("3"):n]
				
				break
				
		if "-" in blist3:
			
			B3Negating = True
			
		else:
			
			B3Negating = False
			
		if B3Negating == True:
			
			if "c" not in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" not in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" not in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" not in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" not in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" not in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" not in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" not in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" not in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" not in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
	if "4" in blist:
		
		if blist[blist.index("4") + 1] in numstr:
			
			for c in c4:
				
				bconds.append(c)
				
			for c in e4:
				
				bconds.append(c)
				
			for c in k4:
				
				bconds.append(c)
				
			for c in a4:
				
				bconds.append(c)
				
			for c in i4:
				
				bconds.append(c)
				
			for c in n4:
				
				bconds.append(c)
				
			for c in y4:
				
				bconds.append(c)
				
			for c in q4:
				
				bconds.append(c)
				
			for c in j4:
				
				bconds.append(c)
				
			for c in r4:
				
				bconds.append(c)
				
			for c in t4:
				
				bconds.append(c)
				
			for c in w4:
				
				bconds.append(c)
				
			for c in z4:
				
				bconds.append(c)
				
		for n in range(blist.index("4") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist4 = blist[blist.index("4"):n]
				
				break
				
		if "-" in blist4:
			
			B4Negating = True
			
		else:
			
			B4Negating = False
			
		if B4Negating == True:
			
			if "c" not in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" not in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" not in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" not in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" not in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" not in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" not in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" not in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" not in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" not in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" not in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" not in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" not in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
	if "5" in blist:
		
		if blist[blist.index("5") + 1] in numstr:
			
			for c in c5:
				
				bconds.append(c)
				
			for c in e5:
				
				bconds.append(c)
				
			for c in k5:
				
				bconds.append(c)
				
			for c in a5:
				
				bconds.append(c)
				
			for c in i5:
				
				bconds.append(c)
				
			for c in n5:
				
				bconds.append(c)
				
			for c in y5:
				
				bconds.append(c)
				
			for c in q5:
				
				bconds.append(c)
				
			for c in j5:
				
				bconds.append(c)
				
			for c in r5:
				
				bconds.append(c)
				
		for n in range(blist.index("5") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist5 = blist[blist.index("5"):n]
				
				break
				
		if "-" in blist5:
			
			B5Negating = True
			
		else:
			
			B5Negating = False
			
		if B5Negating == True:
			
			if "c" not in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" not in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" not in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" not in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" not in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" not in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" not in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" not in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" not in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" not in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
	if "6" in blist:
		
		if blist[blist.index("6") + 1] in numstr:
			
			for c in c6:
				
				bconds.append(c)
				
			for c in e6:
				
				bconds.append(c)
				
			for c in k6:
				
				bconds.append(c)
				
			for c in a6:
				
				bconds.append(c)
				
			for c in i6:
				
				bconds.append(c)
				
			for c in n6:
				
				bconds.append(c)
				
		for n in range(blist.index("6") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist6 = blist[blist.index("6"):n]
				
				break
				
		if "-" in blist6:
			
			B6Negating = True
			
		else:
			
			B6Negating = False
			
		if B6Negating == True:
			
			if "c" not in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" not in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" not in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" not in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" not in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" not in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
	if "7" in blist:
		
		if blist[blist.index("7") + 1] in numstr:
			
			for c in c7:
				
				bconds.append(c)
				
			for c in e7:
				
				bconds.append(c)
		
		for n in range(blist.index("7") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist7 = blist[blist.index("7"):n]
				
				break
				
		if "-" in blist7:
			
			B7Negating = True
			
		else:
			
			B7Negating = False
			
		if B7Negating == True:
			
			if "c" not in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" not in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
	if "8" in blist:
		
		for c in x8:
			
			bconds.append(c)
			
	if "0" in slist:
		
		for c in x0:
			
			sconds.append(c)
			
	if "1" in slist:
		
		try:
			
			if slist[slist.index("1") + 1] in numstr:
				
				for c in c1:
					
					sconds.append(c)
					
				for c in e1:
					
					sconds.append(c)
			
			for n in range(slist.index("1") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist1 = slist[slist.index("1"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist1 = slist[slist.index("1"):n + 1]
					
					break
					
		except IndexError:
			
			slist1 = ["1"]
			
			for c in c1:
				
				sconds.append(c)
				
			for c in e1:
				
				sconds.append(e)
				
		if "-" in slist1:
			
			S1Negating = True
			
		else:
			
			S1Negating = False
			
		if S1Negating == True:
			
			if "c" not in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" not in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
	if "2" in slist:
		
		try:
		
			if slist[slist.index("2") + 1] in numstr:
				
				for c in c2:
					
					sconds.append(c)
					
				for c in e2:
					
					sconds.append(c)
					
				for c in k2:
					
					sconds.append(c)
					
				for c in a2:
					
					sconds.append(c)
					
				for c in i2:
					
					sconds.append(c)
					
				for c in n2:
					
					sconds.append(c)
					
			for n in range(slist.index("2") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist2 = slist[slist.index("2"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist2 = slist[slist.index("2"):n + 1]
					
					break
					
		except IndexError:
			
			slist2 = ["2"]
				
			for c in c2:
				
				sconds.append(c)
				
			for c in e2:
				
				sconds.append(c)
				
			for c in k2:
				
				sconds.append(c)
				
			for c in a2:
				
				sconds.append(c)
				
			for c in i2:
				
				sconds.append(c)
				
			for c in n2:
				
				sconds.append(c)
				
		if "-" in slist2:
			
			S2Negating = True
			
		else:
			
			S2Negating = False
			
		if S2Negating == True:
			
			if "c" not in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" not in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" not in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" not in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" not in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" not in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
	if "3" in slist:
		
		try:
			
			if slist[slist.index("3") + 1] in numstr:
				
				for c in c3:
					
					sconds.append(c)
					
				for c in e3:
					
					sconds.append(c)
					
				for c in k3:
					
					sconds.append(c)
					
				for c in a3:
					
					sconds.append(c)
					
				for c in i3:
					
					sconds.append(c)
					
				for c in n3:
					
					sconds.append(c)
					
				for c in y3:
					
					sconds.append(c)
					
				for c in q3:
					
					sconds.append(c)
					
				for c in j3:
					
					sconds.append(c)
					
				for c in r3:
					
					sconds.append(c)
					
			for n in range(slist.index("3") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist3 = slist[slist.index("3"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist3 = slist[slist.index("3"):n + 1]
					
					break
					
		except IndexError:
			
			slist3 = ["3"]
			
			for c in c3:
				
				sconds.append(c)
				
			for c in e3:
				
				sconds.append(c)
				
			for c in k3:
				
				sconds.append(c)
				
			for c in a3:
				
				sconds.append(c)
				
			for c in i3:
				
				sconds.append(c)
				
			for c in n3:
				
				sconds.append(c)
				
			for c in y3:
				
				sconds.append(c)
				
			for c in q3:
				
				sconds.append(c)
				
			for c in j3:
				
				sconds.append(c)
				
			for c in r3:
				
				sconds.append(c)
				
		if "-" in slist3:
			
			S3Negating = True
			
		else:
			
			S3Negating = False
			
		if S3Negating == True:
			
			if "c" not in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" not in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" not in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" not in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" not in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" not in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" not in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" not in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" not in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" not in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
	if "4" in slist:
		
		try:
			
			if slist[slist.index("4") + 1] in numstr:
				
				for c in c4:
					
					sconds.append(c)
					
				for c in e4:
					
					sconds.append(c)
					
				for c in k4:
					
					sconds.append(c)
					
				for c in a4:
					
					sconds.append(c)
					
				for c in i4:
					
					sconds.append(c)
					
				for c in n4:
					
					sconds.append(c)
					
				for c in y4:
					
					sconds.append(c)
					
				for c in q4:
					
					sconds.append(c)
					
				for c in j4:
					
					sconds.append(c)
					
				for c in r4:
					
					sconds.append(c)
					
				for c in t4:
					
					sconds.append(c)
					
				for c in w4:
					
					sconds.append(c)
					
				for c in z4:
					
					sconds.append(c)
					
			for n in range(slist.index("4") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist4 = slist[slist.index("4"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist4 = slist[slist.index("4"):n + 1]
					
					break
					
		except IndexError:
			
			slist4 = ["4"]
			
			for c in c4:
				
				sconds.append(c)
				
			for c in e4:
				
				sconds.append(c)
				
			for c in k4:
				
				sconds.append(c)
				
			for c in a4:
				
				sconds.append(c)
				
			for c in i4:
				
				sconds.append(c)
				
			for c in n4:
				
				sconds.append(c)
				
			for c in y4:
				
				sconds.append(c)
				
			for c in q4:
				
				sconds.append(c)
				
			for c in j4:
				
				sconds.append(c)
				
			for c in r4:
				
				sconds.append(c)
				
			for c in t4:
				
				sconds.append(c)
				
			for c in w4:
				
				sconds.append(c)
				
			for c in z4:
				
				sconds.append(c)
				
		if "-" in slist4:
			
			S4Negating = True
			
		else:
			
			S4Negating = False
			
		if S4Negating == True:
			
			if "c" not in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" not in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" not in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" not in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" not in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" not in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" not in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" not in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" not in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" not in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" not in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" not in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" not in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
	if "5" in slist:
		
		try:
			
			if slist[slist.index("5") + 1] in numstr:
				
				for c in c5:
					
					sconds.append(c)
					
				for c in e5:
					
					sconds.append(c)
					
				for c in k5:
					
					sconds.append(c)
					
				for c in a5:
					
					sconds.append(c)
					
				for c in i5:
					
					sconds.append(c)
					
				for c in n5:
					
					sconds.append(c)
					
				for c in y5:
					
					sconds.append(c)
					
				for c in q5:
					
					sconds.append(c)
					
				for c in j5:
					
					sconds.append(c)
					
				for c in r5:
					
					sconds.append(c)
					
			for n in range(slist.index("5") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist5 = slist[slist.index("5"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist5 = slist[slist.index("5"):n + 1]
					
					break
					
		except IndexError:
			
			slist5 = ["5"]
				
			for c in c5:
				
				sconds.append(c)
				
			for c in e5:
				
				sconds.append(c)
				
			for c in k5:
				
				sconds.append(c)
				
			for c in a5:
				
				sconds.append(c)
				
			for c in i5:
				
				sconds.append(c)
				
			for c in n5:
				
				sconds.append(c)
				
			for c in y5:
				
				sconds.append(c)
				
			for c in q5:
				
				sconds.append(c)
				
			for c in j5:
				
				sconds.append(c)
				
			for c in r5:
				
				sconds.append(c)
				
		if "-" in slist5:
			
			S5Negating = True
			
		else:
			
			S5Negating = False
			
		if S5Negating == True:
			
			if "c" not in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" not in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" not in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" not in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" not in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" not in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" not in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" not in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" not in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" not in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
	if "6" in slist:
		
		try:
			
			if slist[slist.index("6") + 1] in numstr:
				
				for c in c6:
					
					sconds.append(c)
					
				for c in e6:
					
					sconds.append(c)
					
				for c in k6:
					
					sconds.append(c)
					
				for c in a6:
					
					sconds.append(c)
					
				for c in i6:
					
					sconds.append(c)
					
				for c in n6:
					
					sconds.append(c)
					
			for n in range(slist.index("6") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist6 = slist[slist.index("6"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist6 = slist[slist.index("6"):n + 1]
					
					break
					
		except IndexError:
			
			slist6 = ["6"]
				
			for c in c6:
				
				sconds.append(c)
				
			for c in e6:
				
				sconds.append(c)
				
			for c in k6:
				
				sconds.append(c)
				
			for c in a6:
				
				sconds.append(c)
				
			for c in i6:
				
				sconds.append(c)
				
			for c in n6:
				
				sconds.append(c)
				
		if "-" in slist6:
			
			S6Negating = True
			
		else:
			
			S6Negating = False
			
		if S6Negating == True:
			
			if "c" not in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" not in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" not in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" not in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" not in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" not in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
	if "7" in slist:
		
		try:
			
			if slist[slist.index("7") + 1] in numstr:
				
				for c in c7:
					
					sconds.append(c)
					
				for c in e7:
					
					sconds.append(c)
					
			for n in range(slist.index("7") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist7 = slist[slist.index("7"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist7 = slist[slist.index("7"):n + 1]
					
					break
					
		except IndexError:
			
			slist7 = ["7"]
				
			for c in c7:
				
				sconds.append(c)
				
			for c in e7:
				
				sconds.append(c)
				
		if "-" in slist7:
			
			S7Negating = True
			
		else:
			
			S7Negating = False
			
		if S7Negating == True:
			
			if "c" not in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" not in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
	if "8" in slist:
		
		for c in x8:
			
			sconds.append(c)
			
	l = [bconds,sconds]
	
	return(l)
	
conditions = rparse(rule)

for y in range(0, 200):
	
	world.append([0] * 200)
	
def makeworld(rle): # Assists in the conversion of an RLE to a matrix
	
	rlel = list(rle)
	
	mat = []
	
	for y in range(0, 200):
		
		mat.append([])
		
		for x in range(0, 200):
			
			mat[-1].append(0)
	
	digits = "0123456789"
	
	y = 0
	
	x = 0
	
	num = 0
	
	for char in rlel:
		
		if char in digits:
			
			num = num * 10 + int(char)
			
		else:
			
			if char == "b":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 0
					
					x += 1
					
			if char == "o":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 1
					
					x += 1
					
			if char == "$":
				
				x = 0
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					y += 1
					
			num = 0
			
	return(mat)
	
def makerle(mat): # Does the opposite of the previous function
	
	rlel = []
	
	num = 1
	
	for row in mat:
		
		for cell in row:
			
			if cell == 0:
				
				rlel.append("b")
				
			else:
				
				rlel.append("o")
				
		rlel.append("$")
		
	rlel[len(rlel) - 1] = "!"
	
	listinit = rlel
		
	rle = "".join(listinit)
	
	return(rle)

rle = input("RLE (must be headerless, may be empty): ")

world = makeworld(rle)

pygame.init()

screen = pygame.display.set_mode((1000, 1000))

rectworld = []

for y in range(0, 200):
	
	rectworld.append([])
	
	for x in range(0, 200):
		
		rectworld[-1].append(pygame.Rect(x * 5, y * 5, 5, 5))
		
clock = pygame.time.Clock()

step = 0

running = True

dt = 0

def advance(world):
	
	global color
	
	global conditions
	
	# neigh = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]]
	
	neigh = [[1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1], [0, 1], [1, 1]]
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			neighs = 0
			
			neighlist = []
			
			for n in range(0, 8):
				
				newx = x + neigh[n][1]
				
				newy = y + neigh[n][0]
				
				if newx == 200:
					
					newx = 199
					
				if newx == -1:
					
					newx = 0
					
				if newy == 200:
					
					newy = 199
					
				if newy == -1:
					
					newy = 0
					
				if (world[newy][newx] != 0):
					
					neighlist.append("1")
					
					neighs += 1
					
				else:
					
					neighlist.append("0")
					
					
			neighstr = "".join(neighlist)
			
			if world[y][x] == 0 and (neighstr in conditions[0]):
				
				if not color:
					
					world[y][x] = 1
					
				else:
					
					world[y][x] = neighs + 1
					
				continue
				
			if world[y][x] != 0 and (neighstr not in conditions[1]):
				
				world[y][x] = 0
				
				continue
				
			if world[y][x] != 0 and (neighstr in conditions[1]):
				
				if color:
					
					world[y][x] = neighs + 1
					
				else:
					
					if world[y][x] != 1:
						
						world[y][x] = 1
						
	return world
	
def show(world):
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			if world[y][x] != 0:
				
				if not color:
					
					pygame.draw.rect(screen, "white", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, colors[world[y][x]], rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
				
				if world[y][x] == 3:
					
					pygame.draw.rect(screen, "blue", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, "red", rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
				
				pygame.draw.rect(screen, "maroon", rectworld[y][x])
				
def randfill():
	
	global world
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			world[y][x] = random.randint(0, 1)
			
	return world
	
while running:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			running = False
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_k:
				if color:
					color = False
				else:
					color = True
			if event.key == pygame.K_q:
				running = False
			if event.key == pygame.K_r:
				world = randfill()
			if event.key == pygame.K_c:
				print(makerle(world))
				buffer = makerle(world)
			if event.key == pygame.K_v:
				world = makeworld(buffer)
			if event.key == pygame.K_t:
				rule = input("Rule: ")
				conditions = rparse(rule)
			if event.key == pygame.K_EQUALS:
				world = advance(world)
			if event.key == pygame.K_UP:
				cursorpos[0] -= 1
				cursorpos[0] %= 200
			if event.key == pygame.K_DOWN:
				cursorpos[0] += 1
				cursorpos[0] %= 200
			if event.key == pygame.K_LEFT:
				cursorpos[1] -= 1
				cursorpos[1] %= 200
			if event.key == pygame.K_RIGHT:
				cursorpos[1] += 1
				cursorpos[1] %= 200
			if event.key == pygame.K_RETURN:
				world[cursorpos[0]][cursorpos[1]] += 1
				world[cursorpos[0]][cursorpos[1]] %= 2
				
		keys = pygame.key.get_pressed()
		
		if keys[pygame.K_SPACE]:
			world = advance(world)
		if keys[pygame.K_w]:
			cursorpos[0] -= 1
			cursorpos[0] %= 200
		if keys[pygame.K_s]:
			cursorpos[0] += 1
			cursorpos[0] %= 200
		if keys[pygame.K_a]:
			cursorpos[1] -= 1
			cursorpos[1] %= 200
		if keys[pygame.K_d]:
			cursorpos[1] += 1
			cursorpos[1] %= 200
		
	screen.fill("black")
	
	show(world)
	
	pygame.display.flip()
	
	dt = clock.tick(60) / 1000
	
pygame.quit()
Improvements:

- Added experimental support for INT rules

- Replaced toroidal universe with bounded universe to avoid wrapping problems

- Added rule-changing (press T, switch to command-line, enter new rule, and go back to window)

All contributors are encouraged to reduce the size of this code. This beta version is roughly 2600 lines long, in contrast with the roughly 300 lines in the earlier version.
Last edited by MDA on July 2nd, 2026, 7:20 am, edited 1 time in total.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
aengmore
Posts: 28
Joined: June 24th, 2026, 11:11 pm

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by aengmore »

Mind commit it to Github? So that everyone can improve it. You can also co-operate with AI.
Last edited by aengmore on July 2nd, 2026, 6:11 am, edited 1 time in total.
aengmore
Posts: 28
Joined: June 24th, 2026, 11:11 pm

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by aengmore »

​EDIT: To make up for breaking forum rules, here's an optimized version of your code made by DeepSeek. I'm not sure if it works properly, though. :cry: If not, maybe you can gain some insights from it.
Last edited by aengmore on July 2nd, 2026, 7:10 am, edited 7 times in total.
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

aengmore wrote: July 2nd, 2026, 5:39 am Mind commit [sic] it to Github? So that everyone can inprove [sic] it
I don't have Github, so, until I decide to get it, you should edit my code individually and post your improvements here.

Edit (July 2nd, 2026, 10:42 AM):
aengmore wrote: July 2nd, 2026, 5:39 am Mind commit [sic] it to Github? So that everyone can inprove [sic] it
aengmore wrote: July 2nd, 2026, 5:40 am Mind commit [sic] it to Github? So that everyone can improve it. Or you can co-operate with AI
aengmore, the forum rules state that you should
Nathaniel wrote: March 18th, 2016, 8:52 pm
[...]

[...] not post multiple messages consecutively in the same thread without a good reason. If you made the most recent post on a thread and you have something short to add on the same topic, please edit your previous post instead of making a new one.

[...]
In this case, if you wanted to correct your spelling of "improve", you should have edited your first post instead of posting another one with the mistake corrected.

Edit (July 2nd, 2026, 12:02 PM):
aengmore wrote: July 2nd, 2026, 5:40 am ​EDIT: To make up for breaking forum rules, here's an optimized version of your code made by DeepSeek. I'm not sure if it works properly, though. :cry:
The Deepseek version of the code does not work properly, and as such, I will not be updating my code with it.
Last edited by MDA on July 5th, 2026, 4:51 am, edited 2 times in total.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
NNlk05
Posts: 596
Joined: January 14th, 2026, 8:42 pm
Location: Exploring in the Jungle of the INT Rulespace
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by NNlk05 »

MDA wrote: July 2nd, 2026, 5:41 am *snip*
Also, why is the conversation which you linked to in Chinese?
Um, because they writes in Chinese and feels more comfortable writing in it?
Feci quod potui, faciant meliora potentes.

Code: Select all

x = 10, y = 3, rule = B34twz/S23
b2o4b2o$obo4bobo$2bo4bo!
[[ AUTOSTART AUTOHIDEGUI TRACK 0 -47/270 ZOOM 4 GPS 45 STEP 3 THEME BOOK ]]
https://nnlk05.github.io

=3
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

NNlk05 wrote: July 2nd, 2026, 7:51 am
[...]

Um, because they writes [sic] in Chinese and feels [sic] more comfortable writing in it?
Sorry for asking.

I have a new version of my code (v1.1.-1.1) which improves the contrast between the navy used for B4 and S4 and the background color:

Code: Select all

import pygame

import random

color = False

colors = ["black", "gray", "white", "red", "green", "dodgerblue", "orange", "purple", "yellow", "magenta"]

world = []

cursorpos = [100, 100]

buffer = ""

rule = input("Rule: ")

def rparse(rule):
	
	# Complete isotropic tables (made by hand) for rule identification.
	
	x0 = ["00000000"]
	x8 = ["11111111"]
	c1 = ["01000000","00010000","00000100","00000001"]
	c2 = ["01010000","00010100","00000101","01000001"]
	c3 = ["01010100","00010101","01000101","01010001"]
	c4 = ["01010101"]
	c5 = ["10101110","10111010","11101010","10101011"]
	c6 = ["10111110","11111010","11101011","10101111"]
	c7 = ["10111111","11101111","11111011","11111110"]
	e1 = ["10000000","00100000","00001000","00000010"]
	e2 = ["10100000","00101000","00001010","10000010"]
	e3 = ["10101000","00101010","10001010","10100010"]
	e4 = ["10101010"]
	e5 = ["01011101","01110101","11010101","01010111"]
	e6 = ["01011111","01111101","11110101","11010111"]
	e7 = ["01111111","11111101","11110111","11011111"]
	k2 = ["10010000","10000100","00100100","00010010","00001001","01001000","01000010","00100001"]
	k3 = ["10100100","10010010","01001010","00101001"]
	k4 = ["10110100","10010110","11010010","10100101","01001011","01101001","00101101","01011010"]
	k5 = ["10110101","11010110","01011011","01101101"]
	k6 = ["10111101","11011110","11110110","10110111","11011011","11101101","01101111","01111011"]
	a2 = ["11000000","01100000","00110000","00011000","00001100","00000110","00000011","10000001"]
	a3 = ["11100000","00111000","00001110","10000011"]
	a4 = ["11110000","01111000","00111100","00011110","00001111","10000111","11000011","11100001"]
	a5 = ["01111100","00111110","10001111","11100011"]
	a6 = ["11111100","01111110","00111111","10011111","11001111","11100111","11110011","11111001"]
	i2 = ["10001000","00100010"]
	i3 = ["11000001","01110000","00011100","00000111"]
	i4 = ["11011000","00110110","10001101","01100011"]
	i5 = ["11111000","00111110","10001111","11100011"]
	i6 = ["01110111","11011101"]
	n2 = ["01000100","00010001"]
	n3 = ["11010000","10000101","00110100","00010110","00001101","01011000","01000011","01100001"]
	n4 = ["01110100","00010111","11010001","11000101","01000111","01110001","00011101","01011100"]
	n5 = ["10111100","10011110","11110010","10100111","11001011","11101001","00101111","01111010"]
	n6 = ["11101110","10111011"]
	y3 = ["10010100","00100101","01001001","01010010"]
	y4 = ["11010100","10010101","01010011","01100101","01001101","01011001","00110101","01010110"]
	y5 = ["01101011","10101101","10110110","11011010"]
	q3 = ["11000100","10010001","00010011","01100100","01001100","00011001","00110001","01000110"]
	q4 = ["11100100","10010011","01001110","00111001"]
	q5 = ["11101100","10011011","10110011","11100110","11001110","10111001","00111011","01101110"]
	j3 = ["10110000","10000110","11000010","10100001","00001011","01101000","00101100","00011010"]
	j4 = ["10101100","10011010","10110010","10100110","11001010","10101001","00101011","01101010"]
	j5 = ["11110100","10010111","11010011","11100101","01001111","01111001","11100101","11010011"]
	r3 = ["11001000","10001001","00100011","01100010","10001100","10011000","00110010","00100110"]
	r4 = ["11101000","10001011","10100011","11100010","10001110","10111000","00111010","00101110"]
	r5 = ["11011100","10011101","01110011","01100111","11001101","11011001","00110111","01110110"]
	t4 = ["10011100","01110010","11001001","00100111"]
	w4 = ["11011000","01100011","10001101","00110110"]
	z4 = ["11001100","10011001","00110011","01100110"]
	
	numstr = "012345678/"
	
	if rule == "":
		
		rule = "B3/S23"
	
	rulelist = list(rule)
	
	blist = rulelist[1:rulelist.index("S")]
	
	slist = rulelist[rulelist.index("S") + 1:]
	
	bconds = []
	
	sconds = []
	
	if "0" in blist:
		
		for c in x0:
			
			bconds.append(c)
			
	if "1" in blist:
		
		if blist[blist.index("1") + 1] in numstr:
			
			for c in c1:
				
				bconds.append(c)
				
			for c in e1:
				
				bconds.append(c)
		
		for n in range(blist.index("1") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist1 = blist[blist.index("1"):n]
				
				break
				
		if "-" in blist1:
			
			B1Negating = True
			
		else:
			
			B1Negating = False
			
		if B1Negating == True:
			
			if "c" not in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" not in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
	if "2" in blist:
		
		if blist[blist.index("2") + 1] in numstr:
			
			for c in c2:
				
				bconds.append(c)
				
			for c in e2:
				
				bconds.append(c)
				
			for c in k2:
				
				bconds.append(c)
				
			for c in a2:
				
				bconds.append(c)
				
			for c in i2:
				
				bconds.append(c)
				
			for c in n2:
				
				bconds.append(c)
				
		for n in range(blist.index("2") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist2 = blist[blist.index("2"):n]
				
				break
				
		if "-" in blist2:
			
			B2Negating = True
			
		else:
			
			B2Negating = False
			
		if B2Negating == True:
			
			if "c" not in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" not in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" not in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" not in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" not in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" not in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
	if "3" in blist:
		
		if blist[blist.index("3") + 1] in numstr:
			
			for c in c3:
				
				bconds.append(c)
				
			for c in e3:
				
				bconds.append(c)
				
			for c in k3:
				
				bconds.append(c)
				
			for c in a3:
				
				bconds.append(c)
				
			for c in i3:
				
				bconds.append(c)
				
			for c in n3:
				
				bconds.append(c)
				
			for c in y3:
				
				bconds.append(c)
				
			for c in q3:
				
				bconds.append(c)
				
			for c in j3:
				
				bconds.append(c)
				
			for c in r3:
				
				bconds.append(c)
				
		for n in range(blist.index("3") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist3 = blist[blist.index("3"):n]
				
				break
				
		if "-" in blist3:
			
			B3Negating = True
			
		else:
			
			B3Negating = False
			
		if B3Negating == True:
			
			if "c" not in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" not in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" not in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" not in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" not in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" not in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" not in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" not in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" not in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" not in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
	if "4" in blist:
		
		if blist[blist.index("4") + 1] in numstr:
			
			for c in c4:
				
				bconds.append(c)
				
			for c in e4:
				
				bconds.append(c)
				
			for c in k4:
				
				bconds.append(c)
				
			for c in a4:
				
				bconds.append(c)
				
			for c in i4:
				
				bconds.append(c)
				
			for c in n4:
				
				bconds.append(c)
				
			for c in y4:
				
				bconds.append(c)
				
			for c in q4:
				
				bconds.append(c)
				
			for c in j4:
				
				bconds.append(c)
				
			for c in r4:
				
				bconds.append(c)
				
			for c in t4:
				
				bconds.append(c)
				
			for c in w4:
				
				bconds.append(c)
				
			for c in z4:
				
				bconds.append(c)
				
		for n in range(blist.index("4") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist4 = blist[blist.index("4"):n]
				
				break
				
		if "-" in blist4:
			
			B4Negating = True
			
		else:
			
			B4Negating = False
			
		if B4Negating == True:
			
			if "c" not in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" not in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" not in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" not in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" not in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" not in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" not in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" not in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" not in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" not in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" not in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" not in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" not in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
	if "5" in blist:
		
		if blist[blist.index("5") + 1] in numstr:
			
			for c in c5:
				
				bconds.append(c)
				
			for c in e5:
				
				bconds.append(c)
				
			for c in k5:
				
				bconds.append(c)
				
			for c in a5:
				
				bconds.append(c)
				
			for c in i5:
				
				bconds.append(c)
				
			for c in n5:
				
				bconds.append(c)
				
			for c in y5:
				
				bconds.append(c)
				
			for c in q5:
				
				bconds.append(c)
				
			for c in j5:
				
				bconds.append(c)
				
			for c in r5:
				
				bconds.append(c)
				
		for n in range(blist.index("5") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist5 = blist[blist.index("5"):n]
				
				break
				
		if "-" in blist5:
			
			B5Negating = True
			
		else:
			
			B5Negating = False
			
		if B5Negating == True:
			
			if "c" not in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" not in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" not in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" not in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" not in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" not in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" not in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" not in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" not in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" not in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
	if "6" in blist:
		
		if blist[blist.index("6") + 1] in numstr:
			
			for c in c6:
				
				bconds.append(c)
				
			for c in e6:
				
				bconds.append(c)
				
			for c in k6:
				
				bconds.append(c)
				
			for c in a6:
				
				bconds.append(c)
				
			for c in i6:
				
				bconds.append(c)
				
			for c in n6:
				
				bconds.append(c)
				
		for n in range(blist.index("6") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist6 = blist[blist.index("6"):n]
				
				break
				
		if "-" in blist6:
			
			B6Negating = True
			
		else:
			
			B6Negating = False
			
		if B6Negating == True:
			
			if "c" not in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" not in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" not in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" not in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" not in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" not in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
	if "7" in blist:
		
		if blist[blist.index("7") + 1] in numstr:
			
			for c in c7:
				
				bconds.append(c)
				
			for c in e7:
				
				bconds.append(c)
		
		for n in range(blist.index("7") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist7 = blist[blist.index("7"):n]
				
				break
				
		if "-" in blist7:
			
			B7Negating = True
			
		else:
			
			B7Negating = False
			
		if B7Negating == True:
			
			if "c" not in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" not in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
	if "8" in blist:
		
		for c in x8:
			
			bconds.append(c)
			
	if "0" in slist:
		
		for c in x0:
			
			sconds.append(c)
			
	if "1" in slist:
		
		try:
			
			if slist[slist.index("1") + 1] in numstr:
				
				for c in c1:
					
					sconds.append(c)
					
				for c in e1:
					
					sconds.append(c)
			
			for n in range(slist.index("1") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist1 = slist[slist.index("1"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist1 = slist[slist.index("1"):n + 1]
					
					break
					
		except IndexError:
			
			slist1 = ["1"]
			
			for c in c1:
				
				sconds.append(c)
				
			for c in e1:
				
				sconds.append(e)
				
		if "-" in slist1:
			
			S1Negating = True
			
		else:
			
			S1Negating = False
			
		if S1Negating == True:
			
			if "c" not in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" not in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
	if "2" in slist:
		
		try:
		
			if slist[slist.index("2") + 1] in numstr:
				
				for c in c2:
					
					sconds.append(c)
					
				for c in e2:
					
					sconds.append(c)
					
				for c in k2:
					
					sconds.append(c)
					
				for c in a2:
					
					sconds.append(c)
					
				for c in i2:
					
					sconds.append(c)
					
				for c in n2:
					
					sconds.append(c)
					
			for n in range(slist.index("2") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist2 = slist[slist.index("2"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist2 = slist[slist.index("2"):n + 1]
					
					break
					
		except IndexError:
			
			slist2 = ["2"]
				
			for c in c2:
				
				sconds.append(c)
				
			for c in e2:
				
				sconds.append(c)
				
			for c in k2:
				
				sconds.append(c)
				
			for c in a2:
				
				sconds.append(c)
				
			for c in i2:
				
				sconds.append(c)
				
			for c in n2:
				
				sconds.append(c)
				
		if "-" in slist2:
			
			S2Negating = True
			
		else:
			
			S2Negating = False
			
		if S2Negating == True:
			
			if "c" not in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" not in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" not in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" not in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" not in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" not in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
	if "3" in slist:
		
		try:
			
			if slist[slist.index("3") + 1] in numstr:
				
				for c in c3:
					
					sconds.append(c)
					
				for c in e3:
					
					sconds.append(c)
					
				for c in k3:
					
					sconds.append(c)
					
				for c in a3:
					
					sconds.append(c)
					
				for c in i3:
					
					sconds.append(c)
					
				for c in n3:
					
					sconds.append(c)
					
				for c in y3:
					
					sconds.append(c)
					
				for c in q3:
					
					sconds.append(c)
					
				for c in j3:
					
					sconds.append(c)
					
				for c in r3:
					
					sconds.append(c)
					
			for n in range(slist.index("3") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist3 = slist[slist.index("3"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist3 = slist[slist.index("3"):n + 1]
					
					break
					
		except IndexError:
			
			slist3 = ["3"]
			
			for c in c3:
				
				sconds.append(c)
				
			for c in e3:
				
				sconds.append(c)
				
			for c in k3:
				
				sconds.append(c)
				
			for c in a3:
				
				sconds.append(c)
				
			for c in i3:
				
				sconds.append(c)
				
			for c in n3:
				
				sconds.append(c)
				
			for c in y3:
				
				sconds.append(c)
				
			for c in q3:
				
				sconds.append(c)
				
			for c in j3:
				
				sconds.append(c)
				
			for c in r3:
				
				sconds.append(c)
				
		if "-" in slist3:
			
			S3Negating = True
			
		else:
			
			S3Negating = False
			
		if S3Negating == True:
			
			if "c" not in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" not in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" not in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" not in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" not in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" not in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" not in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" not in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" not in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" not in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
	if "4" in slist:
		
		try:
			
			if slist[slist.index("4") + 1] in numstr:
				
				for c in c4:
					
					sconds.append(c)
					
				for c in e4:
					
					sconds.append(c)
					
				for c in k4:
					
					sconds.append(c)
					
				for c in a4:
					
					sconds.append(c)
					
				for c in i4:
					
					sconds.append(c)
					
				for c in n4:
					
					sconds.append(c)
					
				for c in y4:
					
					sconds.append(c)
					
				for c in q4:
					
					sconds.append(c)
					
				for c in j4:
					
					sconds.append(c)
					
				for c in r4:
					
					sconds.append(c)
					
				for c in t4:
					
					sconds.append(c)
					
				for c in w4:
					
					sconds.append(c)
					
				for c in z4:
					
					sconds.append(c)
					
			for n in range(slist.index("4") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist4 = slist[slist.index("4"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist4 = slist[slist.index("4"):n + 1]
					
					break
					
		except IndexError:
			
			slist4 = ["4"]
			
			for c in c4:
				
				sconds.append(c)
				
			for c in e4:
				
				sconds.append(c)
				
			for c in k4:
				
				sconds.append(c)
				
			for c in a4:
				
				sconds.append(c)
				
			for c in i4:
				
				sconds.append(c)
				
			for c in n4:
				
				sconds.append(c)
				
			for c in y4:
				
				sconds.append(c)
				
			for c in q4:
				
				sconds.append(c)
				
			for c in j4:
				
				sconds.append(c)
				
			for c in r4:
				
				sconds.append(c)
				
			for c in t4:
				
				sconds.append(c)
				
			for c in w4:
				
				sconds.append(c)
				
			for c in z4:
				
				sconds.append(c)
				
		if "-" in slist4:
			
			S4Negating = True
			
		else:
			
			S4Negating = False
			
		if S4Negating == True:
			
			if "c" not in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" not in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" not in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" not in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" not in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" not in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" not in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" not in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" not in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" not in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" not in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" not in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" not in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
	if "5" in slist:
		
		try:
			
			if slist[slist.index("5") + 1] in numstr:
				
				for c in c5:
					
					sconds.append(c)
					
				for c in e5:
					
					sconds.append(c)
					
				for c in k5:
					
					sconds.append(c)
					
				for c in a5:
					
					sconds.append(c)
					
				for c in i5:
					
					sconds.append(c)
					
				for c in n5:
					
					sconds.append(c)
					
				for c in y5:
					
					sconds.append(c)
					
				for c in q5:
					
					sconds.append(c)
					
				for c in j5:
					
					sconds.append(c)
					
				for c in r5:
					
					sconds.append(c)
					
			for n in range(slist.index("5") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist5 = slist[slist.index("5"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist5 = slist[slist.index("5"):n + 1]
					
					break
					
		except IndexError:
			
			slist5 = ["5"]
				
			for c in c5:
				
				sconds.append(c)
				
			for c in e5:
				
				sconds.append(c)
				
			for c in k5:
				
				sconds.append(c)
				
			for c in a5:
				
				sconds.append(c)
				
			for c in i5:
				
				sconds.append(c)
				
			for c in n5:
				
				sconds.append(c)
				
			for c in y5:
				
				sconds.append(c)
				
			for c in q5:
				
				sconds.append(c)
				
			for c in j5:
				
				sconds.append(c)
				
			for c in r5:
				
				sconds.append(c)
				
		if "-" in slist5:
			
			S5Negating = True
			
		else:
			
			S5Negating = False
			
		if S5Negating == True:
			
			if "c" not in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" not in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" not in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" not in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" not in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" not in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" not in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" not in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" not in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" not in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
	if "6" in slist:
		
		try:
			
			if slist[slist.index("6") + 1] in numstr:
				
				for c in c6:
					
					sconds.append(c)
					
				for c in e6:
					
					sconds.append(c)
					
				for c in k6:
					
					sconds.append(c)
					
				for c in a6:
					
					sconds.append(c)
					
				for c in i6:
					
					sconds.append(c)
					
				for c in n6:
					
					sconds.append(c)
					
			for n in range(slist.index("6") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist6 = slist[slist.index("6"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist6 = slist[slist.index("6"):n + 1]
					
					break
					
		except IndexError:
			
			slist6 = ["6"]
				
			for c in c6:
				
				sconds.append(c)
				
			for c in e6:
				
				sconds.append(c)
				
			for c in k6:
				
				sconds.append(c)
				
			for c in a6:
				
				sconds.append(c)
				
			for c in i6:
				
				sconds.append(c)
				
			for c in n6:
				
				sconds.append(c)
				
		if "-" in slist6:
			
			S6Negating = True
			
		else:
			
			S6Negating = False
			
		if S6Negating == True:
			
			if "c" not in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" not in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" not in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" not in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" not in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" not in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
	if "7" in slist:
		
		try:
			
			if slist[slist.index("7") + 1] in numstr:
				
				for c in c7:
					
					sconds.append(c)
					
				for c in e7:
					
					sconds.append(c)
					
			for n in range(slist.index("7") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist7 = slist[slist.index("7"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist7 = slist[slist.index("7"):n + 1]
					
					break
					
		except IndexError:
			
			slist7 = ["7"]
				
			for c in c7:
				
				sconds.append(c)
				
			for c in e7:
				
				sconds.append(c)
				
		if "-" in slist7:
			
			S7Negating = True
			
		else:
			
			S7Negating = False
			
		if S7Negating == True:
			
			if "c" not in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" not in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
	if "8" in slist:
		
		for c in x8:
			
			sconds.append(c)
			
	l = [bconds,sconds]
	
	return(l)
	
conditions = rparse(rule)

for y in range(0, 200):
	
	world.append([0] * 200)
	
def makeworld(rle): # Assists in the conversion of an RLE to a matrix
	
	rlel = list(rle)
	
	mat = []
	
	for y in range(0, 200):
		
		mat.append([])
		
		for x in range(0, 200):
			
			mat[-1].append(0)
	
	digits = "0123456789"
	
	y = 0
	
	x = 0
	
	num = 0
	
	for char in rlel:
		
		if char in digits:
			
			num = num * 10 + int(char)
			
		else:
			
			if char == "b":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 0
					
					x += 1
					
			if char == "o":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 1
					
					x += 1
					
			if char == "$":
				
				x = 0
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					y += 1
					
			num = 0
			
	return(mat)
	
def makerle(mat): # Does the opposite of the previous function
	
	rlel = []
	
	num = 1
	
	for row in mat:
		
		for cell in row:
			
			if cell == 0:
				
				rlel.append("b")
				
			else:
				
				rlel.append("o")
				
		rlel.append("$")
		
	rlel[len(rlel) - 1] = "!"
	
	listinit = rlel
		
	rle = "".join(listinit)
	
	return(rle)

rle = input("RLE (must be headerless, may be empty): ")

world = makeworld(rle)

pygame.init()

screen = pygame.display.set_mode((1000, 1000))

rectworld = []

for y in range(0, 200):
	
	rectworld.append([])
	
	for x in range(0, 200):
		
		rectworld[-1].append(pygame.Rect(x * 5, y * 5, 5, 5))
		
clock = pygame.time.Clock()

step = 0

running = True

dt = 0

def advance(world):
	
	global color
	
	global conditions
	
	# neigh = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]]
	
	neigh = [[1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1], [0, 1], [1, 1]]
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			neighs = 0
			
			neighlist = []
			
			for n in range(0, 8):
				
				newx = x + neigh[n][1]
				
				newy = y + neigh[n][0]
				
				if newx == 200:
					
					newx = 199
					
				if newx == -1:
					
					newx = 0
					
				if newy == 200:
					
					newy = 199
					
				if newy == -1:
					
					newy = 0
					
				if (world[newy][newx] != 0):
					
					neighlist.append("1")
					
					neighs += 1
					
				else:
					
					neighlist.append("0")
					
					
			neighstr = "".join(neighlist)
			
			if world[y][x] == 0 and (neighstr in conditions[0]):
				
				if not color:
					
					world[y][x] = 1
					
				else:
					
					world[y][x] = neighs + 1
					
				continue
				
			if world[y][x] != 0 and (neighstr not in conditions[1]):
				
				world[y][x] = 0
				
				continue
				
			if world[y][x] != 0 and (neighstr in conditions[1]):
				
				if color:
					
					world[y][x] = neighs + 1
					
				else:
					
					if world[y][x] != 1:
						
						world[y][x] = 1
						
	return world
	
def show(world):
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			if world[y][x] != 0:
				
				if not color:
					
					pygame.draw.rect(screen, "white", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, colors[world[y][x]], rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
				
				if world[y][x] == 3:
					
					pygame.draw.rect(screen, "blue", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, "red", rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
				
				pygame.draw.rect(screen, "maroon", rectworld[y][x])
				
def randfill():
	
	global world
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			world[y][x] = random.randint(0, 1)
			
	return world
	
while running:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			running = False
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_k:
				if color:
					color = False
				else:
					color = True
			if event.key == pygame.K_q:
				running = False
			if event.key == pygame.K_r:
				world = randfill()
			if event.key == pygame.K_c:
				print(makerle(world))
				buffer = makerle(world)
			if event.key == pygame.K_v:
				world = makeworld(buffer)
			if event.key == pygame.K_t:
				rule = input("Rule: ")
				conditions = rparse(rule)
			if event.key == pygame.K_EQUALS:
				world = advance(world)
			if event.key == pygame.K_UP:
				cursorpos[0] -= 1
				cursorpos[0] %= 200
			if event.key == pygame.K_DOWN:
				cursorpos[0] += 1
				cursorpos[0] %= 200
			if event.key == pygame.K_LEFT:
				cursorpos[1] -= 1
				cursorpos[1] %= 200
			if event.key == pygame.K_RIGHT:
				cursorpos[1] += 1
				cursorpos[1] %= 200
			if event.key == pygame.K_RETURN:
				world[cursorpos[0]][cursorpos[1]] += 1
				world[cursorpos[0]][cursorpos[1]] %= 2
				
		keys = pygame.key.get_pressed()
		
		if keys[pygame.K_SPACE]:
			world = advance(world)
		if keys[pygame.K_w]:
			cursorpos[0] -= 1
			cursorpos[0] %= 200
		if keys[pygame.K_s]:
			cursorpos[0] += 1
			cursorpos[0] %= 200
		if keys[pygame.K_a]:
			cursorpos[1] -= 1
			cursorpos[1] %= 200
		if keys[pygame.K_d]:
			cursorpos[1] += 1
			cursorpos[1] %= 200
		
	screen.fill("black")
	
	show(world)
	
	pygame.display.flip()
	
	dt = clock.tick(60) / 1000
	
pygame.quit()
I will soon upload a new version of the code with a new selection feature and improved copy/pasting.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
aengmore
Posts: 28
Joined: June 24th, 2026, 11:11 pm

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by aengmore »

MDA wrote: July 2nd, 2026, 5:41 am ……why is the conversation which you linked to in Chinese?
Cause I AM Chinese……and, this conversation is used to translate the CGoL textbook and LifeWiki pages to Chinese, so that I can understand them conveniently.

EDIT: why do you use so many ifs instead of switch?
EDIT2: oh dear, I'm in the mistaken belief that python has a swich-case statement :cry: it has a “match-case”, though
Last edited by aengmore on July 2nd, 2026, 9:22 am, edited 3 times in total.
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

aengmore wrote: July 2nd, 2026, 8:02 am
[…]

[…] why do you use so many ifs instead of switch?
I didn’t even know switch existed in Python the way it does in C and Java. I’ll consider using it in the future.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating INT naiverules

Post by MDA »

New beta version (v1.2.-1):

Code: Select all

import pygame

import random

color = False

colors = ["black", "gray", "white", "red", "green", "dodgerblue", "orange", "purple", "yellow", "magenta"]

world = []

cursorpos = [100, 100]

selection = [[100, 100], [100, 100]]

selectphase = 0

buffer = ""

rule = input("Rule: ")

def rparse(rule):
	
	# Complete isotropic tables (made by hand) for rule identification.
	
	x0 = ["00000000"]
	x8 = ["11111111"]
	c1 = ["01000000","00010000","00000100","00000001"]
	c2 = ["01010000","00010100","00000101","01000001"]
	c3 = ["01010100","00010101","01000101","01010001"]
	c4 = ["01010101"]
	c5 = ["10101110","10111010","11101010","10101011"]
	c6 = ["10111110","11111010","11101011","10101111"]
	c7 = ["10111111","11101111","11111011","11111110"]
	e1 = ["10000000","00100000","00001000","00000010"]
	e2 = ["10100000","00101000","00001010","10000010"]
	e3 = ["10101000","00101010","10001010","10100010"]
	e4 = ["10101010"]
	e5 = ["01011101","01110101","11010101","01010111"]
	e6 = ["01011111","01111101","11110101","11010111"]
	e7 = ["01111111","11111101","11110111","11011111"]
	k2 = ["10010000","10000100","00100100","00010010","00001001","01001000","01000010","00100001"]
	k3 = ["10100100","10010010","01001010","00101001"]
	k4 = ["10110100","10010110","11010010","10100101","01001011","01101001","00101101","01011010"]
	k5 = ["10110101","11010110","01011011","01101101"]
	k6 = ["10111101","11011110","11110110","10110111","11011011","11101101","01101111","01111011"]
	a2 = ["11000000","01100000","00110000","00011000","00001100","00000110","00000011","10000001"]
	a3 = ["11100000","00111000","00001110","10000011"]
	a4 = ["11110000","01111000","00111100","00011110","00001111","10000111","11000011","11100001"]
	a5 = ["01111100","00111110","10001111","11100011"]
	a6 = ["11111100","01111110","00111111","10011111","11001111","11100111","11110011","11111001"]
	i2 = ["10001000","00100010"]
	i3 = ["11000001","01110000","00011100","00000111"]
	i4 = ["11011000","00110110","10001101","01100011"]
	i5 = ["11111000","00111110","10001111","11100011"]
	i6 = ["01110111","11011101"]
	n2 = ["01000100","00010001"]
	n3 = ["11010000","10000101","00110100","00010110","00001101","01011000","01000011","01100001"]
	n4 = ["01110100","00010111","11010001","11000101","01000111","01110001","00011101","01011100"]
	n5 = ["10111100","10011110","11110010","10100111","11001011","11101001","00101111","01111010"]
	n6 = ["11101110","10111011"]
	y3 = ["10010100","00100101","01001001","01010010"]
	y4 = ["11010100","10010101","01010011","01100101","01001101","01011001","00110101","01010110"]
	y5 = ["01101011","10101101","10110110","11011010"]
	q3 = ["11000100","10010001","00010011","01100100","01001100","00011001","00110001","01000110"]
	q4 = ["11100100","10010011","01001110","00111001"]
	q5 = ["11101100","10011011","10110011","11100110","11001110","10111001","00111011","01101110"]
	j3 = ["10110000","10000110","11000010","10100001","00001011","01101000","00101100","00011010"]
	j4 = ["10101100","10011010","10110010","10100110","11001010","10101001","00101011","01101010"]
	j5 = ["11110100","10010111","11010011","11100101","01001111","01111001","11100101","11010011"]
	r3 = ["11001000","10001001","00100011","01100010","10001100","10011000","00110010","00100110"]
	r4 = ["11101000","10001011","10100011","11100010","10001110","10111000","00111010","00101110"]
	r5 = ["11011100","10011101","01110011","01100111","11001101","11011001","00110111","01110110"]
	t4 = ["10011100","01110010","11001001","00100111"]
	w4 = ["11011000","01100011","10001101","00110110"]
	z4 = ["11001100","10011001","00110011","01100110"]
	
	numstr = "012345678/"
	
	if rule == "":
		
		rule = "B3/S23"
	
	rulelist = list(rule)
	
	blist = rulelist[1:rulelist.index("S")]
	
	slist = rulelist[rulelist.index("S") + 1:]
	
	bconds = []
	
	sconds = []
	
	if "0" in blist:
		
		for c in x0:
			
			bconds.append(c)
			
	if "1" in blist:
		
		if blist[blist.index("1") + 1] in numstr:
			
			for c in c1:
				
				bconds.append(c)
				
			for c in e1:
				
				bconds.append(c)
		
		for n in range(blist.index("1") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist1 = blist[blist.index("1"):n]
				
				break
				
		if "-" in blist1:
			
			B1Negating = True
			
		else:
			
			B1Negating = False
			
		if B1Negating == True:
			
			if "c" not in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" not in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
	if "2" in blist:
		
		if blist[blist.index("2") + 1] in numstr:
			
			for c in c2:
				
				bconds.append(c)
				
			for c in e2:
				
				bconds.append(c)
				
			for c in k2:
				
				bconds.append(c)
				
			for c in a2:
				
				bconds.append(c)
				
			for c in i2:
				
				bconds.append(c)
				
			for c in n2:
				
				bconds.append(c)
				
		for n in range(blist.index("2") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist2 = blist[blist.index("2"):n]
				
				break
				
		if "-" in blist2:
			
			B2Negating = True
			
		else:
			
			B2Negating = False
			
		if B2Negating == True:
			
			if "c" not in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" not in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" not in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" not in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" not in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" not in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
	if "3" in blist:
		
		if blist[blist.index("3") + 1] in numstr:
			
			for c in c3:
				
				bconds.append(c)
				
			for c in e3:
				
				bconds.append(c)
				
			for c in k3:
				
				bconds.append(c)
				
			for c in a3:
				
				bconds.append(c)
				
			for c in i3:
				
				bconds.append(c)
				
			for c in n3:
				
				bconds.append(c)
				
			for c in y3:
				
				bconds.append(c)
				
			for c in q3:
				
				bconds.append(c)
				
			for c in j3:
				
				bconds.append(c)
				
			for c in r3:
				
				bconds.append(c)
				
		for n in range(blist.index("3") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist3 = blist[blist.index("3"):n]
				
				break
				
		if "-" in blist3:
			
			B3Negating = True
			
		else:
			
			B3Negating = False
			
		if B3Negating == True:
			
			if "c" not in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" not in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" not in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" not in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" not in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" not in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" not in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" not in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" not in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" not in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
	if "4" in blist:
		
		if blist[blist.index("4") + 1] in numstr:
			
			for c in c4:
				
				bconds.append(c)
				
			for c in e4:
				
				bconds.append(c)
				
			for c in k4:
				
				bconds.append(c)
				
			for c in a4:
				
				bconds.append(c)
				
			for c in i4:
				
				bconds.append(c)
				
			for c in n4:
				
				bconds.append(c)
				
			for c in y4:
				
				bconds.append(c)
				
			for c in q4:
				
				bconds.append(c)
				
			for c in j4:
				
				bconds.append(c)
				
			for c in r4:
				
				bconds.append(c)
				
			for c in t4:
				
				bconds.append(c)
				
			for c in w4:
				
				bconds.append(c)
				
			for c in z4:
				
				bconds.append(c)
				
		for n in range(blist.index("4") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist4 = blist[blist.index("4"):n]
				
				break
				
		if "-" in blist4:
			
			B4Negating = True
			
		else:
			
			B4Negating = False
			
		if B4Negating == True:
			
			if "c" not in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" not in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" not in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" not in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" not in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" not in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" not in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" not in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" not in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" not in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" not in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" not in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" not in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
	if "5" in blist:
		
		if blist[blist.index("5") + 1] in numstr:
			
			for c in c5:
				
				bconds.append(c)
				
			for c in e5:
				
				bconds.append(c)
				
			for c in k5:
				
				bconds.append(c)
				
			for c in a5:
				
				bconds.append(c)
				
			for c in i5:
				
				bconds.append(c)
				
			for c in n5:
				
				bconds.append(c)
				
			for c in y5:
				
				bconds.append(c)
				
			for c in q5:
				
				bconds.append(c)
				
			for c in j5:
				
				bconds.append(c)
				
			for c in r5:
				
				bconds.append(c)
				
		for n in range(blist.index("5") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist5 = blist[blist.index("5"):n]
				
				break
				
		if "-" in blist5:
			
			B5Negating = True
			
		else:
			
			B5Negating = False
			
		if B5Negating == True:
			
			if "c" not in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" not in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" not in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" not in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" not in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" not in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" not in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" not in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" not in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" not in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
	if "6" in blist:
		
		if blist[blist.index("6") + 1] in numstr:
			
			for c in c6:
				
				bconds.append(c)
				
			for c in e6:
				
				bconds.append(c)
				
			for c in k6:
				
				bconds.append(c)
				
			for c in a6:
				
				bconds.append(c)
				
			for c in i6:
				
				bconds.append(c)
				
			for c in n6:
				
				bconds.append(c)
				
		for n in range(blist.index("6") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist6 = blist[blist.index("6"):n]
				
				break
				
		if "-" in blist6:
			
			B6Negating = True
			
		else:
			
			B6Negating = False
			
		if B6Negating == True:
			
			if "c" not in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" not in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" not in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" not in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" not in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" not in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
	if "7" in blist:
		
		if blist[blist.index("7") + 1] in numstr:
			
			for c in c7:
				
				bconds.append(c)
				
			for c in e7:
				
				bconds.append(c)
		
		for n in range(blist.index("7") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist7 = blist[blist.index("7"):n]
				
				break
				
		if "-" in blist7:
			
			B7Negating = True
			
		else:
			
			B7Negating = False
			
		if B7Negating == True:
			
			if "c" not in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" not in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
	if "8" in blist:
		
		for c in x8:
			
			bconds.append(c)
			
	if "0" in slist:
		
		for c in x0:
			
			sconds.append(c)
			
	if "1" in slist:
		
		try:
			
			if slist[slist.index("1") + 1] in numstr:
				
				for c in c1:
					
					sconds.append(c)
					
				for c in e1:
					
					sconds.append(c)
			
			for n in range(slist.index("1") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist1 = slist[slist.index("1"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist1 = slist[slist.index("1"):n + 1]
					
					break
					
		except IndexError:
			
			slist1 = ["1"]
			
			for c in c1:
				
				sconds.append(c)
				
			for c in e1:
				
				sconds.append(e)
				
		if "-" in slist1:
			
			S1Negating = True
			
		else:
			
			S1Negating = False
			
		if S1Negating == True:
			
			if "c" not in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" not in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
	if "2" in slist:
		
		try:
		
			if slist[slist.index("2") + 1] in numstr:
				
				for c in c2:
					
					sconds.append(c)
					
				for c in e2:
					
					sconds.append(c)
					
				for c in k2:
					
					sconds.append(c)
					
				for c in a2:
					
					sconds.append(c)
					
				for c in i2:
					
					sconds.append(c)
					
				for c in n2:
					
					sconds.append(c)
					
			for n in range(slist.index("2") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist2 = slist[slist.index("2"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist2 = slist[slist.index("2"):n + 1]
					
					break
					
		except IndexError:
			
			slist2 = ["2"]
				
			for c in c2:
				
				sconds.append(c)
				
			for c in e2:
				
				sconds.append(c)
				
			for c in k2:
				
				sconds.append(c)
				
			for c in a2:
				
				sconds.append(c)
				
			for c in i2:
				
				sconds.append(c)
				
			for c in n2:
				
				sconds.append(c)
				
		if "-" in slist2:
			
			S2Negating = True
			
		else:
			
			S2Negating = False
			
		if S2Negating == True:
			
			if "c" not in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" not in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" not in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" not in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" not in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" not in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
	if "3" in slist:
		
		try:
			
			if slist[slist.index("3") + 1] in numstr:
				
				for c in c3:
					
					sconds.append(c)
					
				for c in e3:
					
					sconds.append(c)
					
				for c in k3:
					
					sconds.append(c)
					
				for c in a3:
					
					sconds.append(c)
					
				for c in i3:
					
					sconds.append(c)
					
				for c in n3:
					
					sconds.append(c)
					
				for c in y3:
					
					sconds.append(c)
					
				for c in q3:
					
					sconds.append(c)
					
				for c in j3:
					
					sconds.append(c)
					
				for c in r3:
					
					sconds.append(c)
					
			for n in range(slist.index("3") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist3 = slist[slist.index("3"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist3 = slist[slist.index("3"):n + 1]
					
					break
					
		except IndexError:
			
			slist3 = ["3"]
			
			for c in c3:
				
				sconds.append(c)
				
			for c in e3:
				
				sconds.append(c)
				
			for c in k3:
				
				sconds.append(c)
				
			for c in a3:
				
				sconds.append(c)
				
			for c in i3:
				
				sconds.append(c)
				
			for c in n3:
				
				sconds.append(c)
				
			for c in y3:
				
				sconds.append(c)
				
			for c in q3:
				
				sconds.append(c)
				
			for c in j3:
				
				sconds.append(c)
				
			for c in r3:
				
				sconds.append(c)
				
		if "-" in slist3:
			
			S3Negating = True
			
		else:
			
			S3Negating = False
			
		if S3Negating == True:
			
			if "c" not in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" not in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" not in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" not in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" not in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" not in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" not in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" not in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" not in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" not in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
	if "4" in slist:
		
		try:
			
			if slist[slist.index("4") + 1] in numstr:
				
				for c in c4:
					
					sconds.append(c)
					
				for c in e4:
					
					sconds.append(c)
					
				for c in k4:
					
					sconds.append(c)
					
				for c in a4:
					
					sconds.append(c)
					
				for c in i4:
					
					sconds.append(c)
					
				for c in n4:
					
					sconds.append(c)
					
				for c in y4:
					
					sconds.append(c)
					
				for c in q4:
					
					sconds.append(c)
					
				for c in j4:
					
					sconds.append(c)
					
				for c in r4:
					
					sconds.append(c)
					
				for c in t4:
					
					sconds.append(c)
					
				for c in w4:
					
					sconds.append(c)
					
				for c in z4:
					
					sconds.append(c)
					
			for n in range(slist.index("4") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist4 = slist[slist.index("4"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist4 = slist[slist.index("4"):n + 1]
					
					break
					
		except IndexError:
			
			slist4 = ["4"]
			
			for c in c4:
				
				sconds.append(c)
				
			for c in e4:
				
				sconds.append(c)
				
			for c in k4:
				
				sconds.append(c)
				
			for c in a4:
				
				sconds.append(c)
				
			for c in i4:
				
				sconds.append(c)
				
			for c in n4:
				
				sconds.append(c)
				
			for c in y4:
				
				sconds.append(c)
				
			for c in q4:
				
				sconds.append(c)
				
			for c in j4:
				
				sconds.append(c)
				
			for c in r4:
				
				sconds.append(c)
				
			for c in t4:
				
				sconds.append(c)
				
			for c in w4:
				
				sconds.append(c)
				
			for c in z4:
				
				sconds.append(c)
				
		if "-" in slist4:
			
			S4Negating = True
			
		else:
			
			S4Negating = False
			
		if S4Negating == True:
			
			if "c" not in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" not in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" not in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" not in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" not in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" not in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" not in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" not in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" not in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" not in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" not in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" not in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" not in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
	if "5" in slist:
		
		try:
			
			if slist[slist.index("5") + 1] in numstr:
				
				for c in c5:
					
					sconds.append(c)
					
				for c in e5:
					
					sconds.append(c)
					
				for c in k5:
					
					sconds.append(c)
					
				for c in a5:
					
					sconds.append(c)
					
				for c in i5:
					
					sconds.append(c)
					
				for c in n5:
					
					sconds.append(c)
					
				for c in y5:
					
					sconds.append(c)
					
				for c in q5:
					
					sconds.append(c)
					
				for c in j5:
					
					sconds.append(c)
					
				for c in r5:
					
					sconds.append(c)
					
			for n in range(slist.index("5") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist5 = slist[slist.index("5"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist5 = slist[slist.index("5"):n + 1]
					
					break
					
		except IndexError:
			
			slist5 = ["5"]
				
			for c in c5:
				
				sconds.append(c)
				
			for c in e5:
				
				sconds.append(c)
				
			for c in k5:
				
				sconds.append(c)
				
			for c in a5:
				
				sconds.append(c)
				
			for c in i5:
				
				sconds.append(c)
				
			for c in n5:
				
				sconds.append(c)
				
			for c in y5:
				
				sconds.append(c)
				
			for c in q5:
				
				sconds.append(c)
				
			for c in j5:
				
				sconds.append(c)
				
			for c in r5:
				
				sconds.append(c)
				
		if "-" in slist5:
			
			S5Negating = True
			
		else:
			
			S5Negating = False
			
		if S5Negating == True:
			
			if "c" not in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" not in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" not in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" not in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" not in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" not in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" not in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" not in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" not in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" not in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
	if "6" in slist:
		
		try:
			
			if slist[slist.index("6") + 1] in numstr:
				
				for c in c6:
					
					sconds.append(c)
					
				for c in e6:
					
					sconds.append(c)
					
				for c in k6:
					
					sconds.append(c)
					
				for c in a6:
					
					sconds.append(c)
					
				for c in i6:
					
					sconds.append(c)
					
				for c in n6:
					
					sconds.append(c)
					
			for n in range(slist.index("6") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist6 = slist[slist.index("6"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist6 = slist[slist.index("6"):n + 1]
					
					break
					
		except IndexError:
			
			slist6 = ["6"]
				
			for c in c6:
				
				sconds.append(c)
				
			for c in e6:
				
				sconds.append(c)
				
			for c in k6:
				
				sconds.append(c)
				
			for c in a6:
				
				sconds.append(c)
				
			for c in i6:
				
				sconds.append(c)
				
			for c in n6:
				
				sconds.append(c)
				
		if "-" in slist6:
			
			S6Negating = True
			
		else:
			
			S6Negating = False
			
		if S6Negating == True:
			
			if "c" not in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" not in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" not in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" not in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" not in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" not in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
	if "7" in slist:
		
		try:
			
			if slist[slist.index("7") + 1] in numstr:
				
				for c in c7:
					
					sconds.append(c)
					
				for c in e7:
					
					sconds.append(c)
					
			for n in range(slist.index("7") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist7 = slist[slist.index("7"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist7 = slist[slist.index("7"):n + 1]
					
					break
					
		except IndexError:
			
			slist7 = ["7"]
				
			for c in c7:
				
				sconds.append(c)
				
			for c in e7:
				
				sconds.append(c)
				
		if "-" in slist7:
			
			S7Negating = True
			
		else:
			
			S7Negating = False
			
		if S7Negating == True:
			
			if "c" not in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" not in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
	if "8" in slist:
		
		for c in x8:
			
			sconds.append(c)
			
	l = [bconds,sconds]
	
	return(l)
	
conditions = rparse(rule)

for y in range(0, 200):
	
	world.append([0] * 200)
	
def makeworld(rle, pos): # Assists in the conversion of an RLE to a matrix
	
	rlel = list(rle)
	
	mat = []
	
	for y in range(0, 200):
		
		mat.append([])
		
		for x in range(0, 200):
			
			mat[-1].append(0)
	
	digits = "0123456789"
	
	y = pos[0]
	
	x = pos[0]
	
	num = 0
	
	for char in rlel:
		
		if char in digits:
			
			num = num * 10 + int(char)
			
		else:
			
			if char == "b":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 0
					
					x += 1
					
			if char == "o":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 1
					
					x += 1
					
			if char == "$":
				
				x = pos[1]
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					y += 1
					
			num = 0
			
	return(mat)
	
def makerle(mat, selection): # Does the opposite of the previous function
	
	rlel = []
	
	num = 1
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, ydir):
			
			cell = mat[y][x]
			
			if cell == 0:
				
				rlel.append("b")
				
			else:
				
				rlel.append("o")
				
		rlel.append("$")
		
	rlel[len(rlel) - 1] = "!"
	
	listinit = rlel
		
	rle = "".join(listinit)
	
	return(rle)

rle = input("RLE (must be headerless, may be empty): ")

world = makeworld(rle, [0, 0])

pygame.init()

screen = pygame.display.set_mode((1000, 1000))

rectworld = []

for y in range(0, 200):
	
	rectworld.append([])
	
	for x in range(0, 200):
		
		rectworld[-1].append(pygame.Rect(x * 5, y * 5, 5, 5))
		
clock = pygame.time.Clock()

step = 0

running = True

dt = 0

def advance(world):
	
	global color
	
	global conditions
	
	# neigh = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]]
	
	neigh = [[1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1], [0, 1], [1, 1]]
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			neighs = 0
			
			neighlist = []
			
			for n in range(0, 8):
				
				newx = x + neigh[n][1]
				
				newy = y + neigh[n][0]
				
				if newx == 200:
					
					newx = 199
					
				if newx == -1:
					
					newx = 0
					
				if newy == 200:
					
					newy = 199
					
				if newy == -1:
					
					newy = 0
					
				if (world[newy][newx] != 0):
					
					neighlist.append("1")
					
					neighs += 1
					
				else:
					
					neighlist.append("0")
					
					
			neighstr = "".join(neighlist)
			
			if world[y][x] == 0 and (neighstr in conditions[0]):
				
				if not color:
					
					world[y][x] = 1
					
				else:
					
					world[y][x] = neighs + 1
					
				continue
				
			if world[y][x] != 0 and (neighstr not in conditions[1]):
				
				world[y][x] = 0
				
				continue
				
			if world[y][x] != 0 and (neighstr in conditions[1]):
				
				if color:
					
					world[y][x] = neighs + 1
					
				else:
					
					if world[y][x] != 1:
						
						world[y][x] = 1
						
	return world
	
def show(world):
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			if world[y][x] != 0:
				
				if not color:
					
					pygame.draw.rect(screen, "white", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, colors[world[y][x]], rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
				
				if world[y][x] == 3:
					
					pygame.draw.rect(screen, "blue", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, "red", rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
				
				pygame.draw.rect(screen, "maroon", rectworld[y][x])
				
			if (selection[0][0] <= y < selection[1][0] and selection[0][1] <= x < selection[1][1]) or (selection[0][0] >= y > selection[1][0] and selection[0][1] >= x > selection[1][1]) or (selection[0][0] >= y > selection[1][0] and selection[0][1] <= x < selection[1][1]) or (selection[0][0] <= y < selection[1][0] and selection[0][1] >= x > selection[1][1]):
					
				if world[y][x] != 0:
					
					pygame.draw.rect(screen, (128, 192, 128), rectworld[y][x])
					
				if world[y][x] == 0:
					
					pygame.draw.rect(screen, (0, 128, 0), rectworld[y][x])
					
				if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
					
					pygame.draw.rect(screen, (64, 64, 0), rectworld[y][x])
					
				if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
					
					pygame.draw.rect(screen, (128, 64, 0), rectworld[y][x])
					
def randfill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = random.randint(0, 1)
			
	return world
	
def zerofill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = 0
			
	return world
	
while running:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			running = False
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_k:
				if color:
					color = False
				else:
					color = True
			if event.key == pygame.K_q:
				running = False
			if event.key == pygame.K_r:
				world = randfill(selection)
			if event.key == pygame.K_c:
				print(makerle(world, selection))
				buffer = makerle(world, selection)
			if event.key == pygame.K_x:
				print(makerle(world, selection))
				buffer = makerle(world, selection)
				world = zerofill(selection)
			if event.key == pygame.K_v:
				world = makeworld(buffer, cursorpos)
			if event.key == pygame.K_t:
				rule = input("Rule: ")
				conditions = rparse(rule)
			if event.key == pygame.K_EQUALS:
				world = advance(world)
			if event.key == pygame.K_UP:
				cursorpos[0] -= 1
				cursorpos[0] %= 200
				if selectphase == 1:
					selection[1][0] -= 1
					selection[1][0] %= 200
			if event.key == pygame.K_DOWN:
				cursorpos[0] += 1
				cursorpos[0] %= 200
				if selectphase == 1:
					selection[1][0] += 1
					selection[1][0] %= 200
			if event.key == pygame.K_LEFT:
				cursorpos[1] -= 1
				cursorpos[1] %= 200
				if selectphase == 1:
					selection[1][1] -= 1
					selection[1][1] %= 200
			if event.key == pygame.K_RIGHT:
				cursorpos[1] += 1
				cursorpos[1] %= 200
				if selectphase == 1:
					selection[1][1] += 1
					selection[1][1] %= 200
			if event.key == pygame.K_RETURN:
				world[cursorpos[0]][cursorpos[1]] += 1
				world[cursorpos[0]][cursorpos[1]] %= 2
			if event.key == pygame.K_LSHIFT or event.key == pygame.K_RSHIFT:
				if selectphase == 0:
					selection[0][0] = cursorpos[0]
					selection[0][1] = cursorpos[1]
					selection[1][0] = cursorpos[0]
					selection[1][1] = cursorpos[1]
					selectphase = 1
				else:
					selection[1][0] = cursorpos[0]
					selection[1][1] = cursorpos[1]
					selectphase = 0
			if event.key == pygame.K_8:
				selection = [[100, 100], [100, 100]]
				selectphase = 0
				
		keys = pygame.key.get_pressed()
		
		if keys[pygame.K_SPACE]:
			world = advance(world)
		if keys[pygame.K_w]:
			cursorpos[0] -= 1
			cursorpos[0] %= 200
			if selectphase == 1:
				selection[1][0] -= 1
				selection[1][0] %= 200
		if keys[pygame.K_s]:
			cursorpos[0] += 1
			cursorpos[0] %= 200
			if selectphase == 1:
				selection[1][0] += 1
				selection[1][0] %= 200
		if keys[pygame.K_a]:
			cursorpos[1] -= 1
			cursorpos[1] %= 200
			if selectphase == 1:
				selection[1][1] -= 1
				selection[1][1] %= 200
		if keys[pygame.K_d]:
			cursorpos[1] += 1
			cursorpos[1] %= 200
			if selectphase == 1:
				selection[1][1] += 1
				selection[1][1] %= 200
		
	screen.fill("black")
	
	show(world)
	
	pygame.display.flip()
	
	dt = clock.tick(60) / 1000
	
pygame.quit()
Improvements:

- Added selection features. Click on Shift to start a selection and Shift again to end it. Click on 8 to remove a selection.

- Added cutting (X key).

Feel free to report any bugs in this version and I'll be listening for them.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
I6_I6
Posts: 999
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by I6_I6 »

Suggestion:
Since all of the features so far only involve the keyboard, how about adding mouse controls too?

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating INT naiverules

Post by MDA »

I6_I6 wrote: July 2nd, 2026, 10:00 am Suggestion:
Since all of the features so far only involve the keyboard, how about adding mouse controls too?
I would, but I don't know how.
Last edited by MDA on July 2nd, 2026, 10:50 am, edited 1 time in total.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
I6_I6
Posts: 999
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by I6_I6 »

MDA wrote: July 2nd, 2026, 10:02 am
I6_I6 wrote: July 2nd, 2026, 10:00 am Suggestion:
Since all of the features so far only involve the keyboard, how about adding mouse controls too?
I would, but I don't know how.
I can help! (I've done quite a bit of pygame before.)
https://www.pygame.org/docs/ref/mouse.html

You can track the current position of the mouse using pygame.mouse.get_pos().
pygame.MOUSEBUTTONDOWN and pygame.MOUSEBUTTONUP are event.type that you can use to track clicks.
pygame.MOUSEMOTION tracks mouse movement.

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating INT naiverules

Post by MDA »

I6_I6 wrote: July 2nd, 2026, 10:14 am
[...]

You can track the current position of the mouse using pygame.mouse.get_pos().
pygame.MOUSEBUTTONDOWN and pygame.MOUSEBUTTONUP are event.type that you can use to track clicks.
pygame.MOUSEMOTION tracks mouse movement.
Done! Here's a new version of my code (v1.3.-1):

Code: Select all

import pygame

import random

color = False

colors = ["black", "gray", "white", "red", "green", "dodgerblue", "orange", "purple", "yellow", "magenta"]

world = []

cursorpos = [100, 100]

selection = [[100, 100], [100, 100]]

selectphase = 0

buffer = ""

rule = input("Rule: ")

def rparse(rule):
	
	# Complete isotropic tables (made by hand) for rule identification.
	
	x0 = ["00000000"]
	x8 = ["11111111"]
	c1 = ["01000000","00010000","00000100","00000001"]
	c2 = ["01010000","00010100","00000101","01000001"]
	c3 = ["01010100","00010101","01000101","01010001"]
	c4 = ["01010101"]
	c5 = ["10101110","10111010","11101010","10101011"]
	c6 = ["10111110","11111010","11101011","10101111"]
	c7 = ["10111111","11101111","11111011","11111110"]
	e1 = ["10000000","00100000","00001000","00000010"]
	e2 = ["10100000","00101000","00001010","10000010"]
	e3 = ["10101000","00101010","10001010","10100010"]
	e4 = ["10101010"]
	e5 = ["01011101","01110101","11010101","01010111"]
	e6 = ["01011111","01111101","11110101","11010111"]
	e7 = ["01111111","11111101","11110111","11011111"]
	k2 = ["10010000","10000100","00100100","00010010","00001001","01001000","01000010","00100001"]
	k3 = ["10100100","10010010","01001010","00101001"]
	k4 = ["10110100","10010110","11010010","10100101","01001011","01101001","00101101","01011010"]
	k5 = ["10110101","11010110","01011011","01101101"]
	k6 = ["10111101","11011110","11110110","10110111","11011011","11101101","01101111","01111011"]
	a2 = ["11000000","01100000","00110000","00011000","00001100","00000110","00000011","10000001"]
	a3 = ["11100000","00111000","00001110","10000011"]
	a4 = ["11110000","01111000","00111100","00011110","00001111","10000111","11000011","11100001"]
	a5 = ["01111100","00111110","10001111","11100011"]
	a6 = ["11111100","01111110","00111111","10011111","11001111","11100111","11110011","11111001"]
	i2 = ["10001000","00100010"]
	i3 = ["11000001","01110000","00011100","00000111"]
	i4 = ["11011000","00110110","10001101","01100011"]
	i5 = ["11111000","00111110","10001111","11100011"]
	i6 = ["01110111","11011101"]
	n2 = ["01000100","00010001"]
	n3 = ["11010000","10000101","00110100","00010110","00001101","01011000","01000011","01100001"]
	n4 = ["01110100","00010111","11010001","11000101","01000111","01110001","00011101","01011100"]
	n5 = ["10111100","10011110","11110010","10100111","11001011","11101001","00101111","01111010"]
	n6 = ["11101110","10111011"]
	y3 = ["10010100","00100101","01001001","01010010"]
	y4 = ["11010100","10010101","01010011","01100101","01001101","01011001","00110101","01010110"]
	y5 = ["01101011","10101101","10110110","11011010"]
	q3 = ["11000100","10010001","00010011","01100100","01001100","00011001","00110001","01000110"]
	q4 = ["11100100","10010011","01001110","00111001"]
	q5 = ["11101100","10011011","10110011","11100110","11001110","10111001","00111011","01101110"]
	j3 = ["10110000","10000110","11000010","10100001","00001011","01101000","00101100","00011010"]
	j4 = ["10101100","10011010","10110010","10100110","11001010","10101001","00101011","01101010"]
	j5 = ["11110100","10010111","11010011","11100101","01001111","01111001","11100101","11010011"]
	r3 = ["11001000","10001001","00100011","01100010","10001100","10011000","00110010","00100110"]
	r4 = ["11101000","10001011","10100011","11100010","10001110","10111000","00111010","00101110"]
	r5 = ["11011100","10011101","01110011","01100111","11001101","11011001","00110111","01110110"]
	t4 = ["10011100","01110010","11001001","00100111"]
	w4 = ["11011000","01100011","10001101","00110110"]
	z4 = ["11001100","10011001","00110011","01100110"]
	
	numstr = "012345678/"
	
	if rule == "":
		
		rule = "B3/S23"
	
	rulelist = list(rule)
	
	blist = rulelist[1:rulelist.index("S")]
	
	slist = rulelist[rulelist.index("S") + 1:]
	
	bconds = []
	
	sconds = []
	
	if "0" in blist:
		
		for c in x0:
			
			bconds.append(c)
			
	if "1" in blist:
		
		if blist[blist.index("1") + 1] in numstr:
			
			for c in c1:
				
				bconds.append(c)
				
			for c in e1:
				
				bconds.append(c)
		
		for n in range(blist.index("1") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist1 = blist[blist.index("1"):n]
				
				break
				
		if "-" in blist1:
			
			B1Negating = True
			
		else:
			
			B1Negating = False
			
		if B1Negating == True:
			
			if "c" not in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" not in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
	if "2" in blist:
		
		if blist[blist.index("2") + 1] in numstr:
			
			for c in c2:
				
				bconds.append(c)
				
			for c in e2:
				
				bconds.append(c)
				
			for c in k2:
				
				bconds.append(c)
				
			for c in a2:
				
				bconds.append(c)
				
			for c in i2:
				
				bconds.append(c)
				
			for c in n2:
				
				bconds.append(c)
				
		for n in range(blist.index("2") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist2 = blist[blist.index("2"):n]
				
				break
				
		if "-" in blist2:
			
			B2Negating = True
			
		else:
			
			B2Negating = False
			
		if B2Negating == True:
			
			if "c" not in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" not in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" not in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" not in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" not in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" not in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
	if "3" in blist:
		
		if blist[blist.index("3") + 1] in numstr:
			
			for c in c3:
				
				bconds.append(c)
				
			for c in e3:
				
				bconds.append(c)
				
			for c in k3:
				
				bconds.append(c)
				
			for c in a3:
				
				bconds.append(c)
				
			for c in i3:
				
				bconds.append(c)
				
			for c in n3:
				
				bconds.append(c)
				
			for c in y3:
				
				bconds.append(c)
				
			for c in q3:
				
				bconds.append(c)
				
			for c in j3:
				
				bconds.append(c)
				
			for c in r3:
				
				bconds.append(c)
				
		for n in range(blist.index("3") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist3 = blist[blist.index("3"):n]
				
				break
				
		if "-" in blist3:
			
			B3Negating = True
			
		else:
			
			B3Negating = False
			
		if B3Negating == True:
			
			if "c" not in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" not in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" not in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" not in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" not in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" not in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" not in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" not in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" not in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" not in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
	if "4" in blist:
		
		if blist[blist.index("4") + 1] in numstr:
			
			for c in c4:
				
				bconds.append(c)
				
			for c in e4:
				
				bconds.append(c)
				
			for c in k4:
				
				bconds.append(c)
				
			for c in a4:
				
				bconds.append(c)
				
			for c in i4:
				
				bconds.append(c)
				
			for c in n4:
				
				bconds.append(c)
				
			for c in y4:
				
				bconds.append(c)
				
			for c in q4:
				
				bconds.append(c)
				
			for c in j4:
				
				bconds.append(c)
				
			for c in r4:
				
				bconds.append(c)
				
			for c in t4:
				
				bconds.append(c)
				
			for c in w4:
				
				bconds.append(c)
				
			for c in z4:
				
				bconds.append(c)
				
		for n in range(blist.index("4") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist4 = blist[blist.index("4"):n]
				
				break
				
		if "-" in blist4:
			
			B4Negating = True
			
		else:
			
			B4Negating = False
			
		if B4Negating == True:
			
			if "c" not in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" not in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" not in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" not in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" not in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" not in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" not in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" not in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" not in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" not in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" not in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" not in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" not in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
	if "5" in blist:
		
		if blist[blist.index("5") + 1] in numstr:
			
			for c in c5:
				
				bconds.append(c)
				
			for c in e5:
				
				bconds.append(c)
				
			for c in k5:
				
				bconds.append(c)
				
			for c in a5:
				
				bconds.append(c)
				
			for c in i5:
				
				bconds.append(c)
				
			for c in n5:
				
				bconds.append(c)
				
			for c in y5:
				
				bconds.append(c)
				
			for c in q5:
				
				bconds.append(c)
				
			for c in j5:
				
				bconds.append(c)
				
			for c in r5:
				
				bconds.append(c)
				
		for n in range(blist.index("5") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist5 = blist[blist.index("5"):n]
				
				break
				
		if "-" in blist5:
			
			B5Negating = True
			
		else:
			
			B5Negating = False
			
		if B5Negating == True:
			
			if "c" not in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" not in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" not in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" not in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" not in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" not in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" not in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" not in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" not in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" not in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
	if "6" in blist:
		
		if blist[blist.index("6") + 1] in numstr:
			
			for c in c6:
				
				bconds.append(c)
				
			for c in e6:
				
				bconds.append(c)
				
			for c in k6:
				
				bconds.append(c)
				
			for c in a6:
				
				bconds.append(c)
				
			for c in i6:
				
				bconds.append(c)
				
			for c in n6:
				
				bconds.append(c)
				
		for n in range(blist.index("6") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist6 = blist[blist.index("6"):n]
				
				break
				
		if "-" in blist6:
			
			B6Negating = True
			
		else:
			
			B6Negating = False
			
		if B6Negating == True:
			
			if "c" not in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" not in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" not in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" not in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" not in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" not in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
	if "7" in blist:
		
		if blist[blist.index("7") + 1] in numstr:
			
			for c in c7:
				
				bconds.append(c)
				
			for c in e7:
				
				bconds.append(c)
		
		for n in range(blist.index("7") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist7 = blist[blist.index("7"):n]
				
				break
				
		if "-" in blist7:
			
			B7Negating = True
			
		else:
			
			B7Negating = False
			
		if B7Negating == True:
			
			if "c" not in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" not in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
	if "8" in blist:
		
		for c in x8:
			
			bconds.append(c)
			
	if "0" in slist:
		
		for c in x0:
			
			sconds.append(c)
			
	if "1" in slist:
		
		try:
			
			if slist[slist.index("1") + 1] in numstr:
				
				for c in c1:
					
					sconds.append(c)
					
				for c in e1:
					
					sconds.append(c)
			
			for n in range(slist.index("1") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist1 = slist[slist.index("1"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist1 = slist[slist.index("1"):n + 1]
					
					break
					
		except IndexError:
			
			slist1 = ["1"]
			
			for c in c1:
				
				sconds.append(c)
				
			for c in e1:
				
				sconds.append(e)
				
		if "-" in slist1:
			
			S1Negating = True
			
		else:
			
			S1Negating = False
			
		if S1Negating == True:
			
			if "c" not in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" not in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
	if "2" in slist:
		
		try:
		
			if slist[slist.index("2") + 1] in numstr:
				
				for c in c2:
					
					sconds.append(c)
					
				for c in e2:
					
					sconds.append(c)
					
				for c in k2:
					
					sconds.append(c)
					
				for c in a2:
					
					sconds.append(c)
					
				for c in i2:
					
					sconds.append(c)
					
				for c in n2:
					
					sconds.append(c)
					
			for n in range(slist.index("2") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist2 = slist[slist.index("2"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist2 = slist[slist.index("2"):n + 1]
					
					break
					
		except IndexError:
			
			slist2 = ["2"]
				
			for c in c2:
				
				sconds.append(c)
				
			for c in e2:
				
				sconds.append(c)
				
			for c in k2:
				
				sconds.append(c)
				
			for c in a2:
				
				sconds.append(c)
				
			for c in i2:
				
				sconds.append(c)
				
			for c in n2:
				
				sconds.append(c)
				
		if "-" in slist2:
			
			S2Negating = True
			
		else:
			
			S2Negating = False
			
		if S2Negating == True:
			
			if "c" not in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" not in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" not in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" not in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" not in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" not in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
	if "3" in slist:
		
		try:
			
			if slist[slist.index("3") + 1] in numstr:
				
				for c in c3:
					
					sconds.append(c)
					
				for c in e3:
					
					sconds.append(c)
					
				for c in k3:
					
					sconds.append(c)
					
				for c in a3:
					
					sconds.append(c)
					
				for c in i3:
					
					sconds.append(c)
					
				for c in n3:
					
					sconds.append(c)
					
				for c in y3:
					
					sconds.append(c)
					
				for c in q3:
					
					sconds.append(c)
					
				for c in j3:
					
					sconds.append(c)
					
				for c in r3:
					
					sconds.append(c)
					
			for n in range(slist.index("3") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist3 = slist[slist.index("3"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist3 = slist[slist.index("3"):n + 1]
					
					break
					
		except IndexError:
			
			slist3 = ["3"]
			
			for c in c3:
				
				sconds.append(c)
				
			for c in e3:
				
				sconds.append(c)
				
			for c in k3:
				
				sconds.append(c)
				
			for c in a3:
				
				sconds.append(c)
				
			for c in i3:
				
				sconds.append(c)
				
			for c in n3:
				
				sconds.append(c)
				
			for c in y3:
				
				sconds.append(c)
				
			for c in q3:
				
				sconds.append(c)
				
			for c in j3:
				
				sconds.append(c)
				
			for c in r3:
				
				sconds.append(c)
				
		if "-" in slist3:
			
			S3Negating = True
			
		else:
			
			S3Negating = False
			
		if S3Negating == True:
			
			if "c" not in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" not in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" not in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" not in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" not in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" not in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" not in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" not in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" not in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" not in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
	if "4" in slist:
		
		try:
			
			if slist[slist.index("4") + 1] in numstr:
				
				for c in c4:
					
					sconds.append(c)
					
				for c in e4:
					
					sconds.append(c)
					
				for c in k4:
					
					sconds.append(c)
					
				for c in a4:
					
					sconds.append(c)
					
				for c in i4:
					
					sconds.append(c)
					
				for c in n4:
					
					sconds.append(c)
					
				for c in y4:
					
					sconds.append(c)
					
				for c in q4:
					
					sconds.append(c)
					
				for c in j4:
					
					sconds.append(c)
					
				for c in r4:
					
					sconds.append(c)
					
				for c in t4:
					
					sconds.append(c)
					
				for c in w4:
					
					sconds.append(c)
					
				for c in z4:
					
					sconds.append(c)
					
			for n in range(slist.index("4") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist4 = slist[slist.index("4"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist4 = slist[slist.index("4"):n + 1]
					
					break
					
		except IndexError:
			
			slist4 = ["4"]
			
			for c in c4:
				
				sconds.append(c)
				
			for c in e4:
				
				sconds.append(c)
				
			for c in k4:
				
				sconds.append(c)
				
			for c in a4:
				
				sconds.append(c)
				
			for c in i4:
				
				sconds.append(c)
				
			for c in n4:
				
				sconds.append(c)
				
			for c in y4:
				
				sconds.append(c)
				
			for c in q4:
				
				sconds.append(c)
				
			for c in j4:
				
				sconds.append(c)
				
			for c in r4:
				
				sconds.append(c)
				
			for c in t4:
				
				sconds.append(c)
				
			for c in w4:
				
				sconds.append(c)
				
			for c in z4:
				
				sconds.append(c)
				
		if "-" in slist4:
			
			S4Negating = True
			
		else:
			
			S4Negating = False
			
		if S4Negating == True:
			
			if "c" not in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" not in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" not in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" not in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" not in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" not in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" not in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" not in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" not in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" not in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" not in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" not in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" not in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
	if "5" in slist:
		
		try:
			
			if slist[slist.index("5") + 1] in numstr:
				
				for c in c5:
					
					sconds.append(c)
					
				for c in e5:
					
					sconds.append(c)
					
				for c in k5:
					
					sconds.append(c)
					
				for c in a5:
					
					sconds.append(c)
					
				for c in i5:
					
					sconds.append(c)
					
				for c in n5:
					
					sconds.append(c)
					
				for c in y5:
					
					sconds.append(c)
					
				for c in q5:
					
					sconds.append(c)
					
				for c in j5:
					
					sconds.append(c)
					
				for c in r5:
					
					sconds.append(c)
					
			for n in range(slist.index("5") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist5 = slist[slist.index("5"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist5 = slist[slist.index("5"):n + 1]
					
					break
					
		except IndexError:
			
			slist5 = ["5"]
				
			for c in c5:
				
				sconds.append(c)
				
			for c in e5:
				
				sconds.append(c)
				
			for c in k5:
				
				sconds.append(c)
				
			for c in a5:
				
				sconds.append(c)
				
			for c in i5:
				
				sconds.append(c)
				
			for c in n5:
				
				sconds.append(c)
				
			for c in y5:
				
				sconds.append(c)
				
			for c in q5:
				
				sconds.append(c)
				
			for c in j5:
				
				sconds.append(c)
				
			for c in r5:
				
				sconds.append(c)
				
		if "-" in slist5:
			
			S5Negating = True
			
		else:
			
			S5Negating = False
			
		if S5Negating == True:
			
			if "c" not in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" not in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" not in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" not in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" not in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" not in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" not in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" not in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" not in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" not in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
	if "6" in slist:
		
		try:
			
			if slist[slist.index("6") + 1] in numstr:
				
				for c in c6:
					
					sconds.append(c)
					
				for c in e6:
					
					sconds.append(c)
					
				for c in k6:
					
					sconds.append(c)
					
				for c in a6:
					
					sconds.append(c)
					
				for c in i6:
					
					sconds.append(c)
					
				for c in n6:
					
					sconds.append(c)
					
			for n in range(slist.index("6") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist6 = slist[slist.index("6"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist6 = slist[slist.index("6"):n + 1]
					
					break
					
		except IndexError:
			
			slist6 = ["6"]
				
			for c in c6:
				
				sconds.append(c)
				
			for c in e6:
				
				sconds.append(c)
				
			for c in k6:
				
				sconds.append(c)
				
			for c in a6:
				
				sconds.append(c)
				
			for c in i6:
				
				sconds.append(c)
				
			for c in n6:
				
				sconds.append(c)
				
		if "-" in slist6:
			
			S6Negating = True
			
		else:
			
			S6Negating = False
			
		if S6Negating == True:
			
			if "c" not in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" not in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" not in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" not in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" not in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" not in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
	if "7" in slist:
		
		try:
			
			if slist[slist.index("7") + 1] in numstr:
				
				for c in c7:
					
					sconds.append(c)
					
				for c in e7:
					
					sconds.append(c)
					
			for n in range(slist.index("7") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist7 = slist[slist.index("7"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist7 = slist[slist.index("7"):n + 1]
					
					break
					
		except IndexError:
			
			slist7 = ["7"]
				
			for c in c7:
				
				sconds.append(c)
				
			for c in e7:
				
				sconds.append(c)
				
		if "-" in slist7:
			
			S7Negating = True
			
		else:
			
			S7Negating = False
			
		if S7Negating == True:
			
			if "c" not in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" not in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
	if "8" in slist:
		
		for c in x8:
			
			sconds.append(c)
			
	l = [bconds,sconds]
	
	return(l)
	
conditions = rparse(rule)

for y in range(0, 200):
	
	world.append([0] * 200)
	
def makeworld(rle, pos): # Assists in the conversion of an RLE to a matrix
	
	rlel = list(rle)
	
	mat = []
	
	for y in range(0, 200):
		
		mat.append([])
		
		for x in range(0, 200):
			
			mat[-1].append(0)
	
	digits = "0123456789"
	
	y = pos[0]
	
	x = pos[0]
	
	num = 0
	
	for char in rlel:
		
		if char in digits:
			
			num = num * 10 + int(char)
			
		else:
			
			if char == "b":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 0
					
					x += 1
					
			if char == "o":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 1
					
					x += 1
					
			if char == "$":
				
				x = pos[1]
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					y += 1
					
			num = 0
			
	return(mat)
	
def makerle(mat, selection): # Does the opposite of the previous function
	
	rlel = []
	
	num = 1
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, ydir):
			
			cell = mat[y][x]
			
			if cell == 0:
				
				rlel.append("b")
				
			else:
				
				rlel.append("o")
				
		rlel.append("$")
		
	rlel[len(rlel) - 1] = "!"
	
	listinit = rlel
		
	rle = "".join(listinit)
	
	return(rle)

rle = input("RLE (must be headerless, may be empty): ")

world = makeworld(rle, [0, 0])

pygame.init()

screen = pygame.display.set_mode((1000, 1000))

rectworld = []

for y in range(0, 200):
	
	rectworld.append([])
	
	for x in range(0, 200):
		
		rectworld[-1].append(pygame.Rect(x * 5, y * 5, 5, 5))
		
clock = pygame.time.Clock()

step = 0

running = True

dt = 0

def advance(world):
	
	global color
	
	global conditions
	
	# neigh = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]]
	
	neigh = [[1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1], [0, 1], [1, 1]]
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			neighs = 0
			
			neighlist = []
			
			for n in range(0, 8):
				
				newx = x + neigh[n][1]
				
				newy = y + neigh[n][0]
				
				if newx == 200:
					
					newx = 199
					
				if newx == -1:
					
					newx = 0
					
				if newy == 200:
					
					newy = 199
					
				if newy == -1:
					
					newy = 0
					
				if (world[newy][newx] != 0):
					
					neighlist.append("1")
					
					neighs += 1
					
				else:
					
					neighlist.append("0")
					
					
			neighstr = "".join(neighlist)
			
			if world[y][x] == 0 and (neighstr in conditions[0]):
				
				if not color:
					
					world[y][x] = 1
					
				else:
					
					world[y][x] = neighs + 1
					
				continue
				
			if world[y][x] != 0 and (neighstr not in conditions[1]):
				
				world[y][x] = 0
				
				continue
				
			if world[y][x] != 0 and (neighstr in conditions[1]):
				
				if color:
					
					world[y][x] = neighs + 1
					
				else:
					
					if world[y][x] != 1:
						
						world[y][x] = 1
						
	return world
	
def show(world):
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			if world[y][x] != 0:
				
				if not color:
					
					pygame.draw.rect(screen, "white", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, colors[world[y][x]], rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
				
				if world[y][x] == 3:
					
					pygame.draw.rect(screen, "blue", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, "red", rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
				
				pygame.draw.rect(screen, "maroon", rectworld[y][x])
				
			if (selection[0][0] <= y < selection[1][0] and selection[0][1] <= x < selection[1][1]) or (selection[0][0] >= y > selection[1][0] and selection[0][1] >= x > selection[1][1]) or (selection[0][0] >= y > selection[1][0] and selection[0][1] <= x < selection[1][1]) or (selection[0][0] <= y < selection[1][0] and selection[0][1] >= x > selection[1][1]):
					
				if world[y][x] != 0:
					
					pygame.draw.rect(screen, (128, 192, 128), rectworld[y][x])
					
				if world[y][x] == 0:
					
					pygame.draw.rect(screen, (0, 128, 0), rectworld[y][x])
					
				if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
					
					pygame.draw.rect(screen, (64, 64, 0), rectworld[y][x])
					
				if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
					
					pygame.draw.rect(screen, (128, 64, 0), rectworld[y][x])
					
def randfill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = random.randint(0, 1)
			
	return world
	
def zerofill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = 0
			
	return world
	
while running:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			running = False
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_k:
				if color:
					color = False
				else:
					color = True
			if event.key == pygame.K_q:
				running = False
			if event.key == pygame.K_r:
				world = randfill(selection)
			if event.key == pygame.K_c:
				print(makerle(world, selection))
				buffer = makerle(world, selection)
			if event.key == pygame.K_x:
				print(makerle(world, selection))
				buffer = makerle(world, selection)
				world = zerofill(selection)
			if event.key == pygame.K_v:
				world = makeworld(buffer, cursorpos)
			if event.key == pygame.K_t:
				rule = input("Rule: ")
				conditions = rparse(rule)
			if event.key == pygame.K_EQUALS:
				world = advance(world)
			if event.key == pygame.K_UP:
				cursorpos[0] -= 1
				cursorpos[0] %= 200
				if selectphase == 1:
					selection[1][0] -= 1
					selection[1][0] %= 200
			if event.key == pygame.K_DOWN:
				cursorpos[0] += 1
				cursorpos[0] %= 200
				if selectphase == 1:
					selection[1][0] += 1
					selection[1][0] %= 200
			if event.key == pygame.K_LEFT:
				cursorpos[1] -= 1
				cursorpos[1] %= 200
				if selectphase == 1:
					selection[1][1] -= 1
					selection[1][1] %= 200
			if event.key == pygame.K_RIGHT:
				cursorpos[1] += 1
				cursorpos[1] %= 200
				if selectphase == 1:
					selection[1][1] += 1
					selection[1][1] %= 200
			if event.key == pygame.K_RETURN:
				world[cursorpos[0]][cursorpos[1]] += 1
				world[cursorpos[0]][cursorpos[1]] %= 2
			if event.key == pygame.K_LSHIFT or event.key == pygame.K_RSHIFT:
				if selectphase == 0:
					selection[0][0] = cursorpos[0]
					selection[0][1] = cursorpos[1]
					selection[1][0] = cursorpos[0]
					selection[1][1] = cursorpos[1]
					selectphase = 1
				else:
					selection[1][0] = cursorpos[0]
					selection[1][1] = cursorpos[1]
					selectphase = 0
			if event.key == pygame.K_8:
				selection = [[100, 100], [100, 100]]
				selectphase = 0
			if event.key == pygame.K_BACKSPACE:
				world = zerofill(selection)
		
		left, middle, right = pygame.mouse.get_pressed()
		
		x, y = pygame.mouse.get_pos()
		
		if left:
			
			xx = x // 5
			
			yy = y // 5
			
			world[yy][xx] = 1
			
			cursorpos = [yy, xx]
		
		keys = pygame.key.get_pressed()
		
		if keys[pygame.K_SPACE]:
			world = advance(world)
		if keys[pygame.K_w]:
			cursorpos[0] -= 1
			cursorpos[0] %= 200
			if selectphase == 1:
				selection[1][0] -= 1
				selection[1][0] %= 200
		if keys[pygame.K_s]:
			cursorpos[0] += 1
			cursorpos[0] %= 200
			if selectphase == 1:
				selection[1][0] += 1
				selection[1][0] %= 200
		if keys[pygame.K_a]:
			cursorpos[1] -= 1
			cursorpos[1] %= 200
			if selectphase == 1:
				selection[1][1] -= 1
				selection[1][1] %= 200
		if keys[pygame.K_d]:
			cursorpos[1] += 1
			cursorpos[1] %= 200
			if selectphase == 1:
				selection[1][1] += 1
				selection[1][1] %= 200
		
	screen.fill("black")
	
	show(world)
	
	pygame.display.flip()
	
	dt = clock.tick(60) / 1000
	
pygame.quit()
Improvements:

- Added mouse support for drawing and moving the cursor (mouse selection WIP). Note that I haven't implemented a line-drawing algorithm yet, so when you draw something, it may be very dotty unless you draw it slowly.

- Added a way to clear the world or the current selection (Delete/Backspace key)

I will soon add more features to this program.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating INT naiverules

Post by MDA »

Version 1.4.0 is out now:

Code: Select all

import pygame

import random

color = False

colors = ["black", "gray", "white", "red", "green", "dodgerblue", "orange", "purple", "yellow", "magenta"]

world = []

cursorpos = [100, 100]

selection = [[100, 100], [100, 100]]

selectphase = 0

buffer = ""

rule = input("Rule: ")

def rparse(rule):
	
	# Complete isotropic tables (made by hand) for rule identification.
	
	x0 = ["00000000"]
	x8 = ["11111111"]
	c1 = ["01000000","00010000","00000100","00000001"]
	c2 = ["01010000","00010100","00000101","01000001"]
	c3 = ["01010100","00010101","01000101","01010001"]
	c4 = ["01010101"]
	c5 = ["10101110","10111010","11101010","10101011"]
	c6 = ["10111110","11111010","11101011","10101111"]
	c7 = ["10111111","11101111","11111011","11111110"]
	e1 = ["10000000","00100000","00001000","00000010"]
	e2 = ["10100000","00101000","00001010","10000010"]
	e3 = ["10101000","00101010","10001010","10100010"]
	e4 = ["10101010"]
	e5 = ["01011101","01110101","11010101","01010111"]
	e6 = ["01011111","01111101","11110101","11010111"]
	e7 = ["01111111","11111101","11110111","11011111"]
	k2 = ["10010000","10000100","00100100","00010010","00001001","01001000","01000010","00100001"]
	k3 = ["10100100","10010010","01001010","00101001"]
	k4 = ["10110100","10010110","11010010","10100101","01001011","01101001","00101101","01011010"]
	k5 = ["10110101","11010110","01011011","01101101"]
	k6 = ["10111101","11011110","11110110","10110111","11011011","11101101","01101111","01111011"]
	a2 = ["11000000","01100000","00110000","00011000","00001100","00000110","00000011","10000001"]
	a3 = ["11100000","00111000","00001110","10000011"]
	a4 = ["11110000","01111000","00111100","00011110","00001111","10000111","11000011","11100001"]
	a5 = ["01111100","00111110","10001111","11100011"]
	a6 = ["11111100","01111110","00111111","10011111","11001111","11100111","11110011","11111001"]
	i2 = ["10001000","00100010"]
	i3 = ["11000001","01110000","00011100","00000111"]
	i4 = ["11011000","00110110","10001101","01100011"]
	i5 = ["11111000","00111110","10001111","11100011"]
	i6 = ["01110111","11011101"]
	n2 = ["01000100","00010001"]
	n3 = ["11010000","10000101","00110100","00010110","00001101","01011000","01000011","01100001"]
	n4 = ["01110100","00010111","11010001","11000101","01000111","01110001","00011101","01011100"]
	n5 = ["10111100","10011110","11110010","10100111","11001011","11101001","00101111","01111010"]
	n6 = ["11101110","10111011"]
	y3 = ["10010100","00100101","01001001","01010010"]
	y4 = ["11010100","10010101","01010011","01100101","01001101","01011001","00110101","01010110"]
	y5 = ["01101011","10101101","10110110","11011010"]
	q3 = ["11000100","10010001","00010011","01100100","01001100","00011001","00110001","01000110"]
	q4 = ["11100100","10010011","01001110","00111001"]
	q5 = ["11101100","10011011","10110011","11100110","11001110","10111001","00111011","01101110"]
	j3 = ["10110000","10000110","11000010","10100001","00001011","01101000","00101100","00011010"]
	j4 = ["10101100","10011010","10110010","10100110","11001010","10101001","00101011","01101010"]
	j5 = ["11110100","10010111","11010011","11100101","01001111","01111001","11100101","11010011"]
	r3 = ["11001000","10001001","00100011","01100010","10001100","10011000","00110010","00100110"]
	r4 = ["11101000","10001011","10100011","11100010","10001110","10111000","00111010","00101110"]
	r5 = ["11011100","10011101","01110011","01100111","11001101","11011001","00110111","01110110"]
	t4 = ["10011100","01110010","11001001","00100111"]
	w4 = ["11011000","01100011","10001101","00110110"]
	z4 = ["11001100","10011001","00110011","01100110"]
	
	numstr = "012345678/"
	
	if rule == "":
		
		rule = "B3/S23"
	
	rulelist = list(rule)
	
	blist = rulelist[1:rulelist.index("S")]
	
	slist = rulelist[rulelist.index("S") + 1:]
	
	bconds = []
	
	sconds = []
	
	if "0" in blist:
		
		for c in x0:
			
			bconds.append(c)
			
	if "1" in blist:
		
		if blist[blist.index("1") + 1] in numstr:
			
			for c in c1:
				
				bconds.append(c)
				
			for c in e1:
				
				bconds.append(c)
		
		for n in range(blist.index("1") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist1 = blist[blist.index("1"):n]
				
				break
				
		if "-" in blist1:
			
			B1Negating = True
			
		else:
			
			B1Negating = False
			
		if B1Negating == True:
			
			if "c" not in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" not in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
	if "2" in blist:
		
		if blist[blist.index("2") + 1] in numstr:
			
			for c in c2:
				
				bconds.append(c)
				
			for c in e2:
				
				bconds.append(c)
				
			for c in k2:
				
				bconds.append(c)
				
			for c in a2:
				
				bconds.append(c)
				
			for c in i2:
				
				bconds.append(c)
				
			for c in n2:
				
				bconds.append(c)
				
		for n in range(blist.index("2") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist2 = blist[blist.index("2"):n]
				
				break
				
		if "-" in blist2:
			
			B2Negating = True
			
		else:
			
			B2Negating = False
			
		if B2Negating == True:
			
			if "c" not in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" not in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" not in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" not in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" not in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" not in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
	if "3" in blist:
		
		if blist[blist.index("3") + 1] in numstr:
			
			for c in c3:
				
				bconds.append(c)
				
			for c in e3:
				
				bconds.append(c)
				
			for c in k3:
				
				bconds.append(c)
				
			for c in a3:
				
				bconds.append(c)
				
			for c in i3:
				
				bconds.append(c)
				
			for c in n3:
				
				bconds.append(c)
				
			for c in y3:
				
				bconds.append(c)
				
			for c in q3:
				
				bconds.append(c)
				
			for c in j3:
				
				bconds.append(c)
				
			for c in r3:
				
				bconds.append(c)
				
		for n in range(blist.index("3") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist3 = blist[blist.index("3"):n]
				
				break
				
		if "-" in blist3:
			
			B3Negating = True
			
		else:
			
			B3Negating = False
			
		if B3Negating == True:
			
			if "c" not in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" not in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" not in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" not in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" not in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" not in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" not in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" not in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" not in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" not in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
	if "4" in blist:
		
		if blist[blist.index("4") + 1] in numstr:
			
			for c in c4:
				
				bconds.append(c)
				
			for c in e4:
				
				bconds.append(c)
				
			for c in k4:
				
				bconds.append(c)
				
			for c in a4:
				
				bconds.append(c)
				
			for c in i4:
				
				bconds.append(c)
				
			for c in n4:
				
				bconds.append(c)
				
			for c in y4:
				
				bconds.append(c)
				
			for c in q4:
				
				bconds.append(c)
				
			for c in j4:
				
				bconds.append(c)
				
			for c in r4:
				
				bconds.append(c)
				
			for c in t4:
				
				bconds.append(c)
				
			for c in w4:
				
				bconds.append(c)
				
			for c in z4:
				
				bconds.append(c)
				
		for n in range(blist.index("4") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist4 = blist[blist.index("4"):n]
				
				break
				
		if "-" in blist4:
			
			B4Negating = True
			
		else:
			
			B4Negating = False
			
		if B4Negating == True:
			
			if "c" not in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" not in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" not in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" not in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" not in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" not in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" not in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" not in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" not in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" not in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" not in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" not in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" not in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
	if "5" in blist:
		
		if blist[blist.index("5") + 1] in numstr:
			
			for c in c5:
				
				bconds.append(c)
				
			for c in e5:
				
				bconds.append(c)
				
			for c in k5:
				
				bconds.append(c)
				
			for c in a5:
				
				bconds.append(c)
				
			for c in i5:
				
				bconds.append(c)
				
			for c in n5:
				
				bconds.append(c)
				
			for c in y5:
				
				bconds.append(c)
				
			for c in q5:
				
				bconds.append(c)
				
			for c in j5:
				
				bconds.append(c)
				
			for c in r5:
				
				bconds.append(c)
				
		for n in range(blist.index("5") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist5 = blist[blist.index("5"):n]
				
				break
				
		if "-" in blist5:
			
			B5Negating = True
			
		else:
			
			B5Negating = False
			
		if B5Negating == True:
			
			if "c" not in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" not in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" not in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" not in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" not in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" not in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" not in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" not in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" not in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" not in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
	if "6" in blist:
		
		if blist[blist.index("6") + 1] in numstr:
			
			for c in c6:
				
				bconds.append(c)
				
			for c in e6:
				
				bconds.append(c)
				
			for c in k6:
				
				bconds.append(c)
				
			for c in a6:
				
				bconds.append(c)
				
			for c in i6:
				
				bconds.append(c)
				
			for c in n6:
				
				bconds.append(c)
				
		for n in range(blist.index("6") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist6 = blist[blist.index("6"):n]
				
				break
				
		if "-" in blist6:
			
			B6Negating = True
			
		else:
			
			B6Negating = False
			
		if B6Negating == True:
			
			if "c" not in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" not in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" not in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" not in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" not in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" not in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
	if "7" in blist:
		
		if blist[blist.index("7") + 1] in numstr:
			
			for c in c7:
				
				bconds.append(c)
				
			for c in e7:
				
				bconds.append(c)
		
		for n in range(blist.index("7") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist7 = blist[blist.index("7"):n]
				
				break
				
		if "-" in blist7:
			
			B7Negating = True
			
		else:
			
			B7Negating = False
			
		if B7Negating == True:
			
			if "c" not in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" not in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
	if "8" in blist:
		
		for c in x8:
			
			bconds.append(c)
			
	if "0" in slist:
		
		for c in x0:
			
			sconds.append(c)
			
	if "1" in slist:
		
		try:
			
			if slist[slist.index("1") + 1] in numstr:
				
				for c in c1:
					
					sconds.append(c)
					
				for c in e1:
					
					sconds.append(c)
			
			for n in range(slist.index("1") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist1 = slist[slist.index("1"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist1 = slist[slist.index("1"):n + 1]
					
					break
					
		except IndexError:
			
			slist1 = ["1"]
			
			for c in c1:
				
				sconds.append(c)
				
			for c in e1:
				
				sconds.append(e)
				
		if "-" in slist1:
			
			S1Negating = True
			
		else:
			
			S1Negating = False
			
		if S1Negating == True:
			
			if "c" not in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" not in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
	if "2" in slist:
		
		try:
		
			if slist[slist.index("2") + 1] in numstr:
				
				for c in c2:
					
					sconds.append(c)
					
				for c in e2:
					
					sconds.append(c)
					
				for c in k2:
					
					sconds.append(c)
					
				for c in a2:
					
					sconds.append(c)
					
				for c in i2:
					
					sconds.append(c)
					
				for c in n2:
					
					sconds.append(c)
					
			for n in range(slist.index("2") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist2 = slist[slist.index("2"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist2 = slist[slist.index("2"):n + 1]
					
					break
					
		except IndexError:
			
			slist2 = ["2"]
				
			for c in c2:
				
				sconds.append(c)
				
			for c in e2:
				
				sconds.append(c)
				
			for c in k2:
				
				sconds.append(c)
				
			for c in a2:
				
				sconds.append(c)
				
			for c in i2:
				
				sconds.append(c)
				
			for c in n2:
				
				sconds.append(c)
				
		if "-" in slist2:
			
			S2Negating = True
			
		else:
			
			S2Negating = False
			
		if S2Negating == True:
			
			if "c" not in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" not in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" not in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" not in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" not in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" not in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
	if "3" in slist:
		
		try:
			
			if slist[slist.index("3") + 1] in numstr:
				
				for c in c3:
					
					sconds.append(c)
					
				for c in e3:
					
					sconds.append(c)
					
				for c in k3:
					
					sconds.append(c)
					
				for c in a3:
					
					sconds.append(c)
					
				for c in i3:
					
					sconds.append(c)
					
				for c in n3:
					
					sconds.append(c)
					
				for c in y3:
					
					sconds.append(c)
					
				for c in q3:
					
					sconds.append(c)
					
				for c in j3:
					
					sconds.append(c)
					
				for c in r3:
					
					sconds.append(c)
					
			for n in range(slist.index("3") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist3 = slist[slist.index("3"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist3 = slist[slist.index("3"):n + 1]
					
					break
					
		except IndexError:
			
			slist3 = ["3"]
			
			for c in c3:
				
				sconds.append(c)
				
			for c in e3:
				
				sconds.append(c)
				
			for c in k3:
				
				sconds.append(c)
				
			for c in a3:
				
				sconds.append(c)
				
			for c in i3:
				
				sconds.append(c)
				
			for c in n3:
				
				sconds.append(c)
				
			for c in y3:
				
				sconds.append(c)
				
			for c in q3:
				
				sconds.append(c)
				
			for c in j3:
				
				sconds.append(c)
				
			for c in r3:
				
				sconds.append(c)
				
		if "-" in slist3:
			
			S3Negating = True
			
		else:
			
			S3Negating = False
			
		if S3Negating == True:
			
			if "c" not in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" not in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" not in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" not in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" not in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" not in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" not in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" not in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" not in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" not in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
	if "4" in slist:
		
		try:
			
			if slist[slist.index("4") + 1] in numstr:
				
				for c in c4:
					
					sconds.append(c)
					
				for c in e4:
					
					sconds.append(c)
					
				for c in k4:
					
					sconds.append(c)
					
				for c in a4:
					
					sconds.append(c)
					
				for c in i4:
					
					sconds.append(c)
					
				for c in n4:
					
					sconds.append(c)
					
				for c in y4:
					
					sconds.append(c)
					
				for c in q4:
					
					sconds.append(c)
					
				for c in j4:
					
					sconds.append(c)
					
				for c in r4:
					
					sconds.append(c)
					
				for c in t4:
					
					sconds.append(c)
					
				for c in w4:
					
					sconds.append(c)
					
				for c in z4:
					
					sconds.append(c)
					
			for n in range(slist.index("4") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist4 = slist[slist.index("4"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist4 = slist[slist.index("4"):n + 1]
					
					break
					
		except IndexError:
			
			slist4 = ["4"]
			
			for c in c4:
				
				sconds.append(c)
				
			for c in e4:
				
				sconds.append(c)
				
			for c in k4:
				
				sconds.append(c)
				
			for c in a4:
				
				sconds.append(c)
				
			for c in i4:
				
				sconds.append(c)
				
			for c in n4:
				
				sconds.append(c)
				
			for c in y4:
				
				sconds.append(c)
				
			for c in q4:
				
				sconds.append(c)
				
			for c in j4:
				
				sconds.append(c)
				
			for c in r4:
				
				sconds.append(c)
				
			for c in t4:
				
				sconds.append(c)
				
			for c in w4:
				
				sconds.append(c)
				
			for c in z4:
				
				sconds.append(c)
				
		if "-" in slist4:
			
			S4Negating = True
			
		else:
			
			S4Negating = False
			
		if S4Negating == True:
			
			if "c" not in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" not in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" not in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" not in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" not in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" not in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" not in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" not in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" not in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" not in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" not in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" not in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" not in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
	if "5" in slist:
		
		try:
			
			if slist[slist.index("5") + 1] in numstr:
				
				for c in c5:
					
					sconds.append(c)
					
				for c in e5:
					
					sconds.append(c)
					
				for c in k5:
					
					sconds.append(c)
					
				for c in a5:
					
					sconds.append(c)
					
				for c in i5:
					
					sconds.append(c)
					
				for c in n5:
					
					sconds.append(c)
					
				for c in y5:
					
					sconds.append(c)
					
				for c in q5:
					
					sconds.append(c)
					
				for c in j5:
					
					sconds.append(c)
					
				for c in r5:
					
					sconds.append(c)
					
			for n in range(slist.index("5") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist5 = slist[slist.index("5"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist5 = slist[slist.index("5"):n + 1]
					
					break
					
		except IndexError:
			
			slist5 = ["5"]
				
			for c in c5:
				
				sconds.append(c)
				
			for c in e5:
				
				sconds.append(c)
				
			for c in k5:
				
				sconds.append(c)
				
			for c in a5:
				
				sconds.append(c)
				
			for c in i5:
				
				sconds.append(c)
				
			for c in n5:
				
				sconds.append(c)
				
			for c in y5:
				
				sconds.append(c)
				
			for c in q5:
				
				sconds.append(c)
				
			for c in j5:
				
				sconds.append(c)
				
			for c in r5:
				
				sconds.append(c)
				
		if "-" in slist5:
			
			S5Negating = True
			
		else:
			
			S5Negating = False
			
		if S5Negating == True:
			
			if "c" not in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" not in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" not in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" not in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" not in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" not in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" not in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" not in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" not in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" not in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
	if "6" in slist:
		
		try:
			
			if slist[slist.index("6") + 1] in numstr:
				
				for c in c6:
					
					sconds.append(c)
					
				for c in e6:
					
					sconds.append(c)
					
				for c in k6:
					
					sconds.append(c)
					
				for c in a6:
					
					sconds.append(c)
					
				for c in i6:
					
					sconds.append(c)
					
				for c in n6:
					
					sconds.append(c)
					
			for n in range(slist.index("6") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist6 = slist[slist.index("6"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist6 = slist[slist.index("6"):n + 1]
					
					break
					
		except IndexError:
			
			slist6 = ["6"]
				
			for c in c6:
				
				sconds.append(c)
				
			for c in e6:
				
				sconds.append(c)
				
			for c in k6:
				
				sconds.append(c)
				
			for c in a6:
				
				sconds.append(c)
				
			for c in i6:
				
				sconds.append(c)
				
			for c in n6:
				
				sconds.append(c)
				
		if "-" in slist6:
			
			S6Negating = True
			
		else:
			
			S6Negating = False
			
		if S6Negating == True:
			
			if "c" not in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" not in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" not in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" not in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" not in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" not in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
	if "7" in slist:
		
		try:
			
			if slist[slist.index("7") + 1] in numstr:
				
				for c in c7:
					
					sconds.append(c)
					
				for c in e7:
					
					sconds.append(c)
					
			for n in range(slist.index("7") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist7 = slist[slist.index("7"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist7 = slist[slist.index("7"):n + 1]
					
					break
					
		except IndexError:
			
			slist7 = ["7"]
				
			for c in c7:
				
				sconds.append(c)
				
			for c in e7:
				
				sconds.append(c)
				
		if "-" in slist7:
			
			S7Negating = True
			
		else:
			
			S7Negating = False
			
		if S7Negating == True:
			
			if "c" not in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" not in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
	if "8" in slist:
		
		for c in x8:
			
			sconds.append(c)
			
	l = [bconds,sconds]
	
	return(l)
	
conditions = rparse(rule)

for y in range(0, 200):
	
	world.append([0] * 200)
	
def makeworld(rle, pos): # Assists in the conversion of an RLE to a matrix
	
	rlel = list(rle)
	
	mat = []
	
	for y in range(0, 200):
		
		mat.append([])
		
		for x in range(0, 200):
			
			mat[-1].append(0)
	
	digits = "0123456789"
	
	y = pos[0]
	
	x = pos[0]
	
	num = 0
	
	for char in rlel:
		
		if char in digits:
			
			num = num * 10 + int(char)
			
		else:
			
			if char == "b":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 0
					
					x += 1
					
			if char == "o":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					mat[y][x] = 1
					
					x += 1
					
			if char == "$":
				
				x = pos[1]
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					y += 1
					
			num = 0
			
	return(mat)
	
def makerle(mat, selection): # Does the opposite of the previous function
	
	rlel = []
	
	num = 1
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, ydir):
			
			cell = mat[y][x]
			
			if cell == 0:
				
				rlel.append("b")
				
			else:
				
				rlel.append("o")
				
		rlel.append("$")
		
	rlel[len(rlel) - 1] = "!"
	
	listinit = rlel
		
	rle = "".join(listinit)
	
	return(rle)

rle = input("RLE (must be headerless, may be empty): ")

world = makeworld(rle, [0, 0])

pygame.init()

screen = pygame.display.set_mode((1000, 1000))

rectworld = []

for y in range(0, 200):
	
	rectworld.append([])
	
	for x in range(0, 200):
		
		rectworld[-1].append(pygame.Rect(x * 5, y * 5, 5, 5))
		
clock = pygame.time.Clock()

step = 0

running = True

dt = 0

def advance(world):
	
	global color
	
	global conditions
	
	# neigh = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]]
	
	neigh = [[1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1], [0, 1], [1, 1]]
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			neighs = 0
			
			neighlist = []
			
			for n in range(0, 8):
				
				newx = x + neigh[n][1]
				
				newy = y + neigh[n][0]
				
				if newx == 200:
					
					newx = 199
					
				if newx == -1:
					
					newx = 0
					
				if newy == 200:
					
					newy = 199
					
				if newy == -1:
					
					newy = 0
					
				if (world[newy][newx] != 0):
					
					neighlist.append("1")
					
					neighs += 1
					
				else:
					
					neighlist.append("0")
					
					
			neighstr = "".join(neighlist)
			
			if world[y][x] == 0 and (neighstr in conditions[0]):
				
				if not color:
					
					world[y][x] = 1
					
				else:
					
					world[y][x] = neighs + 1
					
				continue
				
			if world[y][x] != 0 and (neighstr not in conditions[1]):
				
				world[y][x] = 0
				
				continue
				
			if world[y][x] != 0 and (neighstr in conditions[1]):
				
				if color:
					
					world[y][x] = neighs + 1
					
				else:
					
					if world[y][x] != 1:
						
						world[y][x] = 1
						
	return world
	
def show(world):
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			if world[y][x] != 0:
				
				if not color:
					
					pygame.draw.rect(screen, "white", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, colors[world[y][x]], rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
				
				if world[y][x] == 3:
					
					pygame.draw.rect(screen, "blue", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, "red", rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
				
				pygame.draw.rect(screen, "maroon", rectworld[y][x])
				
			if (selection[0][0] <= y < selection[1][0] and selection[0][1] <= x < selection[1][1]) or (selection[0][0] >= y > selection[1][0] and selection[0][1] >= x > selection[1][1]) or (selection[0][0] >= y > selection[1][0] and selection[0][1] <= x < selection[1][1]) or (selection[0][0] <= y < selection[1][0] and selection[0][1] >= x > selection[1][1]):
					
				if world[y][x] != 0:
					
					pygame.draw.rect(screen, (128, 192, 128), rectworld[y][x])
					
				if world[y][x] == 0:
					
					pygame.draw.rect(screen, (0, 128, 0), rectworld[y][x])
					
				if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
					
					pygame.draw.rect(screen, (64, 64, 0), rectworld[y][x])
					
				if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
					
					pygame.draw.rect(screen, (128, 64, 0), rectworld[y][x])
					
def randfill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = random.randint(0, 1)
			
	return world
	
def zerofill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = 0
			
	return world
	
def invfill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = 0 if world[y][x] != 0 else 1
			
	return world
	
keysheld = []

while running:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			running = False
		if event.type == pygame.KEYDOWN:
			keysheld.append(event.key)
			if event.key == pygame.K_k:
				if color:
					color = False
				else:
					color = True
			if event.key == pygame.K_q:
				running = False
			if event.key == pygame.K_r:
				world = randfill(selection)
			if event.key == pygame.K_i:
				world = invfill(selection)
			if event.key == pygame.K_c:
				print(makerle(world, selection))
				buffer = makerle(world, selection)
			if event.key == pygame.K_x:
				print(makerle(world, selection))
				buffer = makerle(world, selection)
				world = zerofill(selection)
			if event.key == pygame.K_v:
				world = makeworld(buffer, cursorpos)
			if event.key == pygame.K_t:
				rule = input("Rule: ")
				conditions = rparse(rule)
			if event.key == pygame.K_EQUALS:
				world = advance(world)
			if event.key == pygame.K_UP:
				cursorpos[0] -= 1
				cursorpos[0] %= 200
				if selectphase == 1:
					selection[1][0] -= 1
					selection[1][0] %= 200
			if event.key == pygame.K_DOWN:
				cursorpos[0] += 1
				cursorpos[0] %= 200
				if selectphase == 1:
					selection[1][0] += 1
					selection[1][0] %= 200
			if event.key == pygame.K_LEFT:
				cursorpos[1] -= 1
				cursorpos[1] %= 200
				if selectphase == 1:
					selection[1][1] -= 1
					selection[1][1] %= 200
			if event.key == pygame.K_RIGHT:
				cursorpos[1] += 1
				cursorpos[1] %= 200
				if selectphase == 1:
					selection[1][1] += 1
					selection[1][1] %= 200
			if event.key == pygame.K_RETURN:
				world[cursorpos[0]][cursorpos[1]] += 1
				world[cursorpos[0]][cursorpos[1]] %= 2
			if event.key == pygame.K_LSHIFT or event.key == pygame.K_RSHIFT:
				if selectphase == 0:
					selection[0][0] = cursorpos[0]
					selection[0][1] = cursorpos[1]
					selection[1][0] = cursorpos[0]
					selection[1][1] = cursorpos[1]
					selectphase = 1
				else:
					selection[1][0] = cursorpos[0]
					selection[1][1] = cursorpos[1]
					selectphase = 0
			if event.key == pygame.K_8:
				selection = [[100, 100], [100, 100]]
				selectphase = 0
			if event.key == pygame.K_BACKSPACE:
				world = zerofill(selection)
				
			if (pygame.K_LSHIFT in keysheld or pygame.K_RSHIFT in keysheld) and pygame.K_s in keysheld:
				path = input("Path to save pattern: ")
				with open(path, "w") as file:
					newrule = rule
					if rule == "":
						newrule = "B3/S23"
					file.write(f"x = 0, y = 0, rule = {newrule}\n")
					file.write(makerle(world, [[0, 0], [0, 0]]))
				
		elif event.type == pygame.KEYUP:
			keysheld.remove(event.key)
		
		left, middle, right = pygame.mouse.get_pressed()
		
		x, y = pygame.mouse.get_pos()
		
		if left:
			
			xx = x // 5
			
			yy = y // 5
			
			world[yy][xx] = 1
			
			cursorpos = [yy, xx]
			
		if right:
			
			xx = x // 5
			
			yy = y // 5
			
			world[yy][xx] = 0
			
			cursorpos = [yy, xx]
			
		keys = pygame.key.get_pressed()
		
		if keys[pygame.K_SPACE]:
			world = advance(world)
		if keys[pygame.K_w]:
			cursorpos[0] -= 1
			cursorpos[0] %= 200
			if selectphase == 1:
				selection[1][0] -= 1
				selection[1][0] %= 200
		if keys[pygame.K_s]:
			cursorpos[0] += 1
			cursorpos[0] %= 200
			if selectphase == 1:
				selection[1][0] += 1
				selection[1][0] %= 200
		if keys[pygame.K_a]:
			cursorpos[1] -= 1
			cursorpos[1] %= 200
			if selectphase == 1:
				selection[1][1] -= 1
				selection[1][1] %= 200
		if keys[pygame.K_d]:
			cursorpos[1] += 1
			cursorpos[1] %= 200
			if selectphase == 1:
				selection[1][1] += 1
				selection[1][1] %= 200

		
	screen.fill("black")
	
	show(world)
	
	pygame.display.flip()
	
	dt = clock.tick(60) / 1000
	
pygame.quit()
Improvements:

- Added right-click gesture for erasing cells

- Added save functionality with Shift + S (you will be prompted for a file to save the current pattern and will receive an RLE in the file. The RLE can then be copy/pasted into Golly and LV).

- Added invert function (I key).

Once again, I heavily encourage research into all Naiverules supported by NaiViewer. Post your results here.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

Version 1.4.1 is out now:

Code: Select all

import pygame

import random

color = False

fullcopy = False

colors = ["black", "gray", "white", "red", "green", "dodgerblue", "orange", "purple", "yellow", "magenta"]

world = []

cursorpos = [100, 100]

selection = [[100, 100], [100, 100]]

selectphase = 0

buffer = ""

rule = input("Rule: ")

def rparse(rule):
	
	# Complete isotropic tables (made by hand) for rule identification.
	
	x0 = ["00000000"]
	x8 = ["11111111"]
	c1 = ["01000000","00010000","00000100","00000001"]
	c2 = ["01010000","00010100","00000101","01000001"]
	c3 = ["01010100","00010101","01000101","01010001"]
	c4 = ["01010101"]
	c5 = ["10101110","10111010","11101010","10101011"]
	c6 = ["10111110","11111010","11101011","10101111"]
	c7 = ["10111111","11101111","11111011","11111110"]
	e1 = ["10000000","00100000","00001000","00000010"]
	e2 = ["10100000","00101000","00001010","10000010"]
	e3 = ["10101000","00101010","10001010","10100010"]
	e4 = ["10101010"]
	e5 = ["01011101","01110101","11010101","01010111"]
	e6 = ["01011111","01111101","11110101","11010111"]
	e7 = ["01111111","11111101","11110111","11011111"]
	k2 = ["10010000","10000100","00100100","00010010","00001001","01001000","01000010","00100001"]
	k3 = ["10100100","10010010","01001010","00101001"]
	k4 = ["10110100","10010110","11010010","10100101","01001011","01101001","00101101","01011010"]
	k5 = ["10110101","11010110","01011011","01101101"]
	k6 = ["10111101","11011110","11110110","10110111","11011011","11101101","01101111","01111011"]
	a2 = ["11000000","01100000","00110000","00011000","00001100","00000110","00000011","10000001"]
	a3 = ["11100000","00111000","00001110","10000011"]
	a4 = ["11110000","01111000","00111100","00011110","00001111","10000111","11000011","11100001"]
	a5 = ["01111100","00111110","10001111","11100011"]
	a6 = ["11111100","01111110","00111111","10011111","11001111","11100111","11110011","11111001"]
	i2 = ["10001000","00100010"]
	i3 = ["11000001","01110000","00011100","00000111"]
	i4 = ["11011000","00110110","10001101","01100011"]
	i5 = ["11111000","00111110","10001111","11100011"]
	i6 = ["01110111","11011101"]
	n2 = ["01000100","00010001"]
	n3 = ["11010000","10000101","00110100","00010110","00001101","01011000","01000011","01100001"]
	n4 = ["01110100","00010111","11010001","11000101","01000111","01110001","00011101","01011100"]
	n5 = ["10111100","10011110","11110010","10100111","11001011","11101001","00101111","01111010"]
	n6 = ["11101110","10111011"]
	y3 = ["10010100","00100101","01001001","01010010"]
	y4 = ["11010100","10010101","01010011","01100101","01001101","01011001","00110101","01010110"]
	y5 = ["01101011","10101101","10110110","11011010"]
	q3 = ["11000100","10010001","00010011","01100100","01001100","00011001","00110001","01000110"]
	q4 = ["11100100","10010011","01001110","00111001"]
	q5 = ["11101100","10011011","10110011","11100110","11001110","10111001","00111011","01101110"]
	j3 = ["10110000","10000110","11000010","10100001","00001011","01101000","00101100","00011010"]
	j4 = ["10101100","10011010","10110010","10100110","11001010","10101001","00101011","01101010"]
	j5 = ["11110100","10010111","11010011","11100101","01001111","01111001","11100101","11010011"]
	r3 = ["11001000","10001001","00100011","01100010","10001100","10011000","00110010","00100110"]
	r4 = ["11101000","10001011","10100011","11100010","10001110","10111000","00111010","00101110"]
	r5 = ["11011100","10011101","01110011","01100111","11001101","11011001","00110111","01110110"]
	t4 = ["10011100","01110010","11001001","00100111"]
	w4 = ["11011000","01100011","10001101","00110110"]
	z4 = ["11001100","10011001","00110011","01100110"]
	
	numstr = "012345678/"
	
	if rule == "":
		
		rule = "B3/S23"
	
	rulelist = list(rule)
	
	blist = rulelist[1:rulelist.index("S")]
	
	slist = rulelist[rulelist.index("S") + 1:]
	
	bconds = []
	
	sconds = []
	
	if "0" in blist:
		
		for c in x0:
			
			bconds.append(c)
			
	if "1" in blist:
		
		if blist[blist.index("1") + 1] in numstr:
			
			for c in c1:
				
				bconds.append(c)
				
			for c in e1:
				
				bconds.append(c)
		
		for n in range(blist.index("1") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist1 = blist[blist.index("1"):n]
				
				break
				
		if "-" in blist1:
			
			B1Negating = True
			
		else:
			
			B1Negating = False
			
		if B1Negating == True:
			
			if "c" not in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" not in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist1:
				
				for c in c1:
					
					bconds.append(c)
					
			if "e" in blist1:
				
				for c in e1:
					
					bconds.append(c)
					
	if "2" in blist:
		
		if blist[blist.index("2") + 1] in numstr:
			
			for c in c2:
				
				bconds.append(c)
				
			for c in e2:
				
				bconds.append(c)
				
			for c in k2:
				
				bconds.append(c)
				
			for c in a2:
				
				bconds.append(c)
				
			for c in i2:
				
				bconds.append(c)
				
			for c in n2:
				
				bconds.append(c)
				
		for n in range(blist.index("2") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist2 = blist[blist.index("2"):n]
				
				break
				
		if "-" in blist2:
			
			B2Negating = True
			
		else:
			
			B2Negating = False
			
		if B2Negating == True:
			
			if "c" not in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" not in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" not in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" not in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" not in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" not in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist2:
				
				for c in c2:
					
					bconds.append(c)
					
			if "e" in blist2:
				
				for c in e2:
					
					bconds.append(c)
					
			if "k" in blist2:
				
				for c in k2:
					
					bconds.append(c)
					
			if "a" in blist2:
				
				for c in a2:
					
					bconds.append(c)
					
			if "i" in blist2:
				
				for c in i2:
					
					bconds.append(c)
					
			if "n" in blist2:
				
				for c in n2:
					
					bconds.append(c)
					
	if "3" in blist:
		
		if blist[blist.index("3") + 1] in numstr:
			
			for c in c3:
				
				bconds.append(c)
				
			for c in e3:
				
				bconds.append(c)
				
			for c in k3:
				
				bconds.append(c)
				
			for c in a3:
				
				bconds.append(c)
				
			for c in i3:
				
				bconds.append(c)
				
			for c in n3:
				
				bconds.append(c)
				
			for c in y3:
				
				bconds.append(c)
				
			for c in q3:
				
				bconds.append(c)
				
			for c in j3:
				
				bconds.append(c)
				
			for c in r3:
				
				bconds.append(c)
				
		for n in range(blist.index("3") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist3 = blist[blist.index("3"):n]
				
				break
				
		if "-" in blist3:
			
			B3Negating = True
			
		else:
			
			B3Negating = False
			
		if B3Negating == True:
			
			if "c" not in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" not in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" not in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" not in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" not in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" not in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" not in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" not in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" not in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" not in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist3:
				
				for c in c3:
					
					bconds.append(c)
					
			if "e" in blist3:
				
				for c in e3:
					
					bconds.append(c)
					
			if "k" in blist3:
				
				for c in k3:
					
					bconds.append(c)
					
			if "a" in blist3:
				
				for c in a3:
					
					bconds.append(c)
					
			if "i" in blist3:
				
				for c in i3:
					
					bconds.append(c)
					
			if "n" in blist3:
				
				for c in n3:
					
					bconds.append(c)
					
			if "y" in blist3:
				
				for c in y3:
					
					bconds.append(c)
					
			if "q" in blist3:
				
				for c in q3:
					
					bconds.append(c)
					
			if "j" in blist3:
				
				for c in j3:
					
					bconds.append(c)
					
			if "r" in blist3:
				
				for c in r3:
					
					bconds.append(c)
					
	if "4" in blist:
		
		if blist[blist.index("4") + 1] in numstr:
			
			for c in c4:
				
				bconds.append(c)
				
			for c in e4:
				
				bconds.append(c)
				
			for c in k4:
				
				bconds.append(c)
				
			for c in a4:
				
				bconds.append(c)
				
			for c in i4:
				
				bconds.append(c)
				
			for c in n4:
				
				bconds.append(c)
				
			for c in y4:
				
				bconds.append(c)
				
			for c in q4:
				
				bconds.append(c)
				
			for c in j4:
				
				bconds.append(c)
				
			for c in r4:
				
				bconds.append(c)
				
			for c in t4:
				
				bconds.append(c)
				
			for c in w4:
				
				bconds.append(c)
				
			for c in z4:
				
				bconds.append(c)
				
		for n in range(blist.index("4") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist4 = blist[blist.index("4"):n]
				
				break
				
		if "-" in blist4:
			
			B4Negating = True
			
		else:
			
			B4Negating = False
			
		if B4Negating == True:
			
			if "c" not in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" not in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" not in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" not in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" not in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" not in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" not in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" not in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" not in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" not in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" not in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" not in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" not in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist4:
				
				for c in c4:
					
					bconds.append(c)
					
			if "e" in blist4:
				
				for c in e4:
					
					bconds.append(c)
					
			if "k" in blist4:
				
				for c in k4:
					
					bconds.append(c)
					
			if "a" in blist4:
				
				for c in a4:
					
					bconds.append(c)
					
			if "i" in blist4:
				
				for c in i4:
					
					bconds.append(c)
					
			if "n" in blist4:
				
				for c in n4:
					
					bconds.append(c)
					
			if "y" in blist4:
				
				for c in y4:
					
					bconds.append(c)
					
			if "q" in blist4:
				
				for c in q4:
					
					bconds.append(c)
					
			if "j" in blist4:
				
				for c in j4:
					
					bconds.append(c)
					
			if "r" in blist4:
				
				for c in r4:
					
					bconds.append(c)
					
			if "t" in blist4:
				
				for c in t4:
					
					bconds.append(c)
					
			if "w" in blist4:
				
				for c in w4:
					
					bconds.append(c)
					
			if "z" in blist4:
				
				for c in z4:
					
					bconds.append(c)
					
	if "5" in blist:
		
		if blist[blist.index("5") + 1] in numstr:
			
			for c in c5:
				
				bconds.append(c)
				
			for c in e5:
				
				bconds.append(c)
				
			for c in k5:
				
				bconds.append(c)
				
			for c in a5:
				
				bconds.append(c)
				
			for c in i5:
				
				bconds.append(c)
				
			for c in n5:
				
				bconds.append(c)
				
			for c in y5:
				
				bconds.append(c)
				
			for c in q5:
				
				bconds.append(c)
				
			for c in j5:
				
				bconds.append(c)
				
			for c in r5:
				
				bconds.append(c)
				
		for n in range(blist.index("5") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist5 = blist[blist.index("5"):n]
				
				break
				
		if "-" in blist5:
			
			B5Negating = True
			
		else:
			
			B5Negating = False
			
		if B5Negating == True:
			
			if "c" not in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" not in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" not in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" not in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" not in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" not in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" not in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" not in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" not in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" not in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist5:
				
				for c in c5:
					
					bconds.append(c)
					
			if "e" in blist5:
				
				for c in e5:
					
					bconds.append(c)
					
			if "k" in blist5:
				
				for c in k5:
					
					bconds.append(c)
					
			if "a" in blist5:
				
				for c in a5:
					
					bconds.append(c)
					
			if "i" in blist5:
				
				for c in i5:
					
					bconds.append(c)
					
			if "n" in blist5:
				
				for c in n5:
					
					bconds.append(c)
					
			if "y" in blist5:
				
				for c in y5:
					
					bconds.append(c)
					
			if "q" in blist5:
				
				for c in q5:
					
					bconds.append(c)
					
			if "j" in blist5:
				
				for c in j5:
					
					bconds.append(c)
					
			if "r" in blist5:
				
				for c in r5:
					
					bconds.append(c)
					
	if "6" in blist:
		
		if blist[blist.index("6") + 1] in numstr:
			
			for c in c6:
				
				bconds.append(c)
				
			for c in e6:
				
				bconds.append(c)
				
			for c in k6:
				
				bconds.append(c)
				
			for c in a6:
				
				bconds.append(c)
				
			for c in i6:
				
				bconds.append(c)
				
			for c in n6:
				
				bconds.append(c)
				
		for n in range(blist.index("6") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist6 = blist[blist.index("6"):n]
				
				break
				
		if "-" in blist6:
			
			B6Negating = True
			
		else:
			
			B6Negating = False
			
		if B6Negating == True:
			
			if "c" not in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" not in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" not in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" not in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" not in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" not in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist6:
				
				for c in c6:
					
					bconds.append(c)
					
			if "e" in blist6:
				
				for c in e6:
					
					bconds.append(c)
					
			if "k" in blist6:
				
				for c in k6:
					
					bconds.append(c)
					
			if "a" in blist6:
				
				for c in a6:
					
					bconds.append(c)
					
			if "i" in blist6:
				
				for c in i6:
					
					bconds.append(c)
					
			if "n" in blist6:
				
				for c in n6:
					
					bconds.append(c)
					
	if "7" in blist:
		
		if blist[blist.index("7") + 1] in numstr:
			
			for c in c7:
				
				bconds.append(c)
				
			for c in e7:
				
				bconds.append(c)
		
		for n in range(blist.index("7") + 1,len(blist)):
			
			if blist[n] in numstr:
				
				blist7 = blist[blist.index("7"):n]
				
				break
				
		if "-" in blist7:
			
			B7Negating = True
			
		else:
			
			B7Negating = False
			
		if B7Negating == True:
			
			if "c" not in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" not in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
		else:
			
			if "c" in blist7:
				
				for c in c7:
					
					bconds.append(c)
					
			if "e" in blist7:
				
				for c in e7:
					
					bconds.append(c)
					
	if "8" in blist:
		
		for c in x8:
			
			bconds.append(c)
			
	if "0" in slist:
		
		for c in x0:
			
			sconds.append(c)
			
	if "1" in slist:
		
		try:
			
			if slist[slist.index("1") + 1] in numstr:
				
				for c in c1:
					
					sconds.append(c)
					
				for c in e1:
					
					sconds.append(c)
			
			for n in range(slist.index("1") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist1 = slist[slist.index("1"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist1 = slist[slist.index("1"):n + 1]
					
					break
					
		except IndexError:
			
			slist1 = ["1"]
			
			for c in c1:
				
				sconds.append(c)
				
			for c in e1:
				
				sconds.append(e)
				
		if "-" in slist1:
			
			S1Negating = True
			
		else:
			
			S1Negating = False
			
		if S1Negating == True:
			
			if "c" not in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" not in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist1:
				
				for c in c1:
					
					sconds.append(c)
					
			if "e" in slist1:
				
				for c in e1:
					
					sconds.append(c)
					
	if "2" in slist:
		
		try:
		
			if slist[slist.index("2") + 1] in numstr:
				
				for c in c2:
					
					sconds.append(c)
					
				for c in e2:
					
					sconds.append(c)
					
				for c in k2:
					
					sconds.append(c)
					
				for c in a2:
					
					sconds.append(c)
					
				for c in i2:
					
					sconds.append(c)
					
				for c in n2:
					
					sconds.append(c)
					
			for n in range(slist.index("2") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist2 = slist[slist.index("2"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist2 = slist[slist.index("2"):n + 1]
					
					break
					
		except IndexError:
			
			slist2 = ["2"]
				
			for c in c2:
				
				sconds.append(c)
				
			for c in e2:
				
				sconds.append(c)
				
			for c in k2:
				
				sconds.append(c)
				
			for c in a2:
				
				sconds.append(c)
				
			for c in i2:
				
				sconds.append(c)
				
			for c in n2:
				
				sconds.append(c)
				
		if "-" in slist2:
			
			S2Negating = True
			
		else:
			
			S2Negating = False
			
		if S2Negating == True:
			
			if "c" not in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" not in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" not in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" not in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" not in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" not in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist2:
				
				for c in c2:
					
					sconds.append(c)
					
			if "e" in slist2:
				
				for c in e2:
					
					sconds.append(c)
					
			if "k" in slist2:
				
				for c in k2:
					
					sconds.append(c)
					
			if "a" in slist2:
				
				for c in a2:
					
					sconds.append(c)
					
			if "i" in slist2:
				
				for c in i2:
					
					sconds.append(c)
					
			if "n" in slist2:
				
				for c in n2:
					
					sconds.append(c)
					
	if "3" in slist:
		
		try:
			
			if slist[slist.index("3") + 1] in numstr:
				
				for c in c3:
					
					sconds.append(c)
					
				for c in e3:
					
					sconds.append(c)
					
				for c in k3:
					
					sconds.append(c)
					
				for c in a3:
					
					sconds.append(c)
					
				for c in i3:
					
					sconds.append(c)
					
				for c in n3:
					
					sconds.append(c)
					
				for c in y3:
					
					sconds.append(c)
					
				for c in q3:
					
					sconds.append(c)
					
				for c in j3:
					
					sconds.append(c)
					
				for c in r3:
					
					sconds.append(c)
					
			for n in range(slist.index("3") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist3 = slist[slist.index("3"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist3 = slist[slist.index("3"):n + 1]
					
					break
					
		except IndexError:
			
			slist3 = ["3"]
			
			for c in c3:
				
				sconds.append(c)
				
			for c in e3:
				
				sconds.append(c)
				
			for c in k3:
				
				sconds.append(c)
				
			for c in a3:
				
				sconds.append(c)
				
			for c in i3:
				
				sconds.append(c)
				
			for c in n3:
				
				sconds.append(c)
				
			for c in y3:
				
				sconds.append(c)
				
			for c in q3:
				
				sconds.append(c)
				
			for c in j3:
				
				sconds.append(c)
				
			for c in r3:
				
				sconds.append(c)
				
		if "-" in slist3:
			
			S3Negating = True
			
		else:
			
			S3Negating = False
			
		if S3Negating == True:
			
			if "c" not in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" not in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" not in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" not in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" not in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" not in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" not in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" not in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" not in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" not in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist3:
				
				for c in c3:
					
					sconds.append(c)
					
			if "e" in slist3:
				
				for c in e3:
					
					sconds.append(c)
					
			if "k" in slist3:
				
				for c in k3:
					
					sconds.append(c)
					
			if "a" in slist3:
				
				for c in a3:
					
					sconds.append(c)
					
			if "i" in slist3:
				
				for c in i3:
					
					sconds.append(c)
					
			if "n" in slist3:
				
				for c in n3:
					
					sconds.append(c)
					
			if "y" in slist3:
				
				for c in y3:
					
					sconds.append(c)
					
			if "q" in slist3:
				
				for c in q3:
					
					sconds.append(c)
					
			if "j" in slist3:
				
				for c in j3:
					
					sconds.append(c)
					
			if "r" in slist3:
				
				for c in r3:
					
					sconds.append(c)
					
	if "4" in slist:
		
		try:
			
			if slist[slist.index("4") + 1] in numstr:
				
				for c in c4:
					
					sconds.append(c)
					
				for c in e4:
					
					sconds.append(c)
					
				for c in k4:
					
					sconds.append(c)
					
				for c in a4:
					
					sconds.append(c)
					
				for c in i4:
					
					sconds.append(c)
					
				for c in n4:
					
					sconds.append(c)
					
				for c in y4:
					
					sconds.append(c)
					
				for c in q4:
					
					sconds.append(c)
					
				for c in j4:
					
					sconds.append(c)
					
				for c in r4:
					
					sconds.append(c)
					
				for c in t4:
					
					sconds.append(c)
					
				for c in w4:
					
					sconds.append(c)
					
				for c in z4:
					
					sconds.append(c)
					
			for n in range(slist.index("4") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist4 = slist[slist.index("4"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist4 = slist[slist.index("4"):n + 1]
					
					break
					
		except IndexError:
			
			slist4 = ["4"]
			
			for c in c4:
				
				sconds.append(c)
				
			for c in e4:
				
				sconds.append(c)
				
			for c in k4:
				
				sconds.append(c)
				
			for c in a4:
				
				sconds.append(c)
				
			for c in i4:
				
				sconds.append(c)
				
			for c in n4:
				
				sconds.append(c)
				
			for c in y4:
				
				sconds.append(c)
				
			for c in q4:
				
				sconds.append(c)
				
			for c in j4:
				
				sconds.append(c)
				
			for c in r4:
				
				sconds.append(c)
				
			for c in t4:
				
				sconds.append(c)
				
			for c in w4:
				
				sconds.append(c)
				
			for c in z4:
				
				sconds.append(c)
				
		if "-" in slist4:
			
			S4Negating = True
			
		else:
			
			S4Negating = False
			
		if S4Negating == True:
			
			if "c" not in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" not in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" not in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" not in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" not in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" not in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" not in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" not in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" not in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" not in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" not in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" not in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" not in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist4:
				
				for c in c4:
					
					sconds.append(c)
					
			if "e" in slist4:
				
				for c in e4:
					
					sconds.append(c)
					
			if "k" in slist4:
				
				for c in k4:
					
					sconds.append(c)
					
			if "a" in slist4:
				
				for c in a4:
					
					sconds.append(c)
					
			if "i" in slist4:
				
				for c in i4:
					
					sconds.append(c)
					
			if "n" in slist4:
				
				for c in n4:
					
					sconds.append(c)
					
			if "y" in slist4:
				
				for c in y4:
					
					sconds.append(c)
					
			if "q" in slist4:
				
				for c in q4:
					
					sconds.append(c)
					
			if "j" in slist4:
				
				for c in j4:
					
					sconds.append(c)
					
			if "r" in slist4:
				
				for c in r4:
					
					sconds.append(c)
					
			if "t" in slist4:
				
				for c in t4:
					
					sconds.append(c)
					
			if "w" in slist4:
				
				for c in w4:
					
					sconds.append(c)
					
			if "z" in slist4:
				
				for c in z4:
					
					sconds.append(c)
					
	if "5" in slist:
		
		try:
			
			if slist[slist.index("5") + 1] in numstr:
				
				for c in c5:
					
					sconds.append(c)
					
				for c in e5:
					
					sconds.append(c)
					
				for c in k5:
					
					sconds.append(c)
					
				for c in a5:
					
					sconds.append(c)
					
				for c in i5:
					
					sconds.append(c)
					
				for c in n5:
					
					sconds.append(c)
					
				for c in y5:
					
					sconds.append(c)
					
				for c in q5:
					
					sconds.append(c)
					
				for c in j5:
					
					sconds.append(c)
					
				for c in r5:
					
					sconds.append(c)
					
			for n in range(slist.index("5") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist5 = slist[slist.index("5"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist5 = slist[slist.index("5"):n + 1]
					
					break
					
		except IndexError:
			
			slist5 = ["5"]
				
			for c in c5:
				
				sconds.append(c)
				
			for c in e5:
				
				sconds.append(c)
				
			for c in k5:
				
				sconds.append(c)
				
			for c in a5:
				
				sconds.append(c)
				
			for c in i5:
				
				sconds.append(c)
				
			for c in n5:
				
				sconds.append(c)
				
			for c in y5:
				
				sconds.append(c)
				
			for c in q5:
				
				sconds.append(c)
				
			for c in j5:
				
				sconds.append(c)
				
			for c in r5:
				
				sconds.append(c)
				
		if "-" in slist5:
			
			S5Negating = True
			
		else:
			
			S5Negating = False
			
		if S5Negating == True:
			
			if "c" not in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" not in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" not in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" not in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" not in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" not in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" not in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" not in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" not in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" not in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist5:
				
				for c in c5:
					
					sconds.append(c)
					
			if "e" in slist5:
				
				for c in e5:
					
					sconds.append(c)
					
			if "k" in slist5:
				
				for c in k5:
					
					sconds.append(c)
					
			if "a" in slist5:
				
				for c in a5:
					
					sconds.append(c)
					
			if "i" in slist5:
				
				for c in i5:
					
					sconds.append(c)
					
			if "n" in slist5:
				
				for c in n5:
					
					sconds.append(c)
					
			if "y" in slist5:
				
				for c in y5:
					
					sconds.append(c)
					
			if "q" in slist5:
				
				for c in q5:
					
					sconds.append(c)
					
			if "j" in slist5:
				
				for c in j5:
					
					sconds.append(c)
					
			if "r" in slist5:
				
				for c in r5:
					
					sconds.append(c)
					
	if "6" in slist:
		
		try:
			
			if slist[slist.index("6") + 1] in numstr:
				
				for c in c6:
					
					sconds.append(c)
					
				for c in e6:
					
					sconds.append(c)
					
				for c in k6:
					
					sconds.append(c)
					
				for c in a6:
					
					sconds.append(c)
					
				for c in i6:
					
					sconds.append(c)
					
				for c in n6:
					
					sconds.append(c)
					
			for n in range(slist.index("6") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist6 = slist[slist.index("6"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist6 = slist[slist.index("6"):n + 1]
					
					break
					
		except IndexError:
			
			slist6 = ["6"]
				
			for c in c6:
				
				sconds.append(c)
				
			for c in e6:
				
				sconds.append(c)
				
			for c in k6:
				
				sconds.append(c)
				
			for c in a6:
				
				sconds.append(c)
				
			for c in i6:
				
				sconds.append(c)
				
			for c in n6:
				
				sconds.append(c)
				
		if "-" in slist6:
			
			S6Negating = True
			
		else:
			
			S6Negating = False
			
		if S6Negating == True:
			
			if "c" not in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" not in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" not in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" not in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" not in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" not in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist6:
				
				for c in c6:
					
					sconds.append(c)
					
			if "e" in slist6:
				
				for c in e6:
					
					sconds.append(c)
					
			if "k" in slist6:
				
				for c in k6:
					
					sconds.append(c)
					
			if "a" in slist6:
				
				for c in a6:
					
					sconds.append(c)
					
			if "i" in slist6:
				
				for c in i6:
					
					sconds.append(c)
					
			if "n" in slist6:
				
				for c in n6:
					
					sconds.append(c)
					
	if "7" in slist:
		
		try:
			
			if slist[slist.index("7") + 1] in numstr:
				
				for c in c7:
					
					sconds.append(c)
					
				for c in e7:
					
					sconds.append(c)
					
			for n in range(slist.index("7") + 1,len(slist)):
				
				if slist[n] in numstr:
					
					slist7 = slist[slist.index("7"):n]
					
					break
					
				if n == len(slist) - 1:
					
					slist7 = slist[slist.index("7"):n + 1]
					
					break
					
		except IndexError:
			
			slist7 = ["7"]
				
			for c in c7:
				
				sconds.append(c)
				
			for c in e7:
				
				sconds.append(c)
				
		if "-" in slist7:
			
			S7Negating = True
			
		else:
			
			S7Negating = False
			
		if S7Negating == True:
			
			if "c" not in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" not in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
		else:
			
			if "c" in slist7:
				
				for c in c7:
					
					sconds.append(c)
					
			if "e" in slist7:
				
				for c in e7:
					
					sconds.append(c)
					
	if "8" in slist:
		
		for c in x8:
			
			sconds.append(c)
			
	l = [bconds,sconds]
	
	return(l)
	
conditions = rparse(rule)

for y in range(0, 200):
	
	world.append([0] * 200)
	
def makeworld(rle, pos): # Assists in the conversion of an RLE to a matrix
	
	global world
	
	rlel = list(rle)
	
	digits = "0123456789"
	
	y = pos[0] if pos[0] != -1 else 0
	
	x = pos[1] if pos[1] != -1 else 0
	
	num = 0
	
	for char in rlel:
		
		if char in digits:
			
			num = num * 10 + int(char)
			
		else:
			
			if char == "b":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					world[y][x] = 0
					
					x += 1
					
			if char == "o":
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					world[y][x] = 1
					
					x += 1
					
			if char == "$":
				
				x = pos[1]
				
				if num == 0:
					
					num2 = 1
					
				else:
					
					num2 = num
					
				for n in range(0, num2):
					
					y += 1
					
			num = 0
			
	return world
	
def makerle(mat, selection): # Does the opposite of the previous function
	
	rlel = []
	
	num = 1
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, ydir):
			
			cell = mat[y][x]
			
			if cell == 0:
				
				rlel.append("b")
				
			else:
				
				rlel.append("o")
				
		rlel.append("$")
		
	rlel[len(rlel) - 1] = "!"
	
	listinit = rlel
		
	rle = "".join(listinit)
	
	return(rle)

rle = input("RLE (must be headerless, may be empty): ")

world = makeworld(rle, [0, 0])

pygame.init()

screen = pygame.display.set_mode((1000, 1000))

rectworld = []

for y in range(0, 200):
	
	rectworld.append([])
	
	for x in range(0, 200):
		
		rectworld[-1].append(pygame.Rect(x * 5, y * 5, 5, 5))
		
clock = pygame.time.Clock()

step = 0

running = True

dt = 0

def advance(world):
	
	global color
	
	global conditions
	
	# neigh = [[1, 1], [1, 0], [1, -1], [0, 1], [0, -1], [-1, 1], [-1, 0], [-1, -1]]
	
	neigh = [[1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1], [0, 1], [1, 1]]
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			neighs = 0
			
			neighlist = []
			
			for n in range(0, 8):
				
				newx = x + neigh[n][1]
				
				newy = y + neigh[n][0]
				
				if newx == 200:
					
					newx = 199
					
				if newx == -1:
					
					newx = 0
					
				if newy == 200:
					
					newy = 199
					
				if newy == -1:
					
					newy = 0
					
				if (world[newy][newx] != 0):
					
					neighlist.append("1")
					
					neighs += 1
					
				else:
					
					neighlist.append("0")
					
					
			neighstr = "".join(neighlist)
			
			if world[y][x] == 0 and (neighstr in conditions[0]):
				
				if not color:
					
					world[y][x] = 1
					
				else:
					
					world[y][x] = neighs + 1
					
				continue
				
			if world[y][x] != 0 and (neighstr not in conditions[1]):
				
				world[y][x] = 0
				
				continue
				
			if world[y][x] != 0 and (neighstr in conditions[1]):
				
				if color:
					
					world[y][x] = neighs + 1
					
				else:
					
					if world[y][x] != 1:
						
						world[y][x] = 1
						
	return world
	
def show(world):
	
	for y in range(0, 200):
		
		for x in range(0, 200):
			
			if world[y][x] != 0:
				
				if not color:
					
					pygame.draw.rect(screen, "white", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, colors[world[y][x]], rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
				
				if world[y][x] == 3:
					
					pygame.draw.rect(screen, "blue", rectworld[y][x])
					
				else:
					
					pygame.draw.rect(screen, "red", rectworld[y][x])
					
			if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
				
				pygame.draw.rect(screen, "maroon", rectworld[y][x])
				
			if (selection[0][0] <= y < selection[1][0] and selection[0][1] <= x < selection[1][1]) or (selection[0][0] >= y > selection[1][0] and selection[0][1] >= x > selection[1][1]) or (selection[0][0] >= y > selection[1][0] and selection[0][1] <= x < selection[1][1]) or (selection[0][0] <= y < selection[1][0] and selection[0][1] >= x > selection[1][1]):
					
				if world[y][x] != 0:
					
					pygame.draw.rect(screen, (128, 192, 128), rectworld[y][x])
					
				if world[y][x] == 0:
					
					pygame.draw.rect(screen, (0, 128, 0), rectworld[y][x])
					
				if y == cursorpos[0] and x == cursorpos[1] and world[y][x] == 0:
					
					pygame.draw.rect(screen, (64, 64, 0), rectworld[y][x])
					
				if y == cursorpos[0] and x == cursorpos[1] and world[y][x] != 0:
					
					pygame.draw.rect(screen, (128, 64, 0), rectworld[y][x])
					
def randfill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = random.randint(0, 1)
			
	return world
	
def zerofill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = 0
			
	return world
	
def invfill(selection):
	
	global world
	
	if selection[0] == selection[1]:
		
		xstart = 0
		
		xend = 200
		
		ystart = 0
		
		yend = 200
		
	else:
		
		xstart = selection[0][1]
		
		xend = selection[1][1]
		
		ystart = selection[0][0]
		
		yend = selection[1][0]
	
	xdir = 1 if xstart < xend else -1
	
	ydir = 1 if ystart < yend else -1
	
	for y in range(ystart, yend, ydir):
		
		for x in range(xstart, xend, xdir):
			
			world[y][x] = 0 if world[y][x] != 0 else 1
			
	return world
	
keysheld = []

while running:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			running = False
		if event.type == pygame.KEYDOWN:
			keysheld.append(event.key)
			if event.key == pygame.K_k:
				if color:
					color = False
				else:
					color = True
			if event.key == pygame.K_q:
				running = False
			if event.key == pygame.K_r:
				world = randfill(selection)
			if event.key == pygame.K_i:
				world = invfill(selection)
			if event.key == pygame.K_c:
				print(makerle(world, selection))
				buffer = makerle(world, selection)
				if selection[0] == selection[1]:
					fullcopy = True
				else:
					fullcopy = False
			if event.key == pygame.K_x:
				print(makerle(world, selection))
				buffer = makerle(world, selection)
				world = zerofill(selection)
				if selection[0] == selection[1]:
					fullcopy = True
				else:
					fullcopy = False
			if event.key == pygame.K_v:
				if fullcopy:
					world = zerofill([[100, 100], [100, 100]])
					world = makeworld(buffer, [-1, -1])
				else:
					world = makeworld(buffer, cursorpos)
			if event.key == pygame.K_t:
				rule = input("Rule: ")
				conditions = rparse(rule)
			if event.key == pygame.K_EQUALS:
				world = advance(world)
			if event.key == pygame.K_UP:
				cursorpos[0] -= 1
				cursorpos[0] %= 200
				if selectphase == 1:
					selection[1][0] -= 1
					selection[1][0] %= 200
			if event.key == pygame.K_DOWN:
				cursorpos[0] += 1
				cursorpos[0] %= 200
				if selectphase == 1:
					selection[1][0] += 1
					selection[1][0] %= 200
			if event.key == pygame.K_LEFT:
				cursorpos[1] -= 1
				cursorpos[1] %= 200
				if selectphase == 1:
					selection[1][1] -= 1
					selection[1][1] %= 200
			if event.key == pygame.K_RIGHT:
				cursorpos[1] += 1
				cursorpos[1] %= 200
				if selectphase == 1:
					selection[1][1] += 1
					selection[1][1] %= 200
			if event.key == pygame.K_RETURN:
				world[cursorpos[0]][cursorpos[1]] += 1
				world[cursorpos[0]][cursorpos[1]] %= 2
			if event.key == pygame.K_LSHIFT or event.key == pygame.K_RSHIFT:
				if selectphase == 0:
					selection[0][0] = cursorpos[0]
					selection[0][1] = cursorpos[1]
					selection[1][0] = cursorpos[0]
					selection[1][1] = cursorpos[1]
					selectphase = 1
				else:
					selection[1][0] = cursorpos[0]
					selection[1][1] = cursorpos[1]
					selectphase = 0
			if event.key == pygame.K_8:
				selection = [[100, 100], [100, 100]]
				selectphase = 0
			if event.key == pygame.K_BACKSPACE:
				world = zerofill(selection)
				
			if (pygame.K_LSHIFT in keysheld or pygame.K_RSHIFT in keysheld) and pygame.K_s in keysheld:
				path = input("Path to save pattern: ")
				with open(path, "w") as file:
					newrule = rule
					if rule == "":
						newrule = "B3/S23"
					file.write(f"x = 0, y = 0, rule = {newrule}\n")
					file.write(makerle(world, [[0, 0], [0, 0]]))
				
		elif event.type == pygame.KEYUP:
			keysheld.remove(event.key)
		
		left, middle, right = pygame.mouse.get_pressed()
		
		x, y = pygame.mouse.get_pos()
		
		if left:
			
			xx = x // 5
			
			yy = y // 5
			
			world[yy][xx] = 1
			
			cursorpos = [yy, xx]
			
		if right:
			
			xx = x // 5
			
			yy = y // 5
			
			world[yy][xx] = 0
			
			cursorpos = [yy, xx]
			
		keys = pygame.key.get_pressed()
		
		if keys[pygame.K_SPACE]:
			world = advance(world)
		if keys[pygame.K_w]:
			cursorpos[0] -= 1
			cursorpos[0] %= 200
			if selectphase == 1:
				selection[1][0] -= 1
				selection[1][0] %= 200
		if keys[pygame.K_s]:
			cursorpos[0] += 1
			cursorpos[0] %= 200
			if selectphase == 1:
				selection[1][0] += 1
				selection[1][0] %= 200
		if keys[pygame.K_a]:
			cursorpos[1] -= 1
			cursorpos[1] %= 200
			if selectphase == 1:
				selection[1][1] -= 1
				selection[1][1] %= 200
		if keys[pygame.K_d]:
			cursorpos[1] += 1
			cursorpos[1] %= 200
			if selectphase == 1:
				selection[1][1] += 1
				selection[1][1] %= 200

		
	screen.fill("black")
	
	show(world)
	
	pygame.display.flip()
	
	dt = clock.tick(60) / 1000
	
pygame.quit()
Improvements:

- Fixed multiple pasting bugs

Once again, I encourage everyone to optimize my code, especially the rule parsing algorithm. Post all optimized versions of the code here.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

NaiViewer version 2.-1 is out (Note that this version is written in C and requires Raylib):

Code: Select all

#include <raylib.h>

#include <time.h>

#include <stdlib.h>

#include <stdio.h>

#include <ctype.h>

void rparse(int (* bconds)[9], int (* sconds)[9]) {
	
	printf("Rule: ");
	
	char c = getchar();
	
	while ((c != '/')) {
		
		if (isdigit(c)) {
			
			(*bconds)[c - '0'] = 1;
			
		}
		
		if (c == '\n') {
			
			(*bconds)[3] = 1;
			
			(*sconds)[2] = 1;
			
			(*sconds)[3] = 1;
			
			return;
			
		}
		
		c = getchar();
		
	}
	
	while (c != '\n') {
		
		if (isdigit(c)) {
			
			(*sconds)[c - '0'] = 1;
			
		}
		
		c = getchar();
		
	}
	
}

void advance(int (* world)[200][200], int bconds[9], int sconds[9], int colorized) {
	
	int neigh[8][2] = {{1, 1}, {1, 0}, {1, -1}, {0, 1}, {0, -1}, {-1, 1}, {-1, 0}, {-1, -1}};
	
	for (int y = 0; y < 200; y++) {
		
		for (int x = 0; x < 200; x++) {
			
			int count = 0;
			
			for (int n = 0; n < 8; n++) {
				
				int augx = x + neigh[n][1];
				
				int augy = y + neigh[n][0];
				
				if ((augx >= 200) || (augy >= 200) || (augx < 0) || (augy < 0)) {
					
					continue;
					
				}
				
				if ((*world)[y + neigh[n][0]][x + neigh[n][1]]) {
					
					count++;
					
				}
				
			}
			
			if ((*world)[y][x] && !sconds[count]) {
				
				(*world)[y][x] = 0;
				
				continue;
				
			}
			
			if (!(*world)[y][x] && bconds[count]) {
				
				if (colorized) {
					
					(*world)[y][x] = count + 1;
					
				} else {
					
					(*world)[y][x] = 1;
					
				}
				
				continue;
				
			}
			
			if ((*world)[y][x] && sconds[count]) {
				
				if (colorized) {
					
					(*world)[y][x] = count + 1;
					
				} else {
					
					(*world)[y][x] = 1;
					
				}
				
				continue;
				
			}
			
		}
		
	}
	
}

void show(int world[200][200], int cursorpos[2], int colorized) {
	
	Color cursor = {255, 0, 0, 128};
	
	Color colors[10] = {BLACK, GRAY, WHITE, RED, GREEN, BLUE, ORANGE, PURPLE, YELLOW, PINK};
	
	for (int y = 0; y < 200; y++) {
		
		for (int x = 0; x < 200; x++) {
			
			if (world[y][x]) {
				
				if (colorized) {
					
					DrawRectangle(x * 5, y * 5, 5, 5, colors[world[y][x]]);
					
				} else {
					
					DrawRectangle(x * 5, y * 5, 5, 5, WHITE);
					
				}
				
			}
			
			if ((cursorpos[0] == y) && (cursorpos[1] == x)) {
				
				DrawRectangle(x * 5, y * 5, 5, 5, cursor);
				
			}
			
		}
		
	}
	
}

int main(void) {
	
	int world[200][200] = {0};
	
	int cursorpos[2] = {100, 100};
	
	int bconds[9] = {0};
	
	int sconds[9] = {0};
	
	int colorized = 0;
	
	srand(time(NULL));
	
	rparse(&bconds, &sconds);
	
	InitWindow(1000, 1000, "NaiViewer");
	
	while (!WindowShouldClose()) {
		
		int x = GetMouseX() / 5;
		
		int y = GetMouseY() / 5;
		
		if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
			
			world[y][x] = 1;
			
			cursorpos[0] = y;
			
			cursorpos[1] = x;
			
		}
		
		if (IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) {
			
			world[y][x] = 0;
			
			cursorpos[0] = y;
			
			cursorpos[1] = x;
			
		}
		
		if (IsKeyPressed(KEY_ENTER)) {
			
			world[cursorpos[0]][cursorpos[1]]++;
			
			world[cursorpos[0]][cursorpos[1]] %= 2;
			
		}
		
		if (IsKeyPressed(KEY_BACKSPACE)) {
			
			for (int y = 0; y < 200; y++) {
				
				for (int x = 0; x < 200; x++) {
					
					world[y][x] = 0;
					
				}
				
			}
			
		}
		
		if (IsKeyPressed(KEY_EQUAL)) advance(&world, bconds, sconds, colorized);
		
		if (IsKeyPressed(KEY_UP)) cursorpos[0]--;
		
		if (IsKeyPressed(KEY_DOWN)) cursorpos[0]++;
		
		if (IsKeyPressed(KEY_LEFT)) cursorpos[1]--;
		
		if (IsKeyPressed(KEY_RIGHT)) cursorpos[1]++;
		
		if (IsKeyPressed(KEY_K)) colorized++;
		
		if (IsKeyPressed(KEY_Q)) break;
		
		if (IsKeyPressed(KEY_R)) {
			
			for (int y = 0; y < 200; y++) {
				
				for (int x = 0; x < 200; x++) {
					
					world[y][x] = rand() % 2;
					
				}
				
			}
			
		}
		
		cursorpos[0] %= 200;
		
		cursorpos[1] %= 200;
		
		colorized %= 2;
		
		if (IsKeyDown(KEY_SPACE)) advance(&world, bconds, sconds, colorized);
		
		if (IsKeyDown(KEY_W)) cursorpos[0]--;
		
		if (IsKeyDown(KEY_A)) cursorpos[1]--;
		
		if (IsKeyDown(KEY_S)) cursorpos[0]++;
		
		if (IsKeyDown(KEY_D)) cursorpos[1]++;
		
		BeginDrawing();
		
		ClearBackground(BLACK);
		
		show(world, cursorpos, colorized);
		
		EndDrawing();
		
	}
	
	CloseWindow();
	
	return 0;
	
}
Compile with:

Code: Select all

cc naiviewer.c -o naiviewer $(pkg-config --cflags --libs raylib)
Improvements:

- Hundreds of times faster than NaiViewer 1

- Smoother drawing experience

Caveats:

- Doesn't support INT CA yet.

- No selections, copying, pasting, or saving.

Feel free to post improvements and patterns made using my code here.
Last edited by MDA on July 4th, 2026, 11:53 am, edited 1 time in total.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
I6_I6
Posts: 999
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by I6_I6 »

I don't know C (though I might want to learn it). I could put NaiViewer on GitHub, if you'd like.

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

I6_I6 wrote: July 4th, 2026, 10:28 am […] I could put NaiViewer on GitHub, if you'd like.
Not yet. I want to put it on GitHub myself, but only once the new version gains all the features from version 1.
I6_I6 wrote: July 4th, 2026, 10:28 am I don't know C (though I might want to learn it). […]
Also, keep in mind that you haven’t been the only person contributing (or at least attempting to contribute) to the evolution of this project. Because of this, someone else who, like me, knows how to code in C could very well contribute even if you can’t.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
User avatar
MDA
Posts: 232
Joined: June 8th, 2026, 12:18 pm
Location: In Haven (B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-ak)
Contact:

Re: NaiViewer - a program for simulating outer-totalistic naiverules

Post by MDA »

Version 2.-1a of NaiViewer is out:
NaiViewer.zip
This is the first version of NaiViewer which requires a zip file.
(4.16 KiB) Downloaded 2 times
Compile with

Code: Select all

cc naiviewer.c -o naiviewer $(pkg-config --cflags --libs raylib)
Improvements:

- Complete INT rule support (hence the header file, which is just a 256-element INT lookup dictionary)

There are still many features from the first version to be added, but this is a good start.

Edit (July 4th, 2026, 10:14 PM): Retracted a false statement regarding improvements made to NaiViewer.
My website (a database of Life objects, WIP).
GlidINT has been released!

Code: Select all

x = 5, y = 17, rule = B3-ry4acenqt5eir6-ek/S2-a3-a4nq5aeknr6-akHistory
C$2C$.2C$2C11$.3D$3.D$2.3D!
[[ STOP 72 ]]
Post Reply