Closed Thread
Results 1 to 4 of 4

Thread: ROBOT ASSEMBLY-- C language

  1. #1
    hummer350 is offline Newbie
    Join Date
    Jul 2008
    Posts
    1
    Rep Power
    0

    ROBOT ASSEMBLY-- C language

    An example might be as follows. We want to build a part number, 4789. Part number 4789 is composed of 3 items of part number 1567, part number 4567 (which is a sub assembly) and part number 6791. Part number 4567 requires the assembly of two items of part number 7864 and one item of 7814. In order to build part number 4789 we could fetch part numbers 1567, 6791, 7864, 7814 then assemble part numbers 7864 and 7814 into 4567 then assemble 1567, 6791, and 4567 into 4789.

    We have been asked to write the control software for a simple robot that will build assemblies. Fortunately for us, it is a very simple robot...it can only perform 4 operations:

    * OPERATOR CODE 1 : fetch n items of a specific part number and put them individually on a stack.
    * OPERATOR CODE 2 : assemble a part by retrieving (popping) the last n items off the stack and then placing the newly assembled item on the stack.
    * OPERATOR CODE 3 : perform a final assembly of all items and subassemblies in the stack.



    Detailed Description.
    Our robot will receive simplified input from a user using scanf() (i.e. scanf("%d%d%d",&var1,&var2,&var2) with no prompting and only perform the necessary stack operations with the input data with no extra messages except for the final result. We will only support 3 of the opcodes. Opcode 1 fetches n items of a partnumber and places them individually on a stack. Opcode 2 pops the last n items on the stack to create a new part and pushes the new part back on the stack. Opcode 3 simply prints out the part number of the final product and then every item in the stack separated by 1 space. Our robot can only handle 12 items in the stack at a time and if at any time this is exceeded, a single string "FAILURE" is printed using printf() and the program exits. Make certain you exit gracefully (don't just call exit() if you detect a stack overflow in a sub-function). A non-trivial penalty is assigned for any use of an exit() in your program.

    Special Note: All that a subassembly does is pop a certain number of items of the stack assemble them into another partnumber
    then push the new part number onto the stack in place of all the items that were popped. There is no need to validate that the items popped actually relate to the part number. Your primary concerns are that the subassembly doesn't cause a stack underflow.


    INPUT:

    Each instruction will be entered by a user in the format below with each item on an input line separated by a single space. In the special case of the final assembly a NOITEMS of -1 will be used, since all items in the stack must be assembled.

    <OPCODE> <PARTNUMBER> <NOITEMS>

    An example of the input to create part number 4789 is shown below.
    INPUT :

    1 1567 3
    1 7864 2
    1 7814 1
    2 4567 3
    1 6791 1
    3 4789 -1

    OUTPUT:

    In all cases, output will be a single line of text with no newlines or tabs. When the robot can successfully assemble the part, you will print out the final part number then the part number of each item on the stack starting from the top of the stack. An example for the input above is shown below.

    4789 6791 4567 1567 1567 1567

    Please note that there are 3 instances of 1567 and there are no instances or either 7864 or 7814. There are no instances of 7864 or 7814 because those were used to create sub-assembly 4567.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    bvaessen is offline Learning Programmer
    Join Date
    Jul 2008
    Location
    Limburg
    Posts
    30
    Rep Power
    14

    Re: ROBOT ASSEMBLY-- C language

    And the questions about this is ... ? Are you looking for professional manpower? In that case you could have a look at Launch-IT :: Home

  4. #3
    Join Date
    Jul 2006
    Posts
    16,475
    Blog Entries
    75
    Rep Power
    143

    Re: ROBOT ASSEMBLY-- C language

    My hunch is this is a homework assignment. No real description of a problem starts with "An example of this is..."
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  5. #4
    Join Date
    Oct 2007
    Location
    /dev/null
    Posts
    4,513
    Blog Entries
    8
    Rep Power
    59

    Re: ROBOT ASSEMBLY-- C language

    Well, encapsulate each of the parts in a class, use the std namespace so you can get stacks and stuff. At least try. Pseudocode? Something?

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Assembly Language Users
    By RhetoricalRuvim in forum The Lounge
    Replies: 2
    Last Post: 10-30-2011, 09:30 AM
  2. General Types of Assembly Language
    By Cory Duchesne in forum Assembly
    Replies: 13
    Last Post: 03-27-2010, 09:48 PM
  3. General Is Assembly language compiled?
    By DarkLordoftheMonkeys in forum Assembly
    Replies: 3
    Last Post: 12-28-2009, 07:13 AM
  4. Assembly Language
    By whoda in forum General Programming
    Replies: 1
    Last Post: 04-23-2009, 08:48 AM
  5. TASM help pls... assembly language
    By ishi in forum Assembly
    Replies: 2
    Last Post: 03-23-2009, 04:43 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts