How to resolve the algorithm Discordian date step by step in the BBC BASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Discordian date step by step in the BBC BASIC programming language

Table of Contents

Problem Statement

Convert a given date from the   Gregorian calendar   to the   Discordian calendar.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Discordian date step by step in the BBC BASIC programming language

Source code in the bbc programming language

      INSTALL @lib$+"DATELIB"
      
      PRINT "01/01/2011 -> " FNdiscordian("01/01/2011")
      PRINT "05/01/2011 -> " FNdiscordian("05/01/2011")
      PRINT "28/02/2011 -> " FNdiscordian("28/02/2011")
      PRINT "01/03/2011 -> " FNdiscordian("01/03/2011")
      PRINT "22/07/2011 -> " FNdiscordian("22/07/2011")
      PRINT "31/12/2011 -> " FNdiscordian("31/12/2011")
      
      PRINT "01/01/2012 -> " FNdiscordian("01/01/2012")
      PRINT "05/01/2012 -> " FNdiscordian("05/01/2012")
      PRINT "28/02/2012 -> " FNdiscordian("28/02/2012")
      PRINT "29/02/2012 -> " FNdiscordian("29/02/2012")
      PRINT "01/03/2012 -> " FNdiscordian("01/03/2012")
      PRINT "22/07/2012 -> " FNdiscordian("22/07/2012")
      PRINT "31/12/2012 -> " FNdiscordian("31/12/2012")
      END
      
      DEF FNdiscordian(date$)
      LOCAL Season$(), Weekday$(), mjd%, year%, day%
      DIM Season$(4), Weekday$(4)
      Season$() =  "Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath"
      Weekday$() = "Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange"
      
      mjd% = FN_readdate(date$, "dmy", 2000)
      year% = FN_year(mjd%)
      
      IF FN_month(mjd%)=2 AND FN_day(mjd%)=29 THEN
        = "St. Tib's Day, YOLD " + STR$(year% + 1166)
      ENDIF
      
      IF FN_month(mjd%) < 3 THEN
        day% = mjd% - FN_mjd(1, 1, year%)
      ELSE
        day% = mjd% - FN_mjd(1, 3, year%) + 59
      ENDIF
      = Weekday$(day% MOD 5) + ", " + STR$(day% MOD 73 + 1) + " " + \
      \ Season$(day% DIV 73) + ", YOLD " + STR$(year% + 1166)


  

You may also check:How to resolve the algorithm Forward difference step by step in the Elixir programming language
You may also check:How to resolve the algorithm Image convolution step by step in the C programming language
You may also check:How to resolve the algorithm Formatted numeric output step by step in the Ada programming language
You may also check:How to resolve the algorithm Runtime evaluation/In an environment step by step in the Scheme programming language
You may also check:How to resolve the algorithm Hash join step by step in the Groovy programming language