Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Munchor

Pages: 1 ... 30 31 [32] 33 34 ... 424
466
Math and Science / Re: Loop all possible words algorithm
« on: August 02, 2011, 12:52:55 pm »
Code: [Select]
#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <fstream>
 
using namespace std;
 
int main()
{
  string all_chars_string = "abcdefghijklmnopqrstuvwxyz";
  vector<string> all_chars;

  int i;
  for (i=0; i<all_chars_string.length(); i++)
  {
    all_chars.push_back( all_chars_string.substr(i, 1) );
  }

  /* Write words to the file */
  ofstream myfile;
  myfile.open ("words.txt");
  for (i=0; i<all_chars_string.length(); i++)
  {
    while ( next_permutation(all_chars.begin(), ( all_chars.end() - (all_chars_string.length()-i) ) ) )
    {
      copy(all_chars.begin(), ( all_chars.end() -(all_chars_string.length()-i) ) , ostream_iterator<string>(myfile,""));
      myfile << "\n";
      cout << endl;
    }
  }
  myfile.close();
  return 0;
}

This is not quite it, but it's pretty good, in a few seconds it generated a 500000 lines of words, what it does is:

All possible words with A
All possible words with A, B
All possible words with A, B, C
All possible words with A, B, C, D

Do you have any idea of how to change it to make all possible words*?

467
Math and Science / Re: Loop all possible words algorithm
« on: August 02, 2011, 11:57:36 am »
The string length shouldn't be increasing that quickly. You should be getting a, b, c, d, ..., x, y, z, aa, ab, ac, ad, ..., zx, zy, zz, aab, etc...

I know, hence I'm asking for help, I don't quite see how to make it, I don't even need code, just thoughts :)

468
Math and Science / Re: Loop all possible words algorithm
« on: August 02, 2011, 11:54:10 am »
Code: [Select]
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  int N = 200;
  int *A = malloc (sizeof (int) * N);
  char c;
  int i;

  while (1)
  {
    A[i] = (A[i]+1)%(26+61);
  }

  return 0;
}

This gives segmentation fault, GDB is not very helpful.


Following happybojr's idea, I made this in C++:.

Code: [Select]
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char *argv[]);

int main(int argc, char *argv[])
{
  string all_chars = "abcdefghijklmnopqrstuvwxyz";
 
  int i, u;
  string finalString;
  for (i=0; i<26; i++)
  {
    for (u=0; u<26; u++)
    {
      finalString.append( all_chars.substr(i,1) );
      finalString.append( all_chars.substr(u,1) );
      cout << finalString << endl;
    }
  }
 
  return 0;
}

It works more or less, here's the beginning of the output:

Quote
aa
aaab
aaabac
aaabacad
aaabacadae
aaabacadaeaf
aaabacadaeafag
aaabacadaeafagah
aaabacadaeafagahai
aaabacadaeafagahaiaj
aaabacadaeafagahaiajak
aaabacadaeafagahaiajakal
aaabacadaeafagahaiajakalam
aaabacadaeafagahaiajakalaman
aaabacadaeafagahaiajakalamanao
aaabacadaeafagahaiajakalamanaoap
aaabacadaeafagahaiajakalamanaoapaq
aaabacadaeafagahaiajakalamanaoapaqar
aaabacadaeafagahaiajakalamanaoapaqaras
aaabacadaeafagahaiajakalamanaoapaqarasat
aaabacadaeafagahaiajakalamanaoapaqarasatau

469
Miscellaneous / Re: FAIL
« on: August 02, 2011, 10:38:39 am »
This takes MS Fail to a new level.  no wonder windows crashes all the time...

Windows code must be like:

312AB312312321H321

heh

470
Math and Science / Loop all possible words algorithm
« on: August 02, 2011, 09:11:10 am »
I'm wondering about how to loop all possible words like:

Code: [Select]
a
b
c
...
aa
ab
ac
ad
...
bce
...

I know this is a CPU Consuming algorithm, but I'm wondering of how to replicate it in C. I'm not asking for C code or C help, but simply the algorithm in general words. Thanks, also if this algorithm has a name, please tell me ;)

471
It says "Coming Soon" on the site...
And in fact I never seen TI calcs in markets.

I see. I was more wondering about Ndless/TNOC actually.
Oh I see what you mean...

I think the OS may not be quite different.

Quote from: Rules
4: The only time double-posting is allowed (posting two messages in a row in the same topic) is either if there has been 6 hours since your last post, 3 hours if your thread has been bumped out of the New Posts page, 1 hour if it's a project update or immediately if you need to upload more than 10 file attachments at once. Otherwise, update the last post using the "EDIT" button. It will be marked as unread for all members (altough it won't bump the thread).

Read more.

------

Either way, I had no idea they made separate products for China, or is this the first time?

472
TI-Nspire / Re: [Nspire Entry] Falling Blocks
« on: August 02, 2011, 07:01:37 am »
the highscore one being saved in a anti-cheating secured external variable ? :P

Sort of, I'm using var. It's so that it is saved when you close the file too, but you know that ;)

473
General Discussion / Re: Yanni - Classical Music Composer
« on: August 02, 2011, 05:28:44 am »
My grandparents have his DVD, he's rather nice indeed.

I'm thinking about buying his last CD.

474
General Discussion / Yanni - Classical Music Composer
« on: August 02, 2011, 05:22:02 am »
Even though I already know that some of you like Yanni and know him, I decided to share a couple of songs by Yanni, that I just think are phenomenal.





Note: Both of these songs are from his concert "Yanni live at the acropolis", he made other albums, so feel free to check more on him.

475
TI-Nspire / Re: Pianoman's Real Contest Entry
« on: August 02, 2011, 04:47:06 am »
Errrr its a video poker game, so no enemies. Its based on what you get, not whose hand is better. I explained more clearly in the fifth screenie.

Ah sorry I thought it was that poker where you play other people :P Looking good though!

476
Miscellaneous / Re: FAIL
« on: August 02, 2011, 04:15:59 am »
What a fail! hahahah

477
TI-Nspire / Re: Pianoman's Real Contest Entry
« on: August 01, 2011, 04:40:35 pm »
Is there artificial intelligence in the enemies?

478
TI-Nspire / Re: [Nspire Entry] Falling Blocks
« on: August 01, 2011, 04:30:47 pm »
Looks nice, but why are there two score counters in the corner?

The top one is the current score and the bottom one is the highscore one.

479
TI-Nspire / Re: [Nspire Entry] Falling Blocks
« on: August 01, 2011, 04:27:02 pm »
That's a really good point... I never thought of that.
*Pianoman runs to go add that to Pacman

Thanks, I've always thought the number keys are much easier to use like in nDoom, hence I chose these for Falling Blocks too.

480
TI Z80 / Re: Croquette IDE
« on: August 01, 2011, 04:25:52 pm »
Thanks for making the post and merging the two projects Michael ;)

Pages: 1 ... 30 31 [32] 33 34 ... 424