• Welcome to Valhalla Legends Archive.
 

Re: Open source C++ Bot

Started by iNsaNe, September 26, 2007, 09:01 PM

Previous topic - Next topic
|

iNsaNe

i have a question:

I decided to remake a bot in C++ and now im having trouble with the BigInteger part. Is there a BigInteger.dll anywhere? I've tried making my own dll but it just didnt work.

brew

whatsa BigInteger.dll?
If you're trying to dittle dattily with numbers larger then 64 bit, I recommend you treat your number as a raw chunk of memory, and develop some carry algorithms which handle it in 32 or even 64 bit chunks. You don't have to give up yet on making your own biginteger.dll... though you really shouldn't make it a dll.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

FrostWraith

Its C++, it can handle unsigned integers.  I don't see why your having this problem.

iago

The first Google hit for "BigInteger c++" is this. There are a lot more, too. You shouldn't have any trouble finding something.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Barabajagal

@Brew: It's for NLS, and trust me, you do NOT want to make your own system. I tried, and it's hell.

Camel

Quote from: Andy on September 27, 2007, 02:43 PM
@Brew: It's for NLS, and trust me, you do NOT want to make your own system. I tried, and it's hell.

I did one in highschool to prove to my C++ teacher that it could. Took half an hour to get multiply working. Maybe you just took a bad approach to it?

Barabajagal

No, I got adding, subtracting, and multiplying, all in PowerBASIC.
See http://forum.valhallalegends.com/index.php?topic=16942.0

Camel

Adding and subtracting is the easy part. Multiplication and division is harder. Powers are hardest.

brew

Quote from: Andy on September 27, 2007, 02:43 PM
@Brew: It's for NLS, and trust me, you do NOT want to make your own system. I tried, and it's hell.
Ah, I see. Heh. Do any of you remember Ante who used to post here? A few days ago he was telling me about making his own bigint calculator (apparently his goal is to calculate pi to the 5000th digit?) in vb6. It was a disaster. He used a string to store the value. I suggested to first use C++ to make this, and to treat it just as any other block of memory. He thought that it would be TOO hard (it would take some playing around with copymemory, but the end result would be much better). Somehow, just somehow, he's got it to work (I would have lost the willpower a quarter of the way through with the addition function) with just about everything, including exponents and modulus. I'm not quite sure what to think about it...
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Barabajagal

I have 4 million digits of pi in a text file ;)

Michael

Quote from: Andy on September 27, 2007, 09:37 PM
I have 4 million digits of pi in a text file ;)
and what purpose did that serve?

Barabajagal


iago

Quote from: Camel on September 27, 2007, 05:42 PM
Adding and subtracting is the easy part. Multiplication and division is harder. Powers are hardest.
The most important ones are power and powmod. The rest can come or go. :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


iNsaNe

Well I'm now using Java's big integer class, lol.

But it seems to be throwing exceptions when i get to this line of code:
array<unsigned char> ^hashB = Sha->CalculateHash((array<unsigned char>^)(B->toByteArray()));

which is part of this block of code:
array<unsigned char> ^hashB = Sha->CalculateHash((array<unsigned char>^)(B->toByteArray()));
array<unsigned char> ^uBytes = gcnew array<unsigned char>(4);
for (int i = 0; i <= 3; i++)
uBytes[i] = hashB[3 - i];
java::math::BigInteger ^u = gcnew java::math::BigInteger((array<signed char>^)uBytes);


The error message(s) reads:


A first chance exception of type 'System.ArrayTypeMismatchException' occurred in vjslib.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll


The same error message (sometimes) comes up when i get to this line of code as well:

java::math::BigInteger ^B = gcnew java::math::BigInteger((array<signed char>^)serverKey);

Is this a bug? (i have heard of some bugs within the BigInteger & BigDecimal class)

Banana fanna fo fanna

wow way to use managed c++. game over man.

|