Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: My robot  (Read 4507 times)

Pnx

  • Bay Watcher
    • View Profile
My robot
« on: July 19, 2007, 09:03:00 am »

I've been taking a robotics course where I use an iRobot create and program it. Heres a sample of my most recent code for all you code monkeys out there.

code:

   while(destructionofmankind<complete)
   {

   if((robot_army<(humanity*1.2)
   {
      construct(killing_machine);
   }

   else
   {
      kill(people);
   }
   
   }

   if(humanity==0)
   {
   start(constructionofutopia);
   }

   if(utopia==complete)
   {
      rejoice(1);
      construct(perfectsociety);
      play(289);
      start(wars);
   }

   while(war<complete)
   {

   if(robot_army<(enemy_robot_army*0.8))
   {
   construct(giant_killing_machine);
   }

   if(enemyrobot>0)
   {
      kill(enemy_robot);
   }

   }

   selfdestruct(1);


[ July 19, 2007: Message edited by: Pnx ]

Logged

Jeon

  • Bay Watcher
    • View Profile
Re: My robot
« Reply #1 on: July 19, 2007, 12:52:00 pm »

My humanity was destroyed by the lack of whitespace, not the robot army.
Logged

Pnx

  • Bay Watcher
    • View Profile
Re: My robot
« Reply #2 on: July 19, 2007, 03:42:00 pm »

Hmmm I spaced it out but it doesn't seem to register tabs.
Logged

Jeon

  • Bay Watcher
    • View Profile
Re: My robot
« Reply #3 on: July 19, 2007, 04:18:00 pm »

Ya... forums can make quite a mess out of formatting, try using code tags when you want something to come out not quite as mutilated by the hybrid HTML/BB formatting.
Logged

Jeon

  • Bay Watcher
    • View Profile
Re: My robot
« Reply #4 on: July 19, 2007, 04:21:00 pm »

quote:
Originally posted by Pnx:
<STRONG>
code:
  

   while(destructionofmankind<complete)
   {

   if((robot_army<(humanity*1.2)
   {
      construct(killing_machine);
   }

   else
   {
      kill(people);
   }
   
   }

   if(humanity==0)
   {
   start(constructionofutopia);
   }

   if(utopia==complete)
   {
      rejoice(1);
      construct(perfectsociety);
      play(289);
      start(wars);
   }

   while(war<complete)
   {

   if(robot_army<(enemy_robot_army*0.8))
   {
   construct(giant_killing_machine);
   }

   if(enemyrobot>0)
   {
      kill(enemy_robot);
   }

   }

   selfdestruct(1);


</STRONG>


See, your tabs are still there, but the formatting of the page could care less!

Edit: Well... mostly there... the page formatting is still being dumb!

[ July 19, 2007: Message edited by: Jeon ]

Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: My robot
« Reply #5 on: July 19, 2007, 04:32:00 pm »

use 4 spaces. and if you have to, start each line with a .
Logged
Eh?
Eh!

Pnx

  • Bay Watcher
    • View Profile
Re: My robot
« Reply #6 on: July 19, 2007, 04:37:00 pm »

Why is it I always forget about the code tags?

Ahh well in any case it was fun when I made all those functions and definitions so that I could get it to do stuff with it while writing commands like these.
But in any case the kill command is a replacement drive, construct is turn, rejoice makes it spin in the number of circles specified and play makes it play a note. Start just changes a variable but the rest is all just doing some weird math, most of it just does nothing but some of it does some stuff.

Logged

Capntastic

  • Bay Watcher
  • Greetings, mortals!
    • View Profile
    • A review and literature weblog I never update
Re: My robot
« Reply #7 on: July 22, 2007, 03:17:00 am »

A lot of those variables and functions are undefined!
Logged

Aquillion

  • Bay Watcher
    • View Profile
Re: My robot
« Reply #8 on: July 31, 2007, 10:59:00 pm »

You never set destructionofmankind to complete, so the first "while" loop will never terminate.
Logged
We don't want another cheap fantasy universe, we want a cheap fantasy universe generator. --Toady One

Jeon

  • Bay Watcher
    • View Profile
Re: My robot
« Reply #9 on: August 01, 2007, 10:52:00 am »

I'm pretty sure kill(people) usually furthers the destructionofmankind.
Logged

Aquillion

  • Bay Watcher
    • View Profile
Re: My robot
« Reply #10 on: August 02, 2007, 02:40:00 pm »

Why would it?  I would assume it would do the exact opposite.

Consider:

What do 'people' do?  Well, that's simple.  People are wiping themselves out--through wars, pollution, nuclear proliferation, and so on.  Any way you look at it, the thread 'people' advances 'destructionofmankind.'  Therefore, kill(people) is, if anything, preventing destructionofmankind from incrementing...  the system is stuck in an infinite loop.

Logged
We don't want another cheap fantasy universe, we want a cheap fantasy universe generator. --Toady One

BDR

  • Bay Watcher
    • View Profile
Re: My robot
« Reply #11 on: August 17, 2007, 03:32:00 pm »

Ah, but I have a solution: individual 'person(s)' do not, however, contribute to the destruction of mankind.  In fact, most 'person(s)' either support the maintenance of the (admittely broken) system or, in some cases, actually try to improve it!  So all you have to do is put kill(person) there instead, and the destructionofmankind will actually be increased.  :p
Logged
A HREF="http://www.bay12games.com/cgi-local/ultimatebb.cgi?ubb=get_topic&f=12&t=000218">A Kobold''s Quest

A Kobold''s Quest II

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: My robot
« Reply #12 on: August 28, 2007, 07:21:00 am »

But wars polution and all that would take decades while a robot invasion may take less than a month to destroy mankind.
Logged
Eh?
Eh!