home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.ai.philosophy      Perhaps we should ask SkyNet about this      59,235 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 58,009 of 59,235   
   olcott to Olcott   
   Halting problem proof converted to Liar    
   09 Oct 25 10:33:40   
   
   XPost: comp.theory, comp.lang.c++, comp.lang.c   
   From: polcott333@gmail.com   
      
   // The pseudo code shown below has been converted   
   // to C compiled as C++   
   // the pseudo code is easier to read.   
   // the C code is fully operational.   
      
   /***   
   As I first published here back in 2004:   
   On 6/23/2004 9:34 PM, Olcott wrote:   
    >   
    > function LoopIfYouSayItHalts (bool YouSayItHalts):   
    >     if YouSayItHalts () then   
    >         while true do {}   
    >      else   
    >         return false;   
    >   
    > Does this program Halt?   
    >   
    > (Your (YES or NO) answer is to be considered   
    >   translated to Boolean as the function's input   
    >   parameter)   
    >   
    > Please ONLY PROVIDE CORRECT ANSWERS!   
   ***/   
      
   #include    
   #include    
      
   void LoopIfYouSayItHalts(bool YouSayItHalts)   
   {   
      if (YouSayItHalts)   
        while(true)   
          ;   
      else   
        return;   
   }   
      
   void OutputProgram()   
   {   
      printf("\n\n\nvoid LoopIfYouSayItHalts "   
             "(bool YouSayItHalts)\n");   
      printf("{\n");   
      printf("  if (YouSayItHalts)\n");   
      printf("    while(true)\n");   
      printf("      ;\n");   
      printf("  else\n");   
      printf("    return;\n");   
      printf("}\n\n\n");   
   }   
      
   void Prompt()   
   {   
     char choice = 'x';   
     printf("Does this program Halt?\n");   
     printf("(Y or N) translated to Boolean argument"   
            " to LoopIfYouSayItHalts()\n");   
     printf("\nPlease ONLY PROVIDE CORRECT (Y or N) ANSWERS!\n");   
     while (choice != 'Y'&& choice != 'y' &&   
            choice != 'N' && choice != 'n')   
     {   
       choice = getch();   
       if (choice != 'Y'&& choice != 'y' &&   
           choice != 'N' && choice != 'n')   
         printf("Must be (Y or N)\n");   
     }   
      
     if (choice == 'Y' || choice == 'y')   
     {   
       printf("\nWrong Answer!\n"   
              "LoopIfYouSayItHalts(true) is stuck in a loop!\n\n");   
       LoopIfYouSayItHalts(true);   
     }   
     if (choice == 'N' || choice == 'n')   
     {   
       printf("\nWrong Answer!\n"   
              "LoopIfYouSayItHalts(false) halts now!\n\n");   
       LoopIfYouSayItHalts(false);   
     }   
   }   
      
      
   int main()   
   {   
      OutputProgram();   
      Prompt();   
      return 0;   
   }   
      
      
   --   
   Copyright 2025 Olcott "Talent hits a target no one else can hit; Genius   
   hits a target no one else can see." Arthur Schopenhauer   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca