Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

How can I simplify this?

Name: Anonymous 2007-10-24 22:46

def command_dsfgh
  if $var_ex[1] = nil
    print('shit happens')
    $scene = nil
  end
  elsif $var_ex[1] = 1
    $var_val[1] = + 0 #Pointless, eh?
    $scene = scene_window1.new
  end
  elsif $var_ex[1] = 2
    $var_val[1] = + 2
    $scene = scene_window1.new
  end
  elsif $var_ex[1] = 3
    $var_val = + 4
    $scene = scene_window1.new
  end
  elsif $var_ex[1] = 4
    $var_val = + 8
    $scene = scene_window1.new
  end
  elsif $var_ex[1] = 5
    $var_val = + 16
    $scene = scene_window1.new
etc...

Basically it's a=b+(2^c) and scene_window1 uses the value of "a" for something.

I'm not an EXPERT PROGRAMMER who has achieved Satori yet so I wouldn't know what to do in this type of situation. In before lol enjoy your toy language, Ruby on Fails, sage bomb, etc.

Name: Anonymous 2007-10-24 22:57

WHAT THE FUCK IS THIS SHIT.

Name: Anonymous 2007-10-24 22:58

>>2
I dunno, lol

Name: Anonymous 2007-10-24 23:12

good troll

Name: Anonymous 2007-10-24 23:43

enjoy your toy language

Name: Anonymous 2007-10-25 0:05

>>2
>>3
>>4
>>5
ITT people who are not capable of helping the OP because they're too stupid to know how.

Name: Anonymous 2007-10-25 0:54

>>6
YHBT, YHL. HAND.

Name: Anonymous 2007-10-25 1:51

>>7
YHBT, YHL. HAND.

Name: Anonymous 2007-10-25 2:33

Name: Anonymous 2007-10-25 5:33

You need to optimize this because Ruby is slow as fuck, right?

Name: Anonymous 2007-10-25 5:57

Hey, didn't Ruby have some kind of power operator for integral types?

Name: Anonymous 2007-10-25 7:22

I don't know Ruby, but I know you're a fucking moron.

def command_dsfgh
  if $var_ex[1] = nil
    print('shit happens')
    $scene = nil
  end
  else
    $var_val[1] = + (1 << $var_ex[1]-1)
    $scene = scene_window1.new
  end

Name: Anonymous 2007-10-25 7:25

>>12
yhbt

Name: Anonymous 2007-10-25 7:50

To whom does this programme belong?

Name: Anonymous 2007-10-25 9:35

>>13
Trolling is supposed to generate elaborate responses. This is horrible troll if it's supposed to be one.

Name: Anonymous 2007-10-25 11:16

>>15
YHBT YHL HAND

Name: Anonymous 2007-10-25 12:17

>>15
Trolling generates responses to things that are so obviously stupid that they don't deserve any response at all, elaborate or not.

Name: Anonymous 2007-10-25 12:23

>>17
NO EXCEPTIONS

Name: Anonymous 2007-10-25 12:42

>>18
Interesting point. Do you imply that you are trolling /prog by merely starting a stupid thread, since there are NO EXCEPTIONS and the troll will get replied to?

Name: Anonymous 2007-10-25 12:48

>>19
Woah, EXPERT.

Name: Anonymous 2007-10-25 19:39

>>19
Machine trolling

Name: Anonymous 2007-10-26 0:14

Name: Anonymous 2010-12-25 9:13

Name: Anonymous 2011-09-05 9:33

I remember making this thread.

I haven't gotten any better at programming since then, yet I still post on /prog/ everyday. Feels good man.

Name: Anonymous 2011-09-05 10:02

This is trivial to do in any language.

(defun command-dsfgh ()
  (symbol-macrolet ((v (aref *var-ex* 1)))
    (setf *scene*
          (cond
            (v (incf (aref *var-val* 1) (expt (1- v) 2))
             (scene-window1-new))
            (t (print "shit happens") nil)))))


Not that I approve of the copious use of globals.

Name: Anonymous 2011-09-05 12:57

Ruby on Fails
Enjoy your toy language
Gay language
Shit programmer

Name: Anonymous 2011-09-05 13:33

>>28
Please go back to whence you came from.

Name: Anonymous 2011-09-05 15:41

   $var_val[1] = + 0 #Pointless, eh?
+ 0? shouldn't be +1 ?

Anyway, something like this

# TODO: ENTERPRISE bounds check
$var_val[1] += [0, 2, 4, 8, 16][$var_ex[1] - 1]
$scene = scene_window1.new

Don't change these.
Name: Email:
Entire Thread Thread List