## #StackBounty: #code-challenge #sequence #geometry #polyomino Counting generalized polyominoes

### Bounty: 100

This challenge will have you count pseudo-polyforms on the snub square tiling.

I think that this sequence does not yet exist on the OEIS, so this challenge exists to compute as many terms as possible for this sequence.

# Definitions

The snub square tiling is a semiregular tiling of the plane that consists of equilateral triangles and squares.

A pseudo-polyform on the snub square tiling is a plane figure constructed by joining together these triangles and squares along their shared sides, analogous to a polyomino. Here is an example of a six-cell and an eight-cell pseudo-polyform:

# Examples

For `n = 1` there are two 1-cell pseudo-polyforms, namely the square and the triangle:

For `n = 2` there are two 2-cell pseudo-polyforms, namely a square with a triangle and two triangles.

For `n = 3` there are four 3-cell pseudo-polyforms.

# Challenge

The goal of this challenge is to compute as many terms as possible in this sequence, which begins `2, 2, 4, ...` and where the n-th term is the number of n-cell pseudo-polyforms up to rotation and reflection.

Run your code for as long as you’d like. The winner of this challenge will be the user who posts the most terms of the sequence, along with their code. If two users post the same number of terms, then whoever posts their last term earliest wins.

(Once there are enough known terms to prove that this sequence does not already exist in the OEIS, I’ll create an entry in the OEIS and list the contributor as a co-author if he or she desires.)

Get this bounty!!!

## #StackBounty: #python #sequence #difflib Python sequence matcher with custom matching function

### Bounty: 100

I have two lists and I want to find the matching elements using python difflib/sequence matcher, and it goes like this:

``````from difflib import SequenceMatcher
def match_seq(list1,list2):
output=[]
s = SequenceMatcher(None, list1, list2)
blocks=s.get_matching_blocks()
for bl in blocks:
#print(bl, bl.a, bl.b, bl.size)
for bi in range(bl.size):
cur_a=bl.a+bi
cur_b=bl.b+bi
output.append((cur_a,cur_b))
return output
``````

so when I run it on two lists like this

``````list1=["orange","apple","lemons","grapes"]
list2=["pears", "orange","apple", "lemons", "cherry", "grapes"]
for a,b in match_seq(list1,list2):
print(a,b, list1[a],list2[b])
``````

I get this output:

``````(0, 1, 'orange', 'orange')
(1, 2, 'apple', 'apple')
(2, 3, 'lemons', 'lemons')
(3, 5, 'grapes', 'grapes')
``````

but suppose that I do not want to match the identical items only, but rather use a matching function (for example, a function that can match orange to oranges or vice versa, or match the equivalent word in another language).

``````list3=["orange","apple","lemons","grape"]
list4=["pears", "oranges","apple", "lemon", "cherry", "grapes"]
list5=["peras", "naranjas", "manzana", "limón", "cereza", "uvas"]
``````

Is there any option in difflib/sequence matcher, or any other python built-in library, that can provide this, so that I can match list3 and list 4, and also list3 and list5, the same way I did for list 1 and list2?

In general, can you think of a solution for this? I thought of replacing each word in the target list with the possible equivalents that I want to match, but this can be problematic because I may need to have multiple equivalents for each word, which may disturb the sequence.

Get this bounty!!!

## Reset Sequence in Oracle SQL back to 0

Some times we need to reset the sequence values in the database back to 0.
Here is a small procedure to reset any sequence.

```create or replace
procedure reset_sequence(p_seq in varchar2)
is
l_value number;
begin
-- Select the next value of the sequence

execute immediate
'select ' || p_seq ||
'.nextval from dual' INTO l_value;

-- Set a negative increment for the sequence,
-- with value = the current value of the sequence

execute immediate
'alter sequence ' || p_seq ||
' increment by -' || l_value || ' minvalue 0';

-- Select once from the sequence, to
-- take its current value back to 0

execute immediate
'select ' || p_seq ||
'.nextval from dual' INTO l_value;

-- Set the increment back to 1

execute immediate
'alter sequence ' || p_seq ||
' increment by 1 minvalue 0';
end;
/
```

Whatever sequence you wish to reset, call the procedure as:

```begin
reset_sequence('SEQ_1');
reset_sequence('SEQ_2');
reset_sequence('SEQ_3');
reset_sequence('SEQ_4');
end;
/
```