Author Topic: missing OxygenBasic.  (Read 3999 times)

0 Members and 2 Guests are viewing this topic.

Peter

  • Guest
missing OxygenBasic.
« on: June 18, 2012, 12:08:25 PM »
Deleted
« Last Edit: May 05, 2015, 09:25:56 AM by Peter »

Charles Pegge

  • Guest
Re: missing OxygenBasic.
« Reply #1 on: June 18, 2012, 12:16:53 PM »
Hi Peter,

I see there are 594 tasks! Are these like the Labours of Hercules, that have to be accomplished before gaining an entry?

Charles

kryton9

  • Guest
Re: missing OxygenBasic.
« Reply #2 on: June 18, 2012, 01:07:54 PM »
That is cool. I had stumbled on that site a few times, but never looked in depth. You don't have to do all the tasks.
Just in that they have sections of tasks and you can add your language to the ones over time that fit.

For example in the 3D task, there are only a few examples. OCaml second version looks neat and clean. TCL, I thought that was a scripting language? Sqlite3 has TCL examples also on their site so it must be popular too. Another language I never really looked at.

Charles Pegge

  • Guest
Re: missing OxygenBasic.
« Reply #3 on: June 19, 2012, 03:38:31 AM »

Charles Pegge

  • Guest
Re: missing OxygenBasic.
« Reply #4 on: June 19, 2012, 05:41:59 AM »
Not part of the fossil record I hope.


Charles Pegge

  • Guest
Rosetta Tasks: 100 doors
« Reply #5 on: June 19, 2012, 11:38:47 AM »
http://rosettacode.org/wiki/100_doors

Code: OxygenBasic
  1. def    doors 100
  2. int    door[doors],i ,j, c
  3. string cr,tab,pr
  4. '
  5. for i=1 to doors
  6.   for j=i to doors step i
  7.     door[j]=1-door[j]
  8.     if door[j] then c++ else c--
  9.   next
  10. next
  11. '
  12. cr=chr(13) chr(10)
  13. pr="Doors Open: " c cr cr
  14. '
  15. for i=1 to doors
  16.    if door[ i ] then pr+=i cr
  17. next
  18. print pr
  19.  

Charles

Charles Pegge

  • Guest
Resetta Code Tasks: 99 Bottles of Beer
« Reply #6 on: June 19, 2012, 12:32:33 PM »
http://rosettacode.org/wiki/99_Bottles_of_Beer

Code: OxygenBasic
  1. int    x=99
  2. string cr,tab,pr,bottles,bottlem,remain
  3. cr=chr(13) chr(10)
  4. tab=chr(9)
  5. pr="99 BOTTLES" cr cr
  6. bottles=" bottles "
  7. bottlem=" bottles "
  8. '
  9. for x=99 to 1 step -1
  10.   if x=1
  11.     bottles=" bottle "
  12.     bottlem=" bottles "
  13.     remain="No"
  14.   elseif x=2
  15.     bottlem=" bottle "
  16.     remain=x-1
  17.   else
  18.     remain=x-1
  19.   end if
  20.   pr+=
  21.   x bottles      "of beer on the wall" cr +
  22.   x bottles      "of beer" cr +
  23.                  "Take one down, pass it around" cr +
  24.   remain bottlem "of beer on the wall" cr +
  25.   cr
  26. next
  27. '
  28. putfile "t.txt",pr
  29.  

Charles

Charles Pegge

  • Guest
Rosetta Code Tasks: Abstract Type
« Reply #7 on: June 19, 2012, 02:22:13 PM »
 ;D

http://rosettacode.org/wiki/Abstract_type

Code: OxygenBasic
  1.  
  2. 'ABSTRACT TYPE
  3.  
  4. macro ContainerClass(name,body)
  5.   type name##Type body
  6.   class name
  7.   '
  8.  string buffer
  9.   '
  10.  method constructor(sys n=1)
  11.     buffer=nuls n*sizeof name##Type
  12.   end method
  13.   '
  14.  method destructor()
  15.     buffer=""
  16.   end method
  17.   '
  18.  method GetMembers(sys i,n) as name##Type
  19.     sys le=len buffer
  20.     sys en=(n+i)*sizeof name##type
  21.     if le<en
  22.       buffer+=nuls en-le 'auto expand
  23.    end if
  24.     return i+strptr buffer
  25.   end method
  26.   '
  27. end macro
  28.  
  29.  
  30. 'CREATE CLASS
  31.  
  32. ContainerClass Vector3dArray, {double x,y,z}
  33. '...
  34. end class
  35.  
  36.  
  37. 'CREATE OBJECT
  38.  
  39. new Vector3dArray v(100)
  40.  
  41.  
  42. 'OBTAIN POINTER AND FILL CHUNK
  43.  
  44. let pv=v.GetMembers(50,3) 'offset, quantity
  45. pv<=1,2,3, 10,20,30, 100,200,300
  46. '...
  47.  
  48. 'TEST
  49.  
  50. print pv[3].y
  51.  
  52. del v
  53.  
  54.  

Charles

Charles Pegge

  • Guest
Rosetta Code Tasks: Accumulator Factory
« Reply #8 on: June 19, 2012, 08:37:48 PM »

http://rosettacode.org/wiki/Accumulator_factory

Code: OxygenBasic
  1.  
  2. Class AccumFactory
  3. '=================
  4.  
  5.   double v
  6.  
  7.   method constructor()
  8.   end method
  9.  
  10.   method destructor()
  11.   end method
  12.  
  13.   method Accum(double n) as AccumFactory
  14.   new AccumFactory af
  15.   af.v=v+n
  16.   return af
  17.   end method
  18.  
  19.   method FloatValue() as double
  20.   return v
  21.   end method
  22.  
  23.   method IntValue() as sys
  24.   return v
  25.   end method
  26.  
  27.   method StringValue(sys dp=16) as string
  28.   return str v,dp
  29.   end method
  30.  
  31.  
  32. end class
  33.  
  34. '=======================
  35. 'TESTS (all results: PI)
  36. '=======================
  37.  
  38. new AccumFactory af
  39.  
  40. 'GENERATE ACCUMULATORS
  41.  
  42. let a=af.Accum(1)   'integer
  43. let b=a.Accum(pi)   'float
  44. let c=b.Accum("-1") 'string
  45.  
  46. 'STRING OUTPUT
  47.  
  48. print c.StringValue(4) ' show 4 decimal places
  49.  
  50. 'FLOAT OUTPUT
  51.  
  52. print c.FloatValue
  53.  
  54. 'USE FUNCTIONS IN EXPRESSION
  55.  
  56. print 10 * c.FloatValue() / ( 10 * a.IntValue() )
  57.  
  58. 'FINISH
  59.  
  60. del af : del a : del b : del c
  61.  
  62.  

Charles

Charles Pegge

  • Guest
Re: missing OxygenBasic.
« Reply #9 on: June 20, 2012, 12:51:07 AM »

The RosettaCode site is down. I hope my contributions, are not the cause  :o

Charles Pegge

  • Guest
Re: missing OxygenBasic.
« Reply #10 on: June 20, 2012, 01:32:11 AM »
Perhaps some of the accumulator factories escaped. They replicate themselves, you know.

kryton9

  • Guest
Re: missing OxygenBasic.
« Reply #11 on: June 20, 2012, 02:09:09 PM »
That's funny. I need to check this out when I can access an unsecured wireless with faster speed late at night.