RE: A brief detour....;-)
So much printing ... no wonder we have a lot of dead trees now !!! wide grin Raj Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -Original Message- Sent: Tuesday, December 09, 2003 5:09 PM To: Multiple recipients of list ORACLE-L Back in the early 80's at school we had a towers of hanoi running in PL/1 On Nixdorf 8820, a teletype with matrix printer, printing out the full configuration after every move you made Regards, Carel-Jan ** This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you. **5 -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jamadagni, Rajendra INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: A brief detour....;-)
Good morning all: Well some good news, especially for April Wells. I could not find the TSO/CLIST version of the workshop (we removed it from the class and replaced it with another complicated workshop from the Data Structures and PL/I Exercise handbook), however, I think I found the PL/I version. I will have to wait until next week when our instructors are back from Europe and I will ping them. Jared: Given that we don't like attachments, any ideas on how to post this thing? Reply direct to me. Thank You Stephen P. Karniotis Technical Alliance Manager Compuware Corporation Direct: (313) 227-4350 Mobile: (248) 408-2918 Email: [EMAIL PROTECTED] Web:www.compuware.com -Original Message- Carel-Jan Engel Sent: Tuesday, December 09, 2003 5:09 PM To: Multiple recipients of list ORACLE-L Subject:RE: A brief detour;-) Back in the early 80's at school we had a towers of hanoi running in PL/1 On Nixdorf 8820, a teletype with matrix printer, printing out the full configuration after every move you made Regards, Carel-Jan -- There will always be another 10 last bugs -- At 07:24 9-12-03 -0800, you wrote: Hate to say this but you are a bit late. I had my students at University and here at Compuware create three to four different versions of the Tower's of Hanoi solution in PL/SQL. Used PL/SQL tables, stack processing, recursion (yes it can be done), and others. I also had (yep had - lost this) one for both PL/I and TSO/CLIST Dialog Manager VMS DCL. I actually created screens where you could dynamically choose the number of pegs and pieces. It also verified that you were putting smaller pieces on top of larger ones (one of the core rules for Tof H). Isn't programming great? Thank You Stephen P. Karniotis Technical Alliance Manager Compuware Corporation Direct: (313) 227-4350 Mobile: (248) 408-2918 Email: [EMAIL PROTECTED] Web:www.compuware.com -Original Message- Bobak, Mark Sent: Monday, December 08, 2003 4:19 PM To: Multiple recipients of list ORACLE-L Subject:A brief detour;-) So, I saw on SlashDot (http://www.slashdot.org/) a story about a guy who has over 100 different implementations of the Towers of Hanoi solution, each in a different language. Since he didn't have one in PL/SQL, I decided to write one. Here it is: create or replace package hanoi is from_peg constant number := 1; to_pegconstant number := 3; using_peg constant number := 2; procedure play(n number); end hanoi; / create or replace package body hanoi is procedure do_hanoi(n number, from_peg number, to_peg number, using_peg number) is begin if(n 0) then do_hanoi(n-1,from_peg, using_peg, to_peg); dbms_output.put_line('move '||from_peg||' -- '||to_peg); do_hanoi(n-1, using_peg, to_peg, from_peg); end if; end; procedure play(n number) is begin do_hanoi(n, from_peg, to_peg, using_peg); end; end; / This concludes this public service announcement. We now return you to our regularly scheduled programming. -Mark PS Yes, it's a slow day;-) -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Bobak, Mark INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Karniotis, Stephen INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Carel-Jan Engel INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services
RE: A brief detour....;-)
Apologies.. Carel-Jan -- There will allways be another 10 last bugs -- So much printing ... no wonder we have a lot of dead trees now !!! wide grin Raj Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -Original Message- Sent: Tuesday, December 09, 2003 5:09 PM To: Multiple recipients of list ORACLE-L Back in the early 80's at school we had a towers of hanoi running in PL/1 On Nixdorf 8820, a teletype with matrix printer, printing out the full configuration after every move you made Regards, Carel-Jan ** This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you. **5 -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jamadagni, Rajendra INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Carel-Jan Engel INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: A brief detour....;-)
I am just glad that so many on this read /. too ... that's my homepage ... on my Firebird browser. Raj Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -Original Message- Bobak, Mark Sent: Tuesday, December 09, 2003 12:54 AM To: Multiple recipients of list ORACLE-L Vladimir, Nice solution! I had first briefly considered a SQL solution, but it didn't immediately come to mind, and the PL/SQL recursive solution was pretty straightforward, so, I went that direction. I wasn't really too concerned about expense, in this case;-) I don't see too many practical applications. ;-) -Mark -Original Message- From: Vladimir Begun [mailto:[EMAIL PROTECTED] Sent: Mon 12/8/2003 8:19 PM To: Multiple recipients of list ORACLE-L Cc: Subject:Re: A brief detour;-) Bobak, Mark wrote: Here it is: [...] This concludes this public service announcement. We now return you to our regularly scheduled programming. Interesting. PL/SQL recursive solutions are expensive, though. :) Did not check it, maybe something alike was posted already... SET VERIFY OFF PAGES 200 DEFINE disks=7 REM Please do not use all_objects :) DEFINE big_table=all_objects COLUMN Implementation Plan FORMAT A20 SPOOL hanoi_solution.txt SELECT 'Move it from ' || TO_CHAR(MOD(BITAND(ROWNUM, ROWNUM - 1), 3) + 1) || ' to ' || TO_CHAR(MOD(-BITAND(-ROWNUM - 1, -ROWNUM), 3) + 1) AS Implementation Plan FROM big_table WHERE ROWNUM POWER(2, disks) AND disks 8 / SPOOL OFF Should work correctly. Regards, -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). ** This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you. **5 -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jamadagni, Rajendra INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: A brief detour....;-)
Hate to say this but you are a bit late. I had my students at University and here at Compuware create three to four different versions of the Tower's of Hanoi solution in PL/SQL. Used PL/SQL tables, stack processing, recursion (yes it can be done), and others. I also had (yep had - lost this) one for both PL/I and TSO/CLIST Dialog Manager VMS DCL. I actually created screens where you could dynamically choose the number of pegs and pieces. It also verified that you were putting smaller pieces on top of larger ones (one of the core rules for Tof H). Isn't programming great? Thank You Stephen P. Karniotis Technical Alliance Manager Compuware Corporation Direct: (313) 227-4350 Mobile: (248) 408-2918 Email: [EMAIL PROTECTED] Web:www.compuware.com -Original Message- Bobak, Mark Sent: Monday, December 08, 2003 4:19 PM To: Multiple recipients of list ORACLE-L Subject:A brief detour;-) So, I saw on SlashDot (http://www.slashdot.org/) a story about a guy who has over 100 different implementations of the Towers of Hanoi solution, each in a different language. Since he didn't have one in PL/SQL, I decided to write one. Here it is: create or replace package hanoi is from_peg constant number := 1; to_pegconstant number := 3; using_peg constant number := 2; procedure play(n number); end hanoi; / create or replace package body hanoi is procedure do_hanoi(n number, from_peg number, to_peg number, using_peg number) is begin if(n 0) then do_hanoi(n-1,from_peg, using_peg, to_peg); dbms_output.put_line('move '||from_peg||' -- '||to_peg); do_hanoi(n-1, using_peg, to_peg, from_peg); end if; end; procedure play(n number) is begin do_hanoi(n, from_peg, to_peg, using_peg); end; end; / This concludes this public service announcement. We now return you to our regularly scheduled programming. -Mark PS Yes, it's a slow day;-) -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Bobak, Mark INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Karniotis, Stephen INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: A brief detour....;-)
Is there any for windows command shell? :) Tanel. - Original Message - To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 5:24 PM Hate to say this but you are a bit late. I had my students at University and here at Compuware create three to four different versions of the Tower's of Hanoi solution in PL/SQL. Used PL/SQL tables, stack processing, recursion (yes it can be done), and others. I also had (yep had - lost this) one for both PL/I and TSO/CLIST Dialog Manager VMS DCL. I actually created screens where you could dynamically choose the number of pegs and pieces. It also verified that you were putting smaller pieces on top of larger ones (one of the core rules for Tof H). Isn't programming great? Thank You Stephen P. Karniotis Technical Alliance Manager Compuware Corporation Direct: (313) 227-4350 Mobile: (248) 408-2918 Email: [EMAIL PROTECTED] Web: www.compuware.com -Original Message- Bobak, Mark Sent: Monday, December 08, 2003 4:19 PM To: Multiple recipients of list ORACLE-L Subject: A brief detour;-) So, I saw on SlashDot (http://www.slashdot.org/) a story about a guy who has over 100 different implementations of the Towers of Hanoi solution, each in a different language. Since he didn't have one in PL/SQL, I decided to write one. Here it is: create or replace package hanoi is from_peg constant number := 1; to_pegconstant number := 3; using_peg constant number := 2; procedure play(n number); end hanoi; / create or replace package body hanoi is procedure do_hanoi(n number, from_peg number, to_peg number, using_peg number) is begin if(n 0) then do_hanoi(n-1,from_peg, using_peg, to_peg); dbms_output.put_line('move '||from_peg||' -- '||to_peg); do_hanoi(n-1, using_peg, to_peg, from_peg); end if; end; procedure play(n number) is begin do_hanoi(n, from_peg, to_peg, using_peg); end; end; / This concludes this public service announcement. We now return you to our regularly scheduled programming. -Mark PS Yes, it's a slow day;-) -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Bobak, Mark INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Karniotis, Stephen INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Tanel Poder INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: A brief detour....;-)
You are bringing up old memories. I had both PL/1 and assembler (IBM mainframe) in the early 70's. Yechiel Adar Mehish - Original Message - To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 5:24 PM Hate to say this but you are a bit late. I had my students at University and here at Compuware create three to four different versions of the Tower's of Hanoi solution in PL/SQL. Used PL/SQL tables, stack processing, recursion (yes it can be done), and others. I also had (yep had - lost this) one for both PL/I and TSO/CLIST Dialog Manager VMS DCL. I actually created screens where you could dynamically choose the number of pegs and pieces. It also verified that you were putting smaller pieces on top of larger ones (one of the core rules for Tof H). Isn't programming great? Thank You Stephen P. Karniotis Technical Alliance Manager Compuware Corporation Direct: (313) 227-4350 Mobile: (248) 408-2918 Email: [EMAIL PROTECTED] Web: www.compuware.com -Original Message- Bobak, Mark Sent: Monday, December 08, 2003 4:19 PM To: Multiple recipients of list ORACLE-L Subject: A brief detour;-) So, I saw on SlashDot (http://www.slashdot.org/) a story about a guy who has over 100 different implementations of the Towers of Hanoi solution, each in a different language. Since he didn't have one in PL/SQL, I decided to write one. Here it is: create or replace package hanoi is from_peg constant number := 1; to_pegconstant number := 3; using_peg constant number := 2; procedure play(n number); end hanoi; / create or replace package body hanoi is procedure do_hanoi(n number, from_peg number, to_peg number, using_peg number) is begin if(n 0) then do_hanoi(n-1,from_peg, using_peg, to_peg); dbms_output.put_line('move '||from_peg||' -- '||to_peg); do_hanoi(n-1, using_peg, to_peg, from_peg); end if; end; procedure play(n number) is begin do_hanoi(n, from_peg, to_peg, using_peg); end; end; / This concludes this public service announcement. We now return you to our regularly scheduled programming. -Mark PS Yes, it's a slow day;-) -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Bobak, Mark INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Karniotis, Stephen INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Yechiel Adar INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: A brief detour....;-)
I used to have a macro for VI but have lost it. Raj Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -Original Message- Sent: Tuesday, December 09, 2003 10:25 AM To: Multiple recipients of list ORACLE-L Hate to say this but you are a bit late. I had my students at University and here at Compuware create three to four different versions of the Tower's of Hanoi solution in PL/SQL. Used PL/SQL tables, stack processing, recursion (yes it can be done), and others. I also had (yep had - lost this) one for both PL/I and TSO/CLIST Dialog Manager VMS DCL. I actually created screens where you could dynamically choose the number of pegs and pieces. It also verified that you were putting smaller pieces on top of larger ones (one of the core rules for Tof H). Isn't programming great? ** This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you. **4 -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jamadagni, Rajendra INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: A brief detour....;-)
Bobak, Mark wrote: Nice solution! I had first briefly considered a SQL solution, but it didn't I like simple ones. immediately come to mind, and the PL/SQL recursive solution was pretty straightforward, so, I went that direction. I wasn't really too concerned about expense, in this case;-) I don't see too many practical applications. ;-) I did not want to discuss this particular case. It's a good one. Good as an example. There was/is a practical application of recursive solution ( 9i) -- check standard.replace which is not so nice if it's heavily used. regards, -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: A brief detour....;-)
My memories of PL/1 are more unusual - I programmed a pre-CPM Z80 based machine in its own dialect of PL/1 in the late 70s early 80s. -Original Message- Sent: Tuesday, December 09, 2003 10:49 AM To: Multiple recipients of list ORACLE-L You are bringing up old memories. I had both PL/1 and assembler (IBM mainframe) in the early 70's. Yechiel Adar Mehish -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: John Flack INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: A brief detour....;-)
Back in the early 80's at school we had a towers of hanoi running in PL/1 On Nixdorf 8820, a teletype with matrix printer, printing out the full configuration after every move you made Regards, Carel-Jan -- There will always be another 10 last bugs -- At 07:24 9-12-03 -0800, you wrote: Hate to say this but you are a bit late. I had my students at University and here at Compuware create three to four different versions of the Tower's of Hanoi solution in PL/SQL. Used PL/SQL tables, stack processing, recursion (yes it can be done), and others. I also had (yep had - lost this) one for both PL/I and TSO/CLIST Dialog Manager VMS DCL. I actually created screens where you could dynamically choose the number of pegs and pieces. It also verified that you were putting smaller pieces on top of larger ones (one of the core rules for Tof H). Isn't programming great? Thank You Stephen P. Karniotis Technical Alliance Manager Compuware Corporation Direct: (313) 227-4350 Mobile: (248) 408-2918 Email: [EMAIL PROTECTED] Web:www.compuware.com -Original Message- Bobak, Mark Sent: Monday, December 08, 2003 4:19 PM To: Multiple recipients of list ORACLE-L Subject:A brief detour;-) So, I saw on SlashDot (http://www.slashdot.org/) a story about a guy who has over 100 different implementations of the Towers of Hanoi solution, each in a different language. Since he didn't have one in PL/SQL, I decided to write one. Here it is: create or replace package hanoi is from_peg constant number := 1; to_pegconstant number := 3; using_peg constant number := 2; procedure play(n number); end hanoi; / create or replace package body hanoi is procedure do_hanoi(n number, from_peg number, to_peg number, using_peg number) is begin if(n 0) then do_hanoi(n-1,from_peg, using_peg, to_peg); dbms_output.put_line('move '||from_peg||' -- '||to_peg); do_hanoi(n-1, using_peg, to_peg, from_peg); end if; end; procedure play(n number) is begin do_hanoi(n, from_peg, to_peg, using_peg); end; end; / This concludes this public service announcement. We now return you to our regularly scheduled programming. -Mark PS Yes, it's a slow day;-) -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Bobak, Mark INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Karniotis, Stephen INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Carel-Jan Engel INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
A brief detour....;-)
So, I saw on SlashDot (http://www.slashdot.org/) a story about a guy who has over 100 different implementations of the Towers of Hanoi solution, each in a different language. Since he didn't have one in PL/SQL, I decided to write one. Here it is: create or replace package hanoi is from_peg constant number := 1; to_pegconstant number := 3; using_peg constant number := 2; procedure play(n number); end hanoi; / create or replace package body hanoi is procedure do_hanoi(n number, from_peg number, to_peg number, using_peg number) is begin if(n 0) then do_hanoi(n-1,from_peg, using_peg, to_peg); dbms_output.put_line('move '||from_peg||' -- '||to_peg); do_hanoi(n-1, using_peg, to_peg, from_peg); end if; end; procedure play(n number) is begin do_hanoi(n, from_peg, to_peg, using_peg); end; end; / This concludes this public service announcement. We now return you to our regularly scheduled programming. -Mark PS Yes, it's a slow day;-) -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Bobak, Mark INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: A brief detour....;-)
Monday, December 8, 2003, 4:19:27 PM, Bobak, Mark ([EMAIL PROTECTED]) wrote: BM So, I saw on SlashDot (http://www.slashdot.org/) a story BM about a guy who has over 100 different implementations BM of the Towers of Hanoi solution, each in a different BM language. Since he didn't have one in PL/SQL, Aw, PL/SQL never gets no respect. BM I decided to write one. Cool! I hope you posted the PL/SQL solution on Slashdot too. Best regards, Jonathan Gennick --- Brighten the corner where you are http://Gennick.com * 906.387.1698 * mailto:[EMAIL PROTECTED] Join the Oracle-article list and receive one article on Oracle technologies per month by email. To join, visit http://four.pairlist.net/mailman/listinfo/oracle-article, or send email to [EMAIL PROTECTED] and include the word subscribe in either the subject or body. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jonathan Gennick INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: A brief detour....;-)
Bobak, Mark wrote: Here it is: [...] This concludes this public service announcement. We now return you to our regularly scheduled programming. Interesting. PL/SQL recursive solutions are expensive, though. :) Did not check it, maybe something alike was posted already... SET VERIFY OFF PAGES 200 DEFINE disks=7 REM Please do not use all_objects :) DEFINE big_table=all_objects COLUMN Implementation Plan FORMAT A20 SPOOL hanoi_solution.txt SELECT 'Move it from ' || TO_CHAR(MOD(BITAND(ROWNUM, ROWNUM - 1), 3) + 1) || ' to ' || TO_CHAR(MOD(-BITAND(-ROWNUM - 1, -ROWNUM), 3) + 1) AS Implementation Plan FROM big_table WHERE ROWNUM POWER(2, disks) AND disks 8 / SPOOL OFF Should work correctly. Regards, -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: A brief detour....;-)
Vladimir, Nice solution! I had first briefly considered a SQL solution, but it didn't immediately come to mind, and the PL/SQL recursive solution was pretty straightforward, so, I went that direction. I wasn't really too concerned about expense, in this case;-) I don't see too many practical applications. ;-) -Mark -Original Message- From: Vladimir Begun [mailto:[EMAIL PROTECTED] Sent: Mon 12/8/2003 8:19 PM To: Multiple recipients of list ORACLE-L Cc: Subject:Re: A brief detour;-) Bobak, Mark wrote: Here it is: [...] This concludes this public service announcement. We now return you to our regularly scheduled programming. Interesting. PL/SQL recursive solutions are expensive, though. :) Did not check it, maybe something alike was posted already... SET VERIFY OFF PAGES 200 DEFINE disks=7 REM Please do not use all_objects :) DEFINE big_table=all_objects COLUMN Implementation Plan FORMAT A20 SPOOL hanoi_solution.txt SELECT 'Move it from ' || TO_CHAR(MOD(BITAND(ROWNUM, ROWNUM - 1), 3) + 1) || ' to ' || TO_CHAR(MOD(-BITAND(-ROWNUM - 1, -ROWNUM), 3) + 1) AS Implementation Plan FROM big_table WHERE ROWNUM POWER(2, disks) AND disks 8 / SPOOL OFF Should work correctly. Regards, -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). winmail.dat