Author Topic: from the lower to the higher  (Read 6773 times)

0 Members and 1 Guest are viewing this topic.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: from the lower to the higher
« Reply #15 on: June 17, 2013, 01:22:15 pm »
it displays the contesnts of temp which is a array (i guess)

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Hooloovoo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 225
  • Rating: +22/-0
    • View Profile
Re: from the lower to the higher
« Reply #16 on: June 17, 2013, 01:50:02 pm »
it displays the contesnts of temp which is a array (i guess)
It displays whatever is stored in temp
I was asking joao9856 what that displayed for him, I don't think it was clear enough. I am thinking that temp is not an array for some reason.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale." -tr1p1ea
Spoiler For some of the calcs I own:



(actually I have quite a few more than this, but I don't feel like making bars for them all.)

Offline joao9856

  • LV3 Member (Next: 100)
  • ***
  • Posts: 73
  • Rating: +3/-0
    • View Profile
Re: from the lower to the higher
« Reply #17 on: June 17, 2013, 01:57:39 pm »
my code is

Code: [Select]
randint(1,11)->e
randint(1,11)->ee
randint(1,50)->temp
randint(1,50)->nn
randint(1,50)->nnn
randint(1,50)->nnnn
randint(1,50)->nnnnn
disp e
disp ee
disp temp
disp nn
disp nnn
disp nnnn
disp nnnnn
SortA temp
n->temp[1]

Offline Hooloovoo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 225
  • Rating: +22/-0
    • View Profile
Re: from the lower to the higher
« Reply #18 on: June 17, 2013, 02:13:33 pm »
Code: [Select]
randint(1,50) makes one random number from 1 to 50. SortA works on a list, which is several numbers in an order. lists are denoted by curly braces, {} and the elements, or members of the list, are separated by commas.
I think what you want is something like this:
Code: [Select]
randint(1,11)->e
randint(1,11)->ee
randint(1,50)->eee
randint(1,50)->nn
randint(1,50)->nnn
randint(1,50)->nnnn
randint(1,50)->nnnnn
{e,ee,temp,nn,nnn,nnnn,nnnnn}->temp ;put all of the varibles into a list
disp temp
SortA temp
disp temp
which could be optimized to
Code: [Select]
randint(1,50,7)->temp     ;get 7 random numbers from 1 to 50 and store to temp
disp temp   ;display the initial state of temp
SortA temp
disp temp   ;display the end, sorted state of temp.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale." -tr1p1ea
Spoiler For some of the calcs I own:



(actually I have quite a few more than this, but I don't feel like making bars for them all.)

Offline joao9856

  • LV3 Member (Next: 100)
  • ***
  • Posts: 73
  • Rating: +3/-0
    • View Profile
Re: from the lower to the higher
« Reply #19 on: June 17, 2013, 02:15:23 pm »
thanks now i can complete my program

Offline imath

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: from the lower to the higher
« Reply #20 on: June 30, 2013, 12:46:00 am »
you can sort the list.
For example,
local a
randseed 100
a = rand(5)
sortA a
disp a

Offline imath

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 18
  • Rating: +0/-0
    • View Profile
Re: from the lower to the higher
« Reply #21 on: June 30, 2013, 12:47:17 am »
my code is

Code: [Select]
randint(1,11)->e
randint(1,11)->ee
randint(1,50)->temp
randint(1,50)->nn
randint(1,50)->nnn
randint(1,50)->nnnn
randint(1,50)->nnnnn
disp e
disp ee
disp temp
disp nn
disp nnn
disp nnnn
disp nnnnn
SortA temp
n->temp[1]
no,no this use
It's not only rebundant but also complex and ugly.