playMaker

Author Topic: Compare multiple ints  (Read 2449 times)

LogLady

  • Full Member
  • ***
  • Posts: 150
Compare multiple ints
« on: October 29, 2014, 03: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, 04:01:33 PM by LogLady »

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Compare multiple ints
« Reply #1 on: October 29, 2014, 05: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: 7615
    • jinxtergames
Re: Compare multiple ints
« Reply #2 on: October 29, 2014, 08:43:01 PM »
do you know some good tutorial videos for array maker?

LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Compare multiple ints
« Reply #3 on: November 07, 2014, 11: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: 15500
  • Official Playmaker Support
Re: Compare multiple ints
« Reply #4 on: February 23, 2015, 01:10:45 AM »
Hi,

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

 Bye,

 Jean