Skip to main content
edited body
Source Link
Lukas Rotter
  • 13.6k
  • 1
  • 58
  • 112
public static void Main(string[] args)
{
    var words = File.ReadAllLines("C:\\pse\\yawl-master\\yawl-master\\yawl-0.3.2.03\\word.list")
                    .Where(w => w.Length == 7 && new HashSet<char>(w).Count >= 5)
                    .Select<string, (string word, int mask)>(w => new(w, CreateBitmask(w)))
                    .ToArray();

    int targetMask = (1 << 26) - 1;

    int mj, mk, m;

    for (int i = 0; i < words.Length - 3; i++)
    {
        if (i % 1000 == 0)
        {
            Console.WriteLine(i);
        }

        for (int j = i + 1; j < words.Length - 2; j++)
        {
            mj = words[i].mask | words[j].mask;
            if (BitsSet(mj) < 12)
            {
                continue;
            }
            for (int k = j + 1; k < words.Length - 1; k++)
            {
                mk = mj | words[k].mask;
                if (BitsSet(mk) < 19)
                {
                    continue;
                }
                for (int l = k + 1; l < words.Length; l++)
                {
                    m = mk | words[l].mask;
                    if (m == targetMask)
                    {
                        Console.WriteLine($"{words[i].word} {words[j].word} {words[k].word} {words[l].word}");
                    }
                }
            }
        }
    }
}

// hamming weight
static int CreateBitmask(string word)
{
    int bitmask = 0;
    foreach (char c in word)
    {
        bitmask |= 1 << (c - 'a');
    }
    return bitmask;
} 

// hamming weight
static int BitsSet(int i)
{
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
public static void Main(string[] args)
{
    var words = File.ReadAllLines("C:\\pse\\yawl-master\\yawl-master\\yawl-0.3.2.03\\word.list")
                    .Where(w => w.Length == 7 && new HashSet<char>(w).Count >= 5)
                    .Select<string, (string word, int mask)>(w => new(w, CreateBitmask(w)))
                    .ToArray();

    int targetMask = (1 << 26) - 1;

    int mj, mk, m;

    for (int i = 0; i < words.Length - 3; i++)
    {
        if (i % 1000 == 0)
        {
            Console.WriteLine(i);
        }

        for (int j = i + 1; j < words.Length - 2; j++)
        {
            mj = words[i].mask | words[j].mask;
            if (BitsSet(mj) < 12)
            {
                continue;
            }
            for (int k = j + 1; k < words.Length - 1; k++)
            {
                mk = mj | words[k].mask;
                if (BitsSet(mk) < 19)
                {
                    continue;
                }
                for (int l = k + 1; l < words.Length; l++)
                {
                    m = mk | words[l].mask;
                    if (m == targetMask)
                    {
                        Console.WriteLine($"{words[i].word} {words[j].word} {words[k].word} {words[l].word}");
                    }
                }
            }
        }
    }
}

// hamming weight
static int CreateBitmask(string word)
{
    int bitmask = 0;
    foreach (char c in word)
    {
        bitmask |= 1 << (c - 'a');
    }
    return bitmask;
}

static int BitsSet(int i)
{
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
public static void Main(string[] args)
{
    var words = File.ReadAllLines("C:\\pse\\yawl-master\\yawl-master\\yawl-0.3.2.03\\word.list")
                    .Where(w => w.Length == 7 && new HashSet<char>(w).Count >= 5)
                    .Select<string, (string word, int mask)>(w => new(w, CreateBitmask(w)))
                    .ToArray();

    int targetMask = (1 << 26) - 1;

    int mj, mk, m;

    for (int i = 0; i < words.Length - 3; i++)
    {
        if (i % 1000 == 0)
        {
            Console.WriteLine(i);
        }

        for (int j = i + 1; j < words.Length - 2; j++)
        {
            mj = words[i].mask | words[j].mask;
            if (BitsSet(mj) < 12)
            {
                continue;
            }
            for (int k = j + 1; k < words.Length - 1; k++)
            {
                mk = mj | words[k].mask;
                if (BitsSet(mk) < 19)
                {
                    continue;
                }
                for (int l = k + 1; l < words.Length; l++)
                {
                    m = mk | words[l].mask;
                    if (m == targetMask)
                    {
                        Console.WriteLine($"{words[i].word} {words[j].word} {words[k].word} {words[l].word}");
                    }
                }
            }
        }
    }
}

static int CreateBitmask(string word)
{
    int bitmask = 0;
    foreach (char c in word)
    {
        bitmask |= 1 << (c - 'a');
    }
    return bitmask;
} 

// hamming weight
static int BitsSet(int i)
{
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
added 10 characters in body
Source Link
Lukas Rotter
  • 13.6k
  • 1
  • 58
  • 112
public static void Main(string[] args)
{
    var words = File.ReadAllLines("C:\\pse\\yawl-master\\yawl-master\\yawl-0.3.2.03\\word.list")
                    .Where(w => w.Length == 7 && new HashSet<char>(w).Count >= 5)
                    .Select<string, (string word, int mask)>(w => new(w, CreateBitmask(w)))
                    .ToArray();

    int targetMask = (1 << 26) - 1;

    int mj, mk, m;

    for (int i = 0; i < words.Length - 3; i++)
    {
        if (i % 1000 == 0)
        {
            Console.WriteLine(i);
        }

        for (int j = i + 1; j < words.Length - 2; j++)
        {
            ifmj (BitsSet(= words[i].mask | words[j].maskmask;
            if (BitsSet(mj) < 12)
            {
                continue;
            }
            for (int k = j + 1; k < words.Length - 1; k++)
            {
                if (BitsSet(words[i].maskmk |= words[j].maskmj | words[k].maskmask;
                if (BitsSet(mk) < 19)
                {
                    continue;
                }
                for (int l = k + 1; l < words.Length; l++)
                {
                    int m = words[i].mask | words[j].mask | words[k].maskmk | words[l].mask;
                    if (m == targetMask)
                    {
                        Console.WriteLine($"{words[i].word} {words[j].word} {words[k].word} {words[l].word}");
                    }
                }
            }
        }
    }
}

// hamming weight
static int CreateBitmask(string word)
{
    int bitmask = 0;
    foreach (char c in word)
    {
        bitmask |= 1 << (c - 'a');
    }
    return bitmask;
}
 
// hamming weight
static int BitsSet(int i)
{
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
public static void Main(string[] args)
{
    var words = File.ReadAllLines("C:\\pse\\yawl-master\\yawl-master\\yawl-0.3.2.03\\word.list")
                    .Where(w => w.Length == 7 && new HashSet<char>(w).Count >= 5)
                    .Select<string, (string word, int mask)>(w => new(w, CreateBitmask(w)))
                    .ToArray();

    int targetMask = (1 << 26) - 1;

    for (int i = 0; i < words.Length - 3; i++)
    {
        if (i % 1000 == 0)
        {
            Console.WriteLine(i);
        }

        for (int j = i + 1; j < words.Length - 2; j++)
        {
            if (BitsSet(words[i].mask | words[j].mask) < 12)
            {
                continue;
            }
            for (int k = j + 1; k < words.Length - 1; k++)
            {
                if (BitsSet(words[i].mask | words[j].mask | words[k].mask) < 19)
                {
                    continue;
                }
                for (int l = k + 1; l < words.Length; l++)
                {
                    int m = words[i].mask | words[j].mask | words[k].mask | words[l].mask;
                    if (m == targetMask)
                    {
                        Console.WriteLine($"{words[i].word} {words[j].word} {words[k].word} {words[l].word}");
                    }
                }
            }
        }
    }
}

static int CreateBitmask(string word)
{
    int bitmask = 0;
    foreach (char c in word)
    {
        bitmask |= 1 << (c - 'a');
    }
    return bitmask;
}
 
// hamming weight
static int BitsSet(int i)
{
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
public static void Main(string[] args)
{
    var words = File.ReadAllLines("C:\\pse\\yawl-master\\yawl-master\\yawl-0.3.2.03\\word.list")
                    .Where(w => w.Length == 7 && new HashSet<char>(w).Count >= 5)
                    .Select<string, (string word, int mask)>(w => new(w, CreateBitmask(w)))
                    .ToArray();

    int targetMask = (1 << 26) - 1;

    int mj, mk, m;

    for (int i = 0; i < words.Length - 3; i++)
    {
        if (i % 1000 == 0)
        {
            Console.WriteLine(i);
        }

        for (int j = i + 1; j < words.Length - 2; j++)
        {
            mj = words[i].mask | words[j].mask;
            if (BitsSet(mj) < 12)
            {
                continue;
            }
            for (int k = j + 1; k < words.Length - 1; k++)
            {
                mk = mj | words[k].mask;
                if (BitsSet(mk) < 19)
                {
                    continue;
                }
                for (int l = k + 1; l < words.Length; l++)
                {
                    m = mk | words[l].mask;
                    if (m == targetMask)
                    {
                        Console.WriteLine($"{words[i].word} {words[j].word} {words[k].word} {words[l].word}");
                    }
                }
            }
        }
    }
}

// hamming weight
static int CreateBitmask(string word)
{
    int bitmask = 0;
    foreach (char c in word)
    {
        bitmask |= 1 << (c - 'a');
    }
    return bitmask;
}

static int BitsSet(int i)
{
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
Source Link
Lukas Rotter
  • 13.6k
  • 1
  • 58
  • 112

Unfortunately there are none that employ all 26 letters.

public static void Main(string[] args)
{
    var words = File.ReadAllLines("C:\\pse\\yawl-master\\yawl-master\\yawl-0.3.2.03\\word.list")
                    .Where(w => w.Length == 7 && new HashSet<char>(w).Count >= 5)
                    .Select<string, (string word, int mask)>(w => new(w, CreateBitmask(w)))
                    .ToArray();

    int targetMask = (1 << 26) - 1;

    for (int i = 0; i < words.Length - 3; i++)
    {
        if (i % 1000 == 0)
        {
            Console.WriteLine(i);
        }

        for (int j = i + 1; j < words.Length - 2; j++)
        {
            if (BitsSet(words[i].mask | words[j].mask) < 12)
            {
                continue;
            }
            for (int k = j + 1; k < words.Length - 1; k++)
            {
                if (BitsSet(words[i].mask | words[j].mask | words[k].mask) < 19)
                {
                    continue;
                }
                for (int l = k + 1; l < words.Length; l++)
                {
                    int m = words[i].mask | words[j].mask | words[k].mask | words[l].mask;
                    if (m == targetMask)
                    {
                        Console.WriteLine($"{words[i].word} {words[j].word} {words[k].word} {words[l].word}");
                    }
                }
            }
        }
    }
}

static int CreateBitmask(string word)
{
    int bitmask = 0;
    foreach (char c in word)
    {
        bitmask |= 1 << (c - 'a');
    }
    return bitmask;
}

// hamming weight
static int BitsSet(int i)
{
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}