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 - Tribal

Pages: [1] 2 3 ... 17
1
Calculator C / Re: Problem with C code
« on: September 08, 2011, 12:32:30 am »
By the way, you used "++w", shouldn't it be "w++"? I've seen both being used but I can't understand the different.

EDIT: Oh wait, I got it (http://www.gamedev.net/topic/337133-i-vs-i/)

Just as a side note, it is more efficient to do ++w.  So if you don't need the value of w before it's incremented, then use ++w instead.

2
Art / Re: a very unordinary picture
« on: August 31, 2011, 09:03:56 pm »
It could be that the image got corrupted at some point.  It could also be a fragmenting problem.

3
Calculator C / Re: C Q&A Thread
« on: August 25, 2011, 09:42:02 pm »
Or use calloc().

I've never used calloc ever since I came across the post on cprogramming's discussion board:

Quote
malloc will return an uninitialized chunk of memory for you to use.
calloc ( clear alloc ) will attempt to initialize that chunk of memory to all bits zero.

Note that when I say attempt, I mean that this may not be possible so you shouldn't rely on it. Other than that the only difference is how they are called and how they are implemented. So in the end, which one you choose to use is a matter of preference.
ref: http://cboard.cprogramming.com/c-programming/20505-malloc-vs-calloc.html#post132635

4
Calculator C / Re: C Q&A Thread
« on: August 23, 2011, 09:23:45 pm »
Yeah, it kinda sounds like a problem with null termination.  You should never assume allocated memory is clean, the safest bet would be to do a
Code: [Select]
memset(input, 0, bytes allocated);
after allocation and see if it still does it.

5
Math and Science / Re: New RSA Algorithm discussion
« on: July 21, 2011, 08:17:01 pm »
An update on the way I've been approaching this issue, storing the frequency as the x-coordinate instead of the number it's currently on seems to fit a logistic curve quite nicely.  The curve seems to fit pretty well with basically any primes as well, it's just the height of the curve that seems to be variable.

6
Math and Science / Re: New RSA Algorithm discussion
« on: July 18, 2011, 01:36:26 am »
The program isn't really meant to *factor* anything.  It gets test data from doing a the comparison 'fpart(n/x) < fpart (n/(x+1))' where n is a semiprime and x is the current number counting down from sqrt(n).  If the condition is true, the number between the last successful comparison and the current comparison is stored as the y coordinate and the current 'x' is stored as the x coordinate.  For any semiprime numbers, this gives a graph that is always similar to http://i.imgur.com/lZKUX.png.

EDIT: That's kind of an old screenshot, but iirc that graph checks all numbers to zero instead of stopping at the factor.  I did this on purpose to see what the results were.  The C++ version would only show the last of the three asymptotes.

7
Math and Science / Re: New RSA Algorithm discussion
« on: July 17, 2011, 04:38:50 am »
I'm not quite sure what you expect by 'working' but... As far as I know it outputs exactly what the TI-BASIC version would, except in a slightly different way.  It outputs everything to dataset, the first three numbers indicate the two primes entered, the third represents how much data there is.  After that it is just x, y coordinates one after another.  And of course it can handle larger numbers and is faster at what it does.  I'm still not exactly sure how to make a function from this data, I'll work more on that later.  The main reasons for making the C++ version was for the speed and to check and see if the pattern that I saw on the calculator's graph extended beyond numbers I couldn't test.

8
Math and Science / Re: New RSA Algorithm discussion
« on: July 15, 2011, 04:27:03 pm »
Spoiler For IGNORE:
SQRT(X,Y) = SQRT(X/Y)
I don't really know why I was showing it like that, I'll fix it when I attempt to make it more speed efficient instead of space efficient.
Woops :-X

EDIT: AGH!  I'm just not thinking straight x.x
Yeah, it should be finding the sqrt of n like graphmastur said. Updated all flowchart links with the corrected version.

EDIT2: More flowchart errors addressed and all links (re)updated again.
EDIT3: I factored out some of the complexity of the former flowchart, here is the new one: http://i.imgur.com/sSkWK.png
EDIT4: One last error: The starting value of F should be 0 not 1 for the new flowchart.  I'm to lazy to upload another flowchart atm, so just so y'all know.
EDIT5: I got the C++ version done, source code is below.
Code: [Select]
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>

#define FPART(x) (float)(((float)x)-floor((float)x))

inline unsigned int isqrt(unsigned int n) {
    unsigned int i;
    for (i = 0; n >= (2*i)+1; n -= (2*i++)+1);
    return i;
}

int main(int argc, char *argv[]) {
    FILE *fp;
    unsigned int f, p, q, n, x, l;
    std::vector<unsigned int> xy;
    
    f = 1;
    p = atoi(argv[1]);
    q = atoi(argv[2]);
    n = p * q;
    x = isqrt(n);
    l = (p > q) ? q : p;

    for(; FPART(n/x) > FPART(n/(x+1)); --x);

    for(; x > l-1; ++f, --x) {
        if (FPART(n/x) > FPART(n/(x+1)))
            continue;
        xy.push_back(x);
        xy.push_back(f);
        f = 0;
    }
    
    fp = fopen("dataset", "w");
    fprintf(fp, "%u %u %zu ", p, q, xy.size());
    for (x = 0; x < xy.size(); ++x)
        fprintf(fp, "%u ", xy[x]);

    fprintf(fp, "\n");
    fclose(fp);

    return EXIT_SUCCESS;
}

9
Math and Science / Re: New RSA Algorithm discussion
« on: July 15, 2011, 04:02:53 pm »
You really should mark yes and no on your flow chart.  Also, I don't know what ISQRT(p,q) is to know what X is.  I also don't know what you assume for P and Q.  Also, there are some nodes that have 3 outputs, too.
Sorry, I put 'False' on the false routes, so if it isn't false assume true.  I also fixed some mistakes and added a notes thing at the top.  Also, ISQRT is just integer sqrt, which can be thought of as the floored result of sqrt.  It's also less confusing with all the mistakes gone <_>

Updated flowchart: hhttp://i.imgur.com/ojm1J.png

10
Math and Science / Re: New RSA Algorithm discussion
« on: July 15, 2011, 02:29:36 am »
***NECRODOUBLEPOST***

It's been awhile since I did anything with this because of so many factors, but I decided to write my tibasic code into C so I could use bigger primes.  I made a flowchart to help me figure out what exactly is going on since I haven't touched this in awhile, and for anybody who didn't really know it was that it was doing in the first place.  I'm still pursuing this because I have a strong feeling I was onto something, and it would be a great discovery.

Also, maybe this topic should be moved under the 'Math and Science' subforums?

11
OmnomIRC Development / Re: IRC Client Integration
« on: June 29, 2011, 06:41:56 pm »
Here is my version of the x-chat plugin.  I thought the original was overly complex for the work to be done, so I rewrote everything in C and I personally think it is more readable.  There was a small bug with nicks which I believe is fixed but I didn't test the fix so post here with any problems and hopefully someone(or I) will try and fix them.  I will try and help with problems, but I've been busy looking for work etc so I might not be able to get things working immediately.

Spoiler For Abandon All Hope, Ye Who Enter Here:
Code: [Select]
#include "xchat-plugin.h"
#include <string.h>

#define PNAME "OmnomIRC Integration"
#define PDESC "Integrates OmnomIRC into X-Chat"
#define PVERSION "0.1"

static xchat_plugin *ph;
static const char *omnomirc_nick = "OmnomIRC";

static int
message_cb(char *word[], void *userdata) {
    int i;
    char *res, *msg, nick[30];

    if (strcmp(word[1], omnomirc_nick))
        return XCHAT_EAT_NONE;

    msg = word[2];
    res = strchr(msg, '*');
    if (res != NULL && res-msg+1 < 11) {
        for (; msg != res; ++msg)
            *msg = '\x03';
        *msg = '\x03';
        *++msg = '6';
        word[1] = "*";
        return XCHAT_EAT_NONE;
    }

    for (i = 0; *msg != '>'; ++i,++msg) {
        if (*msg == '<')
            *msg = '\x03';
        nick[i] = *msg;
        *msg = '\x03';
    }

    *msg = '\x03';
    *++msg = '\x03';
    strcpy(word[1], nick);

    return XCHAT_EAT_NONE;
}

void
xchat_plugin_get_info(char **name, char **desc, char **version, void **reserved) {
    *name = PNAME;
    *desc = PDESC;
    *version = PVERSION;
}

int
xchat_plugin_init(xchat_plugin *plugin_handle,
                  char **plugin_name,
                  char **plugin_desc,
                  char **plugin_version,
                  char *arg) {
    ph = plugin_handle;

    *plugin_name = PNAME;
    *plugin_desc = PDESC;
    *plugin_version = PVERSION;

    xchat_hook_print(ph, "Channel Message", XCHAT_PRI_NORM, message_cb, NULL);

    xchat_print(ph, "OmnomIRC Integration loaded successfully!");

    return 1;
}

12
News / Re: Massive Restructure to IRC
« on: March 16, 2011, 10:56:45 am »
but if some trollers vote for DJ_O for example, DJ_O will be devoiced. Maybe only the anti-riot squad members / members with >250 posts could do vote for members to be devoiced?
Well, the idea of having a community effort on the vote stems from the riod squad people, and others who actually have power in the channel are not always there to do this.  Of course, if someone was devoiced then he/she could just be revoiced and the 'trollers' could then be banned for abusing this system.
I like anti-riot squad and up to vote, but then again, if someone were devoiced for no apparent reason, it would obviously be a troll and we could just voice him again.

speaking of which, how exactly do we get in #omnimaga?
At the time I think that the channel is still unreachable, but when restrictions are dropped, you can access it by connecting to a EFnet server through either a online or downloaded client such as mIRC or XChat and then joining the channel #omnimaga with the /join command.

13
News / Re: Massive Restructure to IRC
« on: March 16, 2011, 10:20:06 am »
Due to recent incidents I have decided to do a massive restructure to IRC.
The channel is, for now going to be invite only as we get things set up. OmnomIRC will eventually be connected, but at the moment it will not.

We are no longer going to voice everybody in the channel, in fact the channel will be in private mode (or whatever it's called) continually, so no non-voiced members can chat. New joiners will have to request voice from ops and it will be at the ops discretion.
While we do want to help people, I think that this sort of instant communication where people can be hurt quite easily should be limited for those who we know wont hurt others. People who have proven themselves to be good will be given ident from netbot so they can autovoice.
The greet bot will now give a greet to all members who join with more information then just the link to the rules, but some more outlining some more specifics, and information on how to ident for those who can. Also who holds ops in the channel will be re-thought, more may be added, some may be taken away, no promises as of yet.

This restructure can be changed in the near future, but first all the admins need to have a discussion about it and until then the rules outlined above are to be followed.

There will be no complaints about this change especially since it is not final yet and the decision is final that there will be restructuring due to what has happened.

Thank you for your patience in this transition.
On behalf of the Omnimaga staff
Nathaniel "Eeems" van Diepen

I agree with the idea of this, but I believe the way that the proposed way is rather uninviting to new people.  I propose that instead of not voicing anybody without them being added explicitly by a op, that they should be voiced a set time after the greet bot has sent them a link to the rules.  Afterwards, any bad behavior can be monitored by those users who are there and if the behavior is unwelcomed they could vote that the user be devoiced with something like '!mute <user>'.  A bot would tally these votes and if a certain amount is reached then the user would be devoiced and would await a final ruling by those in charge of the channel, or someone higher up.  To me, it is a much better solution to the current problem and more welcoming than the aforementioned method proposed by Eeems.  What do the rest of you think?

14
Math and Science / Re: New RSA Algorithm discussion
« on: March 08, 2011, 10:12:36 am »
EDIT: Right now this program assumes Q is the smaller of the two primes. Just add '(P>Q)Q+(Q>P)P→L' at the beginning and change 'If X=Q-1:Return' to 'If X=L-1:Return'.
usually P is used as the smaller.  And if you already know P or Q, why do we need to find it?

I was randomly throwing a prime in P and Q, so I didn't know which was smaller.
In these scenarios I am using a known P and Q only to generate a semiprime N. From that, I'm trying to find a formula that would give the amount of numbers away from what might be the factor of N(I'm not actually using P or Q for anything except to get N and to stop after I've reached the lower of the two). With this function, it may speed up any TF'ing because you are not checking every other number, you would be checking the number given by the function. I believe that the function is uniform to all semiprimes as well, because the graph given for a random semiprime is equivalent if not the same for all of them. I'm not exactly sure how to find this function though, that's where I'm stuck at. It is a exponential graph that has multiple asymptotes, but from that I don't know what todo :/

15
Math and Science / Re: Favorite math theory/rules/law/et cetera.
« on: March 08, 2011, 09:57:48 am »
I don't know who discovered this equation, but I call it the "mosquito curve" and I found it by accident.  (This is in polar graphing)

r = sin(cos(tan(theta)))

Lol, I do that too XD But r=sin(sin(sin(tan(θ is better.

Another fun thing to do is Y=sin(cos(tan(X, change it to Dot mode, then set the window range to (-50,50) and (-1.25,0.75). It's a nearly perfect butterfly O.O

Is this a dog with wings?
r=tan(cos(cos(sin(theta^2)^2)^2)^3

Oh the things we do when we're bored :P

The dog doesn't seem to work with me, though. Any particular window settings?

No, I just hit ZStandard and it comes up.
It might just be a side view of Hot Dog's mosquito though :P

Pages: [1] 2 3 ... 17