- Viewing Profile: Reputation: sooner123
Community Stats
- Group Members
- Active Posts 264
- Profile Views 3,169
- Member Title Member
- Age 25 years old
- Birthday July 18, 1987
-
Gender
Female
-
Interests
Gaming, Reading, Anime&Movies.
Coding, Math, Science.
I like to write a lot of code snippets. Assembling a mass of interesting tools related to math and search/sort/hash/encryption/decryption algorithms.
Someday I'll find some great wonderful way to put them all together and make an actual tool chest. Or find a project worth applying them to.
I have a really wide variety of interests and I like to delve pretty deeply into a topic before boredom kicks in and I move on.
User Tools
Latest Visitors
#5012327 Calculating prime numbers with memoization
Posted by sooner123
on 18 December 2012 - 10:35 PM
I'd like to do this without a major restructuring of the code if possible.
[source lang="cpp"]#include <time.h>#include <math.h>#include <iostream>#include <cstdlib>int main(int argc, char*argv[]){ clock_t startTime = clock(); int maxToTest = atoi(argv[1]); int*primes = new int[maxToTest]; primes[0] = 2; int maxPrimeIndex = 0; for (int i=3; i<=maxToTest; i++){ int isPrime = 1; for (int j=0; (isPrime)&&(primes[j] <=sqrt(i)); j++) if (!(i%primes[j])) isPrime = 0; if (isPrime) primes[++maxPrimeIndex]=i; } std::cout << maxPrimeIndex + 1 << " primes <= " << maxToTest << " found in " << (clock() - startTime)/CLOCKS_PER_SEC << " seconds";}[/source]
#5011512 Predator-Prey simulation
Posted by sooner123
on 16 December 2012 - 10:10 PM
I really appreciate both your help. Thanks a lot
#5007906 Any faster way to calculate prime number?
Posted by sooner123
on 06 December 2012 - 04:32 PM
Whether 1 is prime or not is a matter of convention, and the prevailing convention is that it is not a prime. There are multiple possible definitions of what "prime" means, and they often tell you explicitly that 1 is not a prime. See the beginning of the Wikipedia page for an example.
This isn't really correct. 1 isn't a prime because it doesn't match the true definition of prime numbers. There is no convention about it.
The definition you've probably heard (something along the lines of "positive integer divisible only by 1 and itself, excluding 1") is a laymen's definition that simply happens to coincide with the real definition.
The real definition is that a prime number is an element of the set of numbers into which all positive integers can be factored into products of powers of, uniquely. It's a fundamental theorem in number theory. '1' clearly violates this because to factorize, say 12, you could have 1 * 2^2 * 3^1 or 1^2 * 2^2 * 3^1, or 1^3 * 2^2 * 3^1, etc. There are an infinite number of ways you can factorize something if you accept 1 as a prime number and primes are defined to make factorization unique.
#5007855 Fastest Growing Hierarchy
Posted by sooner123
on 06 December 2012 - 02:05 PM
In trying to write a recursive function that returns the fastest growing hierarchy (a really fast growing function).
Here is the definition:
Base function f0: f0(n) = n+1
Next function f(a+1): f(a+1)(n) = fan(n)
Functional powers: f(a+1)(n) = f(fa(n)) where f0(n) = n
#include <iostream>
using namespace std;
int hf(int, int);
int f(int x, int power, int functionalBase)
{
if (power==1) return hf(x, functionalBase);
else return f(f(x, power-1, functionalBase),1, functionalBase);
}
int hf(int x, int functionalBase)
{
if (functionalBase==0) return x+1;
else return f(x,x,functionalBase-1);
}
int main()
{
cout << f(2, 2, 2);
}
#5006368 Problem with destructors in C++
Posted by sooner123
on 02 December 2012 - 02:16 PM
And thank you for pointing out the error in the logic that was causing the crash.
One last mistake on my part. I was deleting the Node instead of the Class the Node pointed to.
#5006240 Contain instance of Derived Class in instance of Base Class
Posted by sooner123
on 02 December 2012 - 02:57 AM
#include <iostream>
using namespace std;
class BaseClass;
struct Node
{
Node* prev;
Node* next;
BaseClass* data;
};
class BaseClass
{
public:
int x, y;
//Node<BaseClass*>* list;
Node* list;
void AddChild(BaseClass* obj)
{
Node*elem = new Node;
elem->prev = NULL;
elem->data = obj;
if (list == NULL)
{
elem->next = NULL;
list = elem;
}
else
{
elem->next = list;
list->prev = elem;
list = elem;
}
}
void RemoveChild(BaseClass* obj)
{
for(Node*elem = list; elem != NULL; elem = elem->next)
{
if (elem->data == obj)
{
//if node to delete is head of list
if (elem->prev == NULL)
{
list = elem->next;
}
//if node to delete is tail of list
else if (elem->next == NULL)
{
elem->prev->next = NULL;
}
//if node to delete is not start or end
else
{
elem->prev->next = elem->next;
elem->next->prev = elem->prev;
}
delete elem;
return;
}
}
}
void ListChildren(int tabDepth=0)
{
Node*elem = new Node;
elem = list;
while(elem != NULL)
{
for (int i=0; i<tabDepth; i++) cout << " ";
cout << "child: " << elem->data->x << endl;
if (elem->data ->list != NULL)
{
elem->data->ListChildren(tabDepth+1);
}
elem = elem->next;
}
}
BaseClass()
{
list = NULL;
}
};
class DerivedClass: public BaseClass
{
public:
int memberValue;
DerivedClass(int a, int b)
{
x = a;
y = b;
}
};
int main()
{
BaseClass* root = new BaseClass;
BaseClass* child1 = new DerivedClass(1, 2);
root->AddChild(child1);
BaseClass* child11 = new DerivedClass(5, 6);
child1->AddChild(child11);
BaseClass* child111 = new DerivedClass(13, 14);
child11->AddChild(child111);
BaseClass* child112 = new DerivedClass(15, 16);
child11->AddChild(child112);
BaseClass* child113 = new DerivedClass(17, 18);
child11->AddChild(child113);
BaseClass* child12 = new DerivedClass(7,8);
child1->AddChild(child12);
BaseClass* child2 = new DerivedClass(3, 4);
root->AddChild(child2);
BaseClass* child21 = new DerivedClass(9, 10);
child2->AddChild(child21);
BaseClass* child22 = new DerivedClass(11, 12);
child2->AddChild(child22);
root->ListChildren();
}
#4966872 md5+salt
Posted by sooner123
on 06 August 2012 - 07:05 PM
#4889052 School? I would not call it that way.
Posted by sooner123
on 30 November 2011 - 07:31 AM
But don't take some person you've never met's side on a range of issues they were wrong on to try to prove the prior points. It just makes you look like the type of person who will take an incorrect stance for the sake of argument and utterly destroys your credibility.
Java is far-and-away the most common first programming language in both highschools and university. And there is good reason to teach it in the 10th grade: the AP Computer Science test is largely Java-oriented, so your students will have a headstart in that respect.
Valid.
Big numbers are a great justification for using doubles. It takes a pretty solid understanding of binary representations fully comprehend when doubles are required.
Invalid. Understanding the binary behind primitive data types and why/when to use them is simple and can be grasped by a 10th grader. And he was correct. Her not pointing out the use of floats/doubles for high precision rather than just high value was poor on her part.
Modern languages don't even have floats: Python, Ruby, JavaScript - no floats to be seen.
Invalid. There are floats in javascript. And other "modern" languages besides the few you listed use floats. CPUs are hardwired to deal with floats.
You are both right. The difference is that when using ASCII, you have to change the locale to match the character set you wish to use.
Invalid. The obvious implication of what she said was that ASCII has a value for every character. Not true. It has 256 characters. You can arbitrarily change what these characters are mapped to but then guess what? You lose the other ones they used to be mapped to. There are more than 256 characters between all characters in all languages. Quite a bit more in fact. This kid is right. His teacher was wrong. He is also right about unicode.
Programmers are lazy. Her way is no less correct than your's, and in some cases may be less error-prone.
Invalid. He didn't say either way was more or less correct. He said that she said that programmers use shorthand for no good reason. This isn't true. a++ is more easily descriptive than a = a + 1. It has its uses in good practice and the kid realizes this.
Nobody's future is going to be ruined by a crappy semester of programming. Those that care will learn on their own,
Valid.
and those that don't care will go off and have an actual social life
Invalid. Embarrassingly so. Beyond the need for explanation so.
Quit obsessing over her lack of l33t h4ck3r skills, and go do all the usual highschool things - sports, girlfriends, etc. You'll only regret it later if you don't.
Invalid. And indicative of some strange kind of envy you have for one particular subset of people.
#4871917 train neural network with genetic algorithms
Posted by sooner123
on 12 October 2011 - 11:18 AM
I believe that was my issue with all of this... it seems that by combining the two, you are training your fitness function with a fitness function. Why not just make the original one more accurately descriptive in the first place?
I disagree. Back propagation works about as well as permuting the weights genetically. That's all this guy is doing. Treating the weights of the connections between the nodes as components of the chromosome. The only time NN works against GA is when not only the weights but the structure of the NN is dynamic.
#4866398 Theory - ultimate AI, at atomic level
Posted by sooner123
on 27 September 2011 - 05:59 AM
a. It was already established one of the root causes was our lack of understanding the physics. And he pointed out we can't yet solve the 3-body problem.
No it wasn't established. The only issue is a mathematical one. We understand the physics of the 3-body problem perfectly. At any given point we know the gravitational forces between any of the bodies. You simply don't understand this.
b. The butterfly effect is a subset of the chaos theory. And when we go into Chaos Theory, we find out we don't know yet whether real life™ is deterministic or not. Should we scientifically prove God plays dice once just for fun in a while causing the universe to be non-deterministic, then our simulation becomes flawed, since PCs are inherently deterministic. We can try to play with entropy data from the outside or go multi core and hope the quantum mechanics break the determinism we need. But even then we wouldn't be able to introduce the same randomness "God" put into our life; being us unable to reproduce reality accurately. Furthermore, happen our world to be non-deterministic; many simulations would actually fail to produce life even if we knew all physics equations and had a 100% understanding. I'm cheering for a deterministic world therefore, just to think that there isn't something impossible; but we have to recognize there's a chance it may not be possible.
Ahh I see. The fact that you want the universe to be deterministic explains a lot about your weak understanding of chaos theory. Given that our universe is probably simulated with a finite resolution, I think determinism is unlikely.
c. It's already established we need infinite processing power to simulate perfectly; since our simulated world may want to start it's own simulation just like we're trying. Or may be we shouldn't try it!!! Otherwise real life will stall until our simulation we just started stops (tip: if the scientist from simland decide to simulate their "real life", their world will stall too)
Wrong. You can't know that and it hasn't been established. I don't know why you keep saying things that no one even knows are "established." It's more than likely that our universe is being simulated. And therefore it's being simulated to some finite resolution. Which doesn't require infinite processing. Again, it just seems like you don't understand the concept of simulating a universe. The universe "above" ours could easily have subtle or radically different laws that allow them to do far more efficient computing. Or we simply have further to go in computing than we realize.
You meant an infinitely powerful enough computer? Unless all results are round numbers, "accurate" becomes truncated/rounded numbers with translated errors. You're waaaaay underestimating the butterfly effect, which leads us to...
Wrong again. I didn't say perfectly. I said accurately. I was talking about how the more powerful your simulating medium gets, the more accurate the simulation. In a predator-prey simulation, the denizens move around in incremental finite steps. But they're not aware of this. Maybe if they got smart enough they could be. Like how we can analyze quantum mechanical phenomena now.
You mean a computer with infinite RAM? Well then, since I have a very simple task for you: Compute the number PI with 100% accuracy. All decimals included. Then use it in your simulation.
Not relevant for reasons stated above. If we simulate the universe down to an accuracy of x, then we only need to use pi to enough digits that given an exact diameter, we get a circle to the nearest x.
Pro tip: If you miss one decimal, the butterfly effect will sooner or later kick you in the balls. Seriously. Try to debug THAT.
Why do you assume the Butterfly effect is this end all be all force of nature that causes ripples ever outward from some origin? Why not wave dampening? Why not consider the case where some cause is eventually nullified. Stepping on that butterfly in the cretaceous era doesn't matter since a T-Rex steps there right after. Small deviations and changes? Maybe overruled by bigger ones.
You don't understand Chaos theory, Butterfly effect, or the concept of simulation.
But even if you were right. What's so crazy about the concept of a computer that doesn't miss a decimal? Or how do you know there aren't errors all the time? And they do ripple outward? So what?
I miss when Gamedev automatically locket threads down after 2 weeks. Someone please lock this madness. One trivial comment bumps the thread after which soon 3 troll/flamewar/pointless/endless threads follow.
There's always more to be said when talking about philosophical stuff like this.
#4865124 Theory - ultimate AI, at atomic level
Posted by sooner123
on 23 September 2011 - 06:02 AM
Incidentally, for those who cite "perfect knowledge of the laws of physics" need to google the "3-body problem" and the "butterfly effect".
I do not believe you understand either of these problems then.
It's easy to simulate 3 bodies. With a powerful enough computer you could even simulate them accurately. The problem asks for a closed expression for their position(time). This is a mathematical failing. Not a physics failing.
The butterfly effect is exactly the same deal.
Not that Dave needs it, but I have to come to his defence here. His point was bang on-- mathematics is still a work in progress, as is physics (and by extension everything else).
Sorry but no. His point was that we couldn't accurately analyze three gravitationally bound bodies in terms of physics. This isn't true. At any point we can see the resultant forces, center of gravity, momentums of every component and subset of an n-body situation. We just don't have the mathematical tools to model them with closed expressions. His point was correct in that we do not have a perfect knowledge of physics. His example was incorrect. We do have perfect knowledge of the 3, 4, or even n-body problem. We just don't have the mathematical tools to model it with a closed expression.
You think your thoughts are under your control but they are just the deterministic result of the processing of your neural network. Simulating an equivalent neural network in software would have the result of a conscious entity of equal intelligence and sentience as yourself.
Prove it. ;)
Actually the onus is on you to prove otherwise. Suggesting otherwise is akin to a religious claim.
If you can't understand it, try to understand what a neural network is. Understand the difference between mind and brain.
And if you do understand it, why play devil's advocate with me who is correct and stretch definitions and overlook inaccuracies to agree with the mod? It comes off as you being an enemy of free discussion of intellectual topics since you appeal far too much to authority.
#4860793 Theory - ultimate AI, at atomic level
Posted by sooner123
on 12 September 2011 - 12:22 PM
<br><br>If the AI's neural network was structured the same as yours, they would "see" the same things you see when you "picture" something.<br><br>If it was given a neural network similar to a human infants, visual input into the optic nerve, auditory/gravitational input into the vestibular, etc. etc., then it would evolve into an adult brain that thinks, conceives, and pictures things the same way you do.<br><br>There is no distinction. You are seeing a difference that doesn't exist because you don't understand intelligence.<br>
<br><br><br>If you close your eyes and think of a person or picture...what is it youre seeing? That "picture" that you're imagining is not a picture...its a thought, but one that we interpret as a picture by using different parts of our brain to form it.<br><br>When you create an AI...how would they see that "thought" If you programmed them with knowledge of a particular item, could they use their programmed knowledge to picture the item without seeing it? <br><br>Makes me think of language...language is actually a barrier that slows our thought process down. If everyone was equally intelligent, perfect beings, we would have no need for language. It wouldnt be telepathy, it would be knowing the answer because its the right thing to do. If we had to communicate with people, we would instantly understand what they needed without exchanging words because we could interpret the need without having to talk.<br><br>its like a team game..either digital or athletic. you become a cohesive unit...multiple brains melding into one to the point where you can predict what the other is doing without talking. <br><br>pretty neat to think about. <br><br><br><br>
<br><br>I do not believe you understand either of these problems then.<br><br>It's easy to simulate 3 bodies. With a powerful enough computer you could even simulate them accurately. The problem asks for a closed expression for their position(time). This is a mathematical failing. Not a physics failing.<br><br>The butterfly effect is exactly the same deal.<br><br>The original post was an obvious troll. Not made obvious only by the implication that we could simulate a planet, but that the best way to simulate intelligence would be on the atomic level, rather than the cellular level.<br><br>I'd also like to point out to another poster that thinks that machines won't be able to "think" that it is not the machine's failure to think but YOUR failure to understand what thought is.<br><br>You think your thoughts are under your control but they are just the deterministic result of the processing of your neural network. Simulating an equivalent neural network in software would have the result of a conscious entity of equal intelligence and sentience as yourself.<br><br>(simulating a better one would result in a conscious entity capable of understanding that thought is a deterministic result. not an underlying, driving force)<br><br>Incidentally, for those who cite "perfect knowledge of the laws of physics" need to google the "3-body problem" and the "butterfly effect".<br><br>On-topic, I should have locked this thread when I had the chance. <img src="http://public.gamedev.net/public/style_emoticons/default/dry.gif"><br>
<div><br></div><div><a href="http://en.wikipedia.org/wiki/Brain_in_a_vat">http://en.wikipedia.org/wiki/Brain_in_a_vat</a></div><div><br></div><div>Read this.</div>
#4860677 Theory - ultimate AI, at atomic level
Posted by sooner123
on 12 September 2011 - 08:07 AM
Incidentally, for those who cite "perfect knowledge of the laws of physics" need to google the "3-body problem" and the "butterfly effect".
On-topic, I should have locked this thread when I had the chance.
I do not believe you understand either of these problems then.
It's easy to simulate 3 bodies. With a powerful enough computer you could even simulate them accurately. The problem asks for a closed expression for their position(time). This is a mathematical failing. Not a physics failing.
The butterfly effect is exactly the same deal.
The original post was an obvious troll. Not made obvious only by the implication that we could simulate a planet, but that the best way to simulate intelligence would be on the atomic level, rather than the cellular level.
I'd also like to point out to another poster that thinks that machines won't be able to "think" that it is not the machine's failure to think but YOUR failure to understand what thought is.
You think your thoughts are under your control but they are just the deterministic result of the processing of your neural network. Simulating an equivalent neural network in software would have the result of a conscious entity of equal intelligence and sentience as yourself.
(simulating a better one would result in a conscious entity capable of understanding that thought is a deterministic result. not an underlying, driving force)
#4857894 The Immortal Ruler
Posted by sooner123
on 05 September 2011 - 11:37 AM
Some other games, like the Total War series, have different leaders which change over time and have different attributes, but it has little effect on gameplay.
Do you see what happened here? You breezed over this point. Yet it sort of destroys the point you were making.
This example DOES do what you're talking about. And it very much did affect gameplay.
It's just.. stopping to acknowledge that something else has fully addressed what you think is an unaddressed issue is difficult.
But this type of intellectual honesty is part of being a good designer. This and fully fleshing out your ideas.
The way to remove the non-human element of the controller in a 4x is to have constant dialogue between yourself and your subordinates. Dialogue that shapes events. Give yourself an audible voice.
Show a cutscene of your character loading themself into an enveloping console that connects their body and mind to an order-issuing field-report-processing system.
Show cutscenes of them meeting with their advisors. Whatever.
It isn't some critical issue that requires some paradigm shift in 4x style gameplay to resolve. You simply need to accept that it's already been resolved.
Then move on.
Maturely.
#4842779 What's the largest number you can come up with?
Posted by sooner123
on 31 July 2011 - 02:25 AM
your right, i tried running that and the result when i told VS to break all was 1.
so this would be smaller then those other replies, but what is a googleplex ?
a take on Google ?
It's when someone can't stop using Google.
- Home
- » Viewing Profile: Reputation: sooner123


Find content