Author Topic: Shifting Order  (Read 9565 times)

0 Members and 1 Guest are viewing this topic.

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Shifting Order
« 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.

Code: [Select]
1
2
3
4
5
6
7

*Player 1 ends his turn

The list should look like this.

Code: [Select]
2
3
4
5
6
7
1
« Last Edit: April 11, 2010, 08:53:20 pm by Raylin »
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







_player1537

  • Guest
Re: Shifting Order
« Reply #1 on: April 11, 2010, 08:58:17 pm »
Code: [Select]
Repeat Getkey(15)
(player does turn here)
{L1}->A
For(B,1,6
{L1+B}->{L1+B-1
End
A->{L1+6
End
« Last Edit: April 11, 2010, 09:00:01 pm by _player1537 »

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Shifting Order
« Reply #2 on: April 11, 2010, 09:05:16 pm »
Thank you, good sir.
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: Shifting Order
« Reply #3 on: April 11, 2010, 09:11:00 pm »
wouldn't seq(L1(X),X,2,7)->L1 be faster than the for loop?
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline JonimusPrime

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 389
  • Rating: +25/-5
    • View Profile
    • Jonimoose.net
Re: Shifting Order
« Reply #4 on: April 11, 2010, 09:13:17 pm »
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.

"Always code as if the person who will maintain your code is a maniac serial killer that knows where you live" -Unknown

"If you've done something right no one will know that you've done anything at all" -Futurama

"Have a nice day, or not, the choice is yours." Tom Steiner

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Shifting Order
« Reply #5 on: April 11, 2010, 09:14:59 pm »
I don't think Axe supports seq(.

Edit:
Ninja'd.
« Last Edit: April 11, 2010, 09:15:31 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: Shifting Order
« Reply #6 on: April 11, 2010, 09:15:37 pm »
Oh, lol didnt notice, and the axe code looks so similar... :P
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Shifting Order
« Reply #7 on: April 11, 2010, 09:16:08 pm »
I think that's the point of Axe ;)
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Will_W

  • LV3 Member (Next: 100)
  • ***
  • Posts: 54
  • Rating: +1/-1
    • View Profile
Re: Shifting Order
« Reply #8 on: April 11, 2010, 09:16:17 pm »
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.
« Last Edit: April 11, 2010, 09:16:55 pm by Will_W »
ex de,hl
ld (hl),e
inc hl
ld (hl),d
ld a,(hl)

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: Shifting Order
« Reply #9 on: April 11, 2010, 09:35:04 pm »
meishe91, i dont think its the point, but still a major bonus  ;D
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Shifting Order
« Reply #10 on: April 11, 2010, 09:36:26 pm »
I know :P I was just kidding but you see what I meant (hopefully :P)
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Shifting Order
« Reply #11 on: April 11, 2010, 10:34:48 pm »
Player, if you're still around, could you change the code to address the fact that I used an AppVar?
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







_player1537

  • Guest
Re: Shifting Order
« Reply #12 on: April 11, 2010, 10:37:53 pm »
oh yeah, np, one sec working on that sort(a thing

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Shifting Order
« Reply #13 on: April 11, 2010, 11:05:59 pm »
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.

___Axe_Parser___
Today the calculator, tomorrow the world!

_player1537

  • Guest
Re: Shifting Order
« Reply #14 on: April 11, 2010, 11:08:44 pm »
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