playMaker

Author Topic: Compare multiple ints  (Read 779 times)

LogLady

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Compare multiple ints
« on: October 29, 2014, 12:49:32 PM »
Hello!

Who can I compare 4 differents ints and find what int has the greatest value and so on? Eg.:

Int1 = 4
Int2 = 3
Int3 = 5
Int4 = 1

Int3 > Int1 > Int2 > Int4

Edit: I forgot to mention that I'd like to sort the values ascending or descending (Int4 < Int2 < Int1 < Int3).

Any help is appreciated.
« Last Edit: October 29, 2014, 01:01:33 PM by LogLady »

escpodgames

  • Hero Member
  • *****
  • Posts: 673
    • View Profile
    • Assets
Re: Compare multiple ints
« Reply #1 on: October 29, 2014, 02:46:50 PM »
You would want to use array maker. Array maker will allow you to sort the list, get the total count, get the greatest and then remove it from the list so the next greatest is on top.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2288
    • View Profile
    • jinxtergames
Re: Compare multiple ints
« Reply #2 on: October 29, 2014, 05:43:01 PM »
do you know some good tutorial videos for array maker?

LogLady

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: Compare multiple ints
« Reply #3 on: November 07, 2014, 09:18:44 AM »
Thanks for you reply, LampRabbit!

I tried your suggestion but looks like ArrayList Sort only sort ascending values.
Then I tried ArrayList Get Max Value and looped it for the size of the list. Would it be the best way to go on ascending/descending sorting?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Compare multiple ints
« Reply #4 on: February 22, 2015, 11:10:45 PM »
Hi,

 Use ArrayReverse after you sorted and then you'll get descending sorting.

 Bye,

 Jean