Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: Raylin on April 11, 2010, 08:48:23 pm
-
Say that 7 players have a number (1-7).
Say there is a list that is populated with these numbers (1-7).
The concept here is to establish some sort of order here.
i.e. When Player 1 moves, he moves to the bottom of the list and works his way up the list. Every other player follows suit.
EDIT: The list looks like this.
1
2
3
4
5
6
7
*Player 1 ends his turn
The list should look like this.
2
3
4
5
6
7
1
-
Repeat Getkey(15)
(player does turn here)
{L1}->A
For(B,1,6
{L1+B}->{L1+B-1
End
A->{L1+6
End
-
Thank you, good sir.
-
wouldn't seq(L1(X),X,2,7)->L1 be faster than the for loop?
-
wouldn't seq(L1(X),X,2,7)->L1 be faster than the for loop?
Except this is in the axe parser subforum and I'm not sure if axe has a sequence command. Other wise yes that would be the better solution.
-
I don't think Axe supports seq(.
Edit:
Ninja'd.
-
Oh, lol didnt notice, and the axe code looks so similar... :P
-
I think that's the point of Axe ;)
-
Augment(seq(L1(X),X,2,7),{L1(1->L1
It's faster to put the last element in position 1 though
Augment({L1(dim(L1))},L1->L1
dim(L1)-1->dim(L1
Edit:Oh, this is in Axe, never mind.
-
meishe91, i dont think its the point, but still a major bonus ;D
-
I know :P I was just kidding but you see what I meant (hopefully :P)
-
Player, if you're still around, could you change the code to address the fact that I used an AppVar?
-
oh yeah, np, one sec working on that sort(a thing
-
There is a very simple optimization you can do:
{A+B^7+L1}
Will return the Ath player after B turns (where both start at zero). I guess it would require you to keep track of how many turns are played so far, but its pretty simple. You can even make it a subroutine if you call it a lot to save space.
-
yeah, I was kinda wondering why he didn't do that in the first place, I figured the routine could also be used for something else
-
Oh, lol didnt notice, and the axe code looks so similar... :P
Yeah sometimes we need to be careful when we use the New Posts feature, because we tend to miss the subforum it was posted in and since Axe code is similar it may lead to confusion x.x