Author Topic: enginering a compromize  (Read 4177 times)

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
enginering a compromize
« on: October 18, 2007, 02:24:43 PM »
Numsgil  can you show me how div , mult and sqrt commands look like in c#?

Also: what is the natural log command , what is the absolute value command and round to 0 desimal places command of c#?

Quote
move 'moves a set of numbers to the lower stack. A is the ammount of stack elements , B is the position to which it is moved.
mtt 'moves a set of numbers from lower stack to top. A is the ammount of stack elements, B is the position from which it is moved.
mdup 'duplicates a set of numbers on the stack. A is the ammount of stack elements, B is the number of copys

and finaly the big one called "ang"

also is 0 or 999 the top of stack? In my TI83+ I have 1 as the bottom of stack and 50 as the top. I will post the TI83+ source code convirted to mach your stack for move mdup mtt and ang. (Just remember ":5-->E" means E=5 , also, ":End" means "End For" or "End IF")
« Last Edit: October 18, 2007, 02:27:30 PM by Botsareus »

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
enginering a compromize
« Reply #1 on: October 18, 2007, 04:23:11 PM »
Quote
Numsgil can you show me how div , mult and sqrt commands look like in c#?

Also: what is the natural log command , what is the absolute value command and round to 0 desimal places command of c#?
If you wanted to see the code, didn't numsgil had a code reposery.(or anything but then spelled correct)

If else, I suppose there's a manuel somewhere,

And they are seem as pretty simple commands, I could say what I am guesing the code would be.  .But that wouldn't be right, havn't seen any C# code ever jet.


I gues you mean something more difficult then.

V=v*v <----is sqrt, I gues.
Oh my god, who the hell cares.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
enginering a compromize
« Reply #2 on: October 18, 2007, 05:53:22 PM »
Quote from: Botsareus
Numsgil  can you show me how div , mult and sqrt commands look like in c#?

Also: what is the natural log command , what is the absolute value command and round to 0 desimal places command of c#?

Div: a / b;
Mult: a * b;
Sqrt: System.Math.Sqrt(a);

Most other math commands are also in the System.Math class/namespace, including absolute value and rounding.  C# is a stone's throw from C++ or Java in syntax.  It's probably going to be a bit of a shock if you've only ever coded in basic-derived languages.

As Peter pointed out, you can browse the source here.

Quote
Quote
move 'moves a set of numbers to the lower stack. A is the ammount of stack elements , B is the position to which it is moved.
mtt 'moves a set of numbers from lower stack to top. A is the ammount of stack elements, B is the position from which it is moved.
mdup 'duplicates a set of numbers on the stack. A is the ammount of stack elements, B is the number of copys

and finaly the big one called "ang"

also is 0 or 999 the top of stack? In my TI83+ I have 1 as the bottom of stack and 50 as the top. I will post the TI83+ source code convirted to mach your stack for move mdup mtt and ang. (Just remember ":5-->E" means E=5 , also, ":End" means "End For" or "End IF")

Apologies, but you lost me.  What are you quoting?  Where did move, mtt, mdup, and ang come from?  And why are we using a TI83+?
« Last Edit: October 18, 2007, 05:54:44 PM by Numsgil »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
enginering a compromize
« Reply #3 on: October 25, 2007, 02:12:25 PM »
I am using a TI-83 because I can't use anything more advanced in the hospital. move , mtt , mdup and ang are some commands I wanted you to add to DB. I thought It will be easyer for you to add them If I gave you the source code. (I wrote a small evo. program on my TI-83 thats uses the above commans) here is the link to the post were I explain them: Here
Quote
Instead of adding desimals we can do an internal  A B root that does A ^ (1/B) but I have no idea how to write that in c# thats why I need examples

P.S.
 It was raining here tuday so I could not bring my paper work over, I'll do it next week.
Quote
also is 0 or 999 the top of stack?
  Sorry, I mixed the memory up with stack. What are the robot stack dimentions, that is were is the start of stack, the end of stack and the length of stack. By stack I mean:

3
4
mult

will be
Quote
0 3
Quote
3 4
Quote
0 12
« Last Edit: October 25, 2007, 02:28:41 PM by Botsareus »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
enginering a compromize
« Reply #4 on: October 25, 2007, 02:26:58 PM »
Ah, okay.

If you can provide a theoretical example where existing DNA controls are inadequate, I'll try to address them and add to the language.  However, I'm generally trying to keep the command list short but sweet.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
enginering a compromize
« Reply #5 on: November 01, 2007, 01:47:24 PM »
Numsgil I know I am losing your comprehensibility. It's time for me to slow down and use a diffetent approach:

Numsgil it's time for me to learn some c#. I will explain the following code when you call me; Hopefully together we can translate it to c#.

mtt 'move to top command
Quote
abs(stack(50))-->A
abs(stack(49))-->B
If A+B < 51 and A != 0 and B != 0
Then
  For(D,50,3,-1)
  stack(D-2)-->stack(D)
  End
  0-->stack(1)
  0-->stack(2)
  A-->dim(templist)
  For(D,1,A)
  stack(51-D-B)-->templist(D)
  End
  For(D,51-B,50)
  stack(D)-->stack(D-A)
  End
  For(D,1,A)
  templist(D)-->stack(51-D)
  End
End
« Last Edit: November 01, 2007, 01:48:48 PM by Botsareus »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
enginering a compromize
« Reply #6 on: November 01, 2007, 01:54:50 PM »
The reason we need multi clone and multi move commands is for things like mult that use two variables instead of 1. And we deffinatly need it for "ang", which uses 4 variables. (That is if you like ang enough to add it, I think its deffinatly worth while.) ang returns the angle and distance for any 4 numbers. even if it's atn(1/0) it will return 90 instead, stuff like that.  And since you are generating an angle from 4 numbers why not get the distance between them as well?
Quote
A = angle from point(x1,y1) to point (x2,y2)
B = Distance from point(x1,y1) to point (x2,y2)