solutions
listlengths
2
791
task_name
stringlengths
2
86
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Percolation/Mean_cluster_density\nnote: Percolation Simulations\n", "language": "00-META" }, { "code": "{{Percolation Simulation}}\nLet <math>c</math> be a 2D boolean square matrix of <math>n \\times n</math> values of either <tt>1</tt> or <tt>0</tt>...
Percolation-Mean-cluster-density
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Percolation/Mean_run_density\nnote: Percolation Simulations\n", "language": "00-META" }, { "code": "{{Percolation Simulation}}\nLet <math>v</math> be a vector of <math>n</math> values of either <tt>1</tt> or <tt>0</tt> where the probability of any \n...
Percolation-Mean-run-density
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Perfect_numbers\n", "language": "00-META" }, { "code": "[[category:Discrete math]]\n{{task|Prime Numbers}}\n\nWrite a function which says whether a number is perfect.\n\n<br>\n[[wp:Perfect_numbers|A perfect number]] is a positive integer that is the ...
Perfect-numbers
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Perfect_shuffle\n", "language": "00-META" }, { "code": "A perfect shuffle (or [https://en.wikipedia.org/wiki/Faro_shuffle faro/weave shuffle]) means splitting a deck of cards into equal halves, and perfectly interleaving them - so that you end up wit...
Perfect-shuffle
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Perfect_totient_numbers\n", "language": "00-META" }, { "code": "Generate and show here, the first twenty [https://en.wikipedia.org/wiki/Perfect_totient_number Perfect totient numbers].\n\n\n;Related task:\n::* &nbsp; [[Totient function]]\n\n\n;Also s...
Perfect-totient-numbers
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Peripheral_drift_illusion\n", "language": "00-META" }, { "code": ";Task\nGenerate and display a Peripheral Drift Illusion\n\nThe image appears to be moving even though it is perfectly static.\n\nProvide a link to show the output, either by running th...
Peripheral-drift-illusion
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Perlin_noise\n", "language": "00-META" }, { "code": "The '''[[wp:Perlin noise|Perlin noise]]''' is a kind of [[wp:gradient noise|gradient noise]] invented by [[wp:Ken Perlin|Ken Perlin]] around the end of the twentieth century and still currently hea...
Perlin-noise
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Permutation_test\nnote: Probability and statistics\n", "language": "00-META" }, { "code": "A new medical treatment was tested on a population of <math>n + m</math>\nvolunteers, with each volunteer randomly assigned either to a group of\n<math>n</math...
Permutation-test
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Permutations_by_swapping\n", "language": "00-META" }, { "code": ";Task:\nGenerate permutations of n items in which successive permutations differ from each other by the swapping of any two items. \n\nAlso generate the sign of the permutation which is...
Permutations-by-swapping
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Permutations/Derangements\n", "language": "00-META" }, { "code": "A [http://mathworld.wolfram.com/Derangement.html derangement] is a permutation of the order of distinct items in which ''no item appears in its original place''.\n\nFor example, the on...
Permutations-Derangements
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Permutations/Rank_of_a_permutation\n", "language": "00-META" }, { "code": "A particular ranking of a permutation associates an integer with a particular ordering of all the permutations of a set of distinct items. \nFor our purposes the ranking will ...
Permutations-Rank-of-a-permutation
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Phrase_reversals\n", "language": "00-META" }, { "code": ";Task:\nGiven a string of space separated words containing the following phrase:\n rosetta code phrase reversal\n\n:# Reverse the characters of the string.\n:# Reverse the characters of each i...
Phrase-reversals
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pi\nnote: Irrational numbers\n", "language": "00-META" }, { "code": "Create a program to continually calculate and output the next decimal digit of &nbsp; <big><big><math>\\pi</math></big></big> &nbsp; (pi). \n\nThe program should continue forever (u...
Pi
[ { "code": "---\ncategory:\n- Randomness\nfrom: http://rosettacode.org/wiki/Pick_random_element\nnote: Basic language learning\n", "language": "00-META" }, { "code": "Demonstrate how to pick a random element from a list.\n<br><br>\n\n", "language": "00-TASK" }, { "code": "print(random:cho...
Pick-random-element
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pig_the_dice_game\n", "language": "00-META" }, { "code": "The &nbsp; [[wp:Pig (dice)|game of Pig]] &nbsp; is a multiplayer game played with a single six-sided die. &nbsp; The\nobject of the game is to reach &nbsp; '''100''' &nbsp; points or more. &nb...
Pig-the-dice-game
[ { "code": "---\ncategory:\n- Games\nfrom: http://rosettacode.org/wiki/Pig_the_dice_game/Player\n", "language": "00-META" }, { "code": ";Task:\nCreate a dice simulator and scorer of [[Pig the dice game]] and add to it the ability to play the game to at least one strategy.\n* State here the play strat...
Pig-the-dice-game-Player
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pinstripe/Display\nnote: Test card\n", "language": "00-META" }, { "code": "The task is to demonstrate the creation of a series of vertical pinstripes across '''the entire width of the display'''. \n* in the first quarter the pinstripes should alterna...
Pinstripe-Display
[ { "code": "---\ncategory:\n- Mathematics\nfrom: http://rosettacode.org/wiki/Pisano_period\nnote: Prime Numbers\n", "language": "00-META" }, { "code": "The [[wp:Fibonacci_Number|Fibonacci sequence]] taken modulo 2 is a periodic sequence of period 3 : 0, 1, 1, 0, 1, 1, ... \n\nFor any integer n, the F...
Pisano-period
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Plasma_effect\n", "language": "00-META" }, { "code": "The [[wp:Plasma_effect|plasma effect]] is a visual effect created by applying various functions, notably sine and cosine, to the color values of screen pixels. When animated (not a task requiremen...
Plasma-effect
[ { "code": "---\ncategory:\n- Games\nfrom: http://rosettacode.org/wiki/Play_recorded_sounds\nnote: Temporal media\nrequires:\n- Sound\n", "language": "00-META" }, { "code": "Load at least two prerecorded sounds, and demonstrate as many of these features as you can:\n* playing them individually and si...
Play-recorded-sounds
[ { "code": "---\ncategory:\n- Cards\nfrom: http://rosettacode.org/wiki/Playing_cards\nnote: Games\n", "language": "00-META" }, { "code": ";Task:\nCreate a data structure and the associated methods to define and manipulate a deck of &nbsp; [[wp:Playing-cards#Anglo-American-French|playing cards]]. \n\n...
Playing-cards
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Plot_coordinate_pairs\n", "language": "00-META" }, { "code": ";Task:\nPlot a function represented as &nbsp;&nbsp; <big><big> x,&nbsp; y </big></big> &nbsp;&nbsp; numerical arrays.\n\nPost the resulting image for the following input arrays (taken from...
Plot-coordinate-pairs
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pointers_and_references\nnote: Basic Data Operations\n", "language": "00-META" }, { "code": "{{basic data operation}}In this task, the goal is to demonstrate common operations on pointers and references. These examples show pointer operations on the ...
Pointers-and-references
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Polymorphic_copy\nnote: Object oriented\n", "language": "00-META" }, { "code": "An object is [[polymorphism|polymorphic]] when its specific type may vary. \nThe types a specific value may take, is called ''class''.\n\nIt is trivial to copy an object ...
Polymorphic-copy
[ { "code": "---\ncategory:\n- Object oriented\nfrom: http://rosettacode.org/wiki/Polymorphism\nnote: Basic language learning\n", "language": "00-META" }, { "code": ";Task:\nCreate two classes &nbsp; Point(x,y) &nbsp; and &nbsp; Circle(x,y,r) &nbsp; with a polymorphic function print, accessors for (x,...
Polymorphism
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Polynomial_long_division\nnote: Classic CS problems and programs\n", "language": "00-META" }, { "code": ":<cite>In algebra, [[wp:Polynomial long division|polynomial long division]] is an algorithm for dividing a polynomial by another polynomial of th...
Polynomial-long-division
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Polyspiral\n", "language": "00-META" }, { "code": "A [http://www.otherwise.com/Jurtle/screenshots_win/assets/DisplayWindow_Full.png Polyspiral] is a spiral made of multiple line segments, whereby each segment is larger (or smaller) than the previous ...
Polyspiral
[ { "code": "---\ncategory:\n- Mathematics\nfrom: http://rosettacode.org/wiki/Population_count\n", "language": "00-META" }, { "code": "The &nbsp; ''[[wp:Hamming weight|population count]]'' &nbsp; is the number of &nbsp; <big>'''1'''</big>s &nbsp; (ones) &nbsp; in the binary representation of a non-neg...
Population-count
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Power_set\nnote: Discrete math\n", "language": "00-META" }, { "code": "A &nbsp; [[set]] &nbsp; is a collection (container) of certain values, \nwithout any particular order, and no repeated values. \n\nIt corresponds with a finite set in mathematics....
Power-set
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Price_fraction\nnote: Financial operations\n", "language": "00-META" }, { "code": "A friend of mine runs a pharmacy. &nbsp; He has a specialized function in his Dispensary application which receives a decimal value of currency and replaces it to a st...
Price-fraction
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Primality_by_trial_division\nnote: Prime Numbers\n", "language": "00-META" }, { "code": ";Task:\nWrite a boolean function that tells whether a given integer is prime. \n\n\nRemember that &nbsp; '''1''' &nbsp; and all non-positive numbers are not prim...
Primality-by-trial-division
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Primality_by_Wilson's_theorem\nnote: Prime Numbers\n", "language": "00-META" }, { "code": ";Task:\nWrite a boolean function that tells whether a given integer is prime using [http://www.cut-the-knot.org/blue/Wilson.shtml Wilson's theorem]. \n\nBy Wil...
Primality-by-Wilsons-theorem
[ { "code": "---\ncategory:\n- Arbitrary precision\nfrom: http://rosettacode.org/wiki/Prime_decomposition\nnote: Prime Numbers\n", "language": "00-META" }, { "code": "The prime decomposition of a number is defined as a list of prime numbers \nwhich when all multiplied together, are equal to that numbe...
Prime-decomposition
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Prime_numbers_whose_neighboring_pairs_are_tetraprimes\n", "language": "00-META" }, { "code": ";Definitions\n\nThe following definitions are needed for this task.\n\nA '''tetraprime''' is a positive integer which is the product of four distinct primes...
Prime-numbers-whose-neighboring-pairs-are-tetraprimes
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Prime_triangle\n", "language": "00-META" }, { "code": "You will require a function f which when given an integer S will return a list of the arrangements of the integers 1 to S such that g<sub>1</sub>=1 g<sub>S</sub>=S and generally for n=1 to n=S-1 ...
Prime-triangle
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Primorial_numbers\nnote: Prime Numbers\n", "language": "00-META" }, { "code": "Primorial numbers are those formed by multiplying successive prime numbers. \n\n\nThe primorial number series is:\n::* &nbsp; primorial(0) = &nbsp; &nbsp; &nbsp; &nbsp; 1 ...
Primorial-numbers
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Priority_queue\n", "language": "00-META" }, { "code": "A [[wp:Priority queue|priority queue]] is somewhat similar to a [[Queue|queue]], with an important distinction: each item is added to a priority queue with a priority level, and will be later rem...
Priority-queue
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Probabilistic_choice\nnote: Probability and statistics\n", "language": "00-META" }, { "code": "Given a mapping between items and their required probability of occurrence, generate a million items ''randomly'' subject to the given probabilities and co...
Probabilistic-choice
[ { "code": "---\ncategory:\n- Initialization\nfrom: http://rosettacode.org/wiki/Program_name\nnote: Basic language learning\n", "language": "00-META" }, { "code": "The task is to programmatically obtain the name used to invoke the program. (For example determine whether the user ran \"python hello.py...
Program-name
[ { "code": "---\ncategory:\n- Simple\nfrom: http://rosettacode.org/wiki/Program_termination\nnote: Basic language learning\n", "language": "00-META" }, { "code": ";Task:\nShow the syntax for a complete stoppage of a program inside a &nbsp; [[Conditional Structures|conditional]]. \n\nThis includes all...
Program-termination
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Proper_divisors\nnote: Prime Numbers\n", "language": "00-META" }, { "code": "The &nbsp; [http://planetmath.org/properdivisor proper divisors] &nbsp; of a positive integer '''N''' are those numbers, other than '''N''' itself, that divide '''N''' witho...
Proper-divisors
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pseudo-random_numbers/Middle-square_method\n", "language": "00-META" }, { "code": "; The Method:\nTo generate a sequence of n-digit pseudorandom numbers, an n-digit starting value is created and squared, producing a 2n-digit number. If the result has...
Pseudo-random-numbers-Middle-square-method
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pseudo-random_numbers/PCG32\n", "language": "00-META" }, { "code": ";Some definitions to help in the explanation:\n\n:Floor operation<br>\n::https://en.wikipedia.org/wiki/Floor_and_ceiling_functions<br>\n::Greatest integer less than or equal to a rea...
Pseudo-random-numbers-PCG32
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pseudo-random_numbers/Splitmix64\nnote: PRNG\n", "language": "00-META" }, { "code": "Splitmix64 is the default pseudo-random number generator algorithm in Java and is included / available in many other languages. It uses a fairly simple algorithm tha...
Pseudo-random-numbers-Splitmix64
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pythagoras_tree\n", "language": "00-META" }, { "code": "The [[wp:Pythagoras_tree_%28fractal%29|Pythagoras tree]] is a fractal tree constructed from squares. It is named after Pythagoras because each triple of touching squares encloses a right triang...
Pythagoras-tree
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pythagorean_quadruples\n", "language": "00-META" }, { "code": "One form of &nbsp; '''Pythagorean quadruples''' &nbsp; is &nbsp; (for positive integers &nbsp; '''a''', &nbsp; '''b''', &nbsp; '''c''', &nbsp; and &nbsp; '''d'''): \n\n\n:::::::: &nbsp; <...
Pythagorean-quadruples
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Pythagorean_triples\n", "language": "00-META" }, { "code": "A [[wp:Pythagorean_triple|Pythagorean triple]] is defined as three positive integers <math>(a, b, c)</math> where <math>a < b < c</math>, and <math>a^2+b^2=c^2.</math>\n\nThey are called pri...
Pythagorean-triples
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Quaternion_type\n", "language": "00-META" }, { "code": "[[wp:Quaternion|Quaternions]] &nbsp; are an extension of the idea of &nbsp; [[Arithmetic/Complex|complex numbers]].\n\nA complex number has a real and complex part, &nbsp; sometimes written as &...
Quaternion-type
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Queue/Definition\nnote: Data Structures\n", "language": "00-META" }, { "code": "{{Data structure}}\n[[File:Fifo.gif|frame|right|Illustration of FIFO behavior]]\n\n;Task:\nImplement a FIFO queue. \n\nElements are added at one side and popped from the ...
Queue-Definition
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Queue/Usage\nnote: Data Structures\n", "language": "00-META" }, { "code": "{{Data structure}}\n[[File:Fifo.gif|frame|right|Illustration of FIFO behavior]]\n\n;Task:\nCreate a queue data structure and demonstrate its operations. \n\n(For implementatio...
Queue-Usage
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Quine\n", "language": "00-META" }, { "code": "A [[wp:Quine_%28computing%29|quine]] is a self-referential program that can, \nwithout any external access, output its own source. \n\n\nA &nbsp; '''quine''' &nbsp; (named after Willard Van Orman Quine) &...
Quine
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Quoting_constructs\n", "language": "00-META" }, { "code": "Pretty much every programming language has some form of quoting construct to allow embedding of data in a program, be it literal strings, numeric data or some combination thereof.\n\nShow exa...
Quoting-constructs
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Radical_of_an_integer\n", "language": "00-META" }, { "code": ";Definition\nThe '''radical''' of a positive integer is defined as the product of its distinct prime factors.\n\nAlthough the integer 1 has no prime factors, its radical is regarded as 1 b...
Radical-of-an-integer
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Ramanujan's_constant\n", "language": "00-META" }, { "code": "Calculate Ramanujan's constant (as described on the [http://oeis.org/wiki/Ramanujan%27s_constant OEIS site]) with at least\n32 digits of precision, by the method of your choice. Optionally...
Ramanujans-constant
[ { "code": "---\ncategory:\n- Geometry\n- Recursion\nfrom: http://rosettacode.org/wiki/Ramer-Douglas-Peucker_line_simplification\n", "language": "00-META" }, { "code": "The &nbsp; '''Ramer–Douglas–Peucker''' &nbsp; algorithm is a line simplification algorithm for reducing the number of points used to...
Ramer-Douglas-Peucker-line-simplification
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Random_Latin_squares\n", "language": "00-META" }, { "code": "A Latin square of size <code>n</code> is an arrangement of <code>n</code> symbols in an <code>n-by-n</code> square in such a way that each row and column has each symbol appearing exactly ...
Random-Latin-squares
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Random_number_generator_(included)\n", "language": "00-META" }, { "code": "The task is to:\n: State the type of random number generator algorithm used in a language's built-in random number generator. If the language or its immediate libraries don't ...
Random-number-generator-included-
[ { "code": "---\ncategory:\n- Probability and statistics\n- Randomness\nfrom: http://rosettacode.org/wiki/Random_numbers\nnote: Basic language learning\n", "language": "00-META" }, { "code": ";Task:\nGenerate a collection filled with &nbsp; '''1000''' &nbsp; normally distributed random (or pseudo-ran...
Random-numbers
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Random_sentence_from_book\n", "language": "00-META" }, { "code": "* Read in the book \"[http://www.gutenberg.org/files/36/36-0.txt The War of the Worlds]\", by H. G. Wells.\n* Skip to the start of the book, proper.\n* Remove extraneous punctuation, b...
Random-sentence-from-book
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Range_expansion\n", "language": "00-META" }, { "code": "{{:Range extraction/Format}}\n\n\n;Task:\nExpand the range description: \n <big> -6,-3--1,3-5,7-11,14,15,17-20 </big>\n\n<small>Note that the second element above, \nis the '''range from minus ...
Range-expansion
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Range_extraction\n", "language": "00-META" }, { "code": "{{:Range extraction/Format}}\n\n;Task:\n* Create a function that takes a list of integers in increasing order and returns a correctly formatted string in the range format. \n* Use the function ...
Range-extraction
[ { "code": "---\ncategory:\n- Sorting\nfrom: http://rosettacode.org/wiki/Ranking_methods\nnote: Sorting Algorithms\n", "language": "00-META" }, { "code": "{{Sorting Algorithm}}\n\nThe numerical rank of competitors in a competition shows if one is better than, equal to, or worse than another based on ...
Ranking-methods
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Rate_counter\n", "language": "00-META" }, { "code": "Counting the frequency at which something occurs is a common activity in measuring performance and managing resources. In this task, we assume that there is some job which we want to perform repeat...
Rate-counter
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Ray-casting_algorithm\nnote: Classic CS problems and programs\n", "language": "00-META" }, { "code": "<br>\nGiven a point and a polygon, check if the point is inside or outside the polygon using the [[wp:Point in polygon#Ray casting algorithm|ray-cas...
Ray-casting-algorithm
[ { "code": "---\nfrom: http://rosettacode.org/wiki/RCRPG\nnote: Games\n", "language": "00-META" }, { "code": "Create a simple interactive game which incorporates the following features:\n\n* room-based navigation in three integer dimensions (x,y,z)\n* player inventory\n* three types of item: sledge, ...
RCRPG
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Read_a_file_character_by_character/UTF8\nnote: File handling\n", "language": "00-META" }, { "code": ";Task:\nRead a file one character at a time, as opposed to [[Read entire file|reading the entire file at once]].\n\nThe solution may be implemented a...
Read-a-file-character-by-character-UTF8
[ { "code": "---\ncategory:\n- Simple\nfrom: http://rosettacode.org/wiki/Read_a_file_line_by_line\nnote: File handling\n", "language": "00-META" }, { "code": "Read a file one line at a time, \nas opposed to [[Read entire file|reading the entire file at once]].\n\n\n;Related tasks:\n* [[Read a file cha...
Read-a-file-line-by-line
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Read_a_specific_line_from_a_file\n", "language": "00-META" }, { "code": "Some languages have special semantics for obtaining a known line number from a file.\n\n\n;Task:\nDemonstrate how to obtain the contents of a specific line within a file. \n\nFo...
Read-a-specific-line-from-a-file
[ { "code": "---\ncategory:\n- Arithmetic operations\n- Simple\nfrom: http://rosettacode.org/wiki/Real_constants_and_functions\nnote: Basic language learning\n", "language": "00-META" }, { "code": ";Task:\nShow how to use the following math constants and functions in your language &nbsp; (if not avail...
Real-constants-and-functions
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Recaman's_sequence\n", "language": "00-META" }, { "code": "The '''[[wp:Recamán's sequence|Recamán's sequence]]''' generates Natural numbers.\n\nStarting from a(0)=0, the n'th term <code>a(n)</code>, where n>0, is the previous term minus <code>n</code...
Recamans-sequence
[ { "code": "---\ncategory:\n- Temporal media\nfrom: http://rosettacode.org/wiki/Record_sound\nnote: Sound\n", "language": "00-META" }, { "code": "Record a monophonic 16-bit PCM sound into either memory space, a file or array.\n\n(This task neglects to specify the sample rate, and whether to use signe...
Record-sound
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Reflection/Get_source\nnote: Reflection\n", "language": "00-META" }, { "code": ";Task:\nThe goal is to get the source code or file path and line number where a programming object (e.g. module, class, function, method) is defined.\n<br><br>\n", "l...
Reflection-Get-source
[ { "code": "---\ncategory:\n- Programming Tasks\n- Object oriented\nfrom: http://rosettacode.org/wiki/Reflection/List_methods\nnote: Reflection\n", "language": "00-META" }, { "code": ";Task:\nThe goal is to get the methods of an object, as names, values or both.\n\nSome languages offer [[Respond to a...
Reflection-List-methods
[ { "code": "---\ncategory:\n- Programming Tasks\n- Object oriented\nfrom: http://rosettacode.org/wiki/Reflection/List_properties\nnote: Reflection\n", "language": "00-META" }, { "code": ";Task:\nThe goal is to get the properties of an object, as names, values or both.\n\nSome languages support dynami...
Reflection-List-properties
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Remove_duplicate_elements\nnote: Sorting Algorithms\n", "language": "00-META" }, { "code": "{{Sorting Algorithm}}\n[[Category:Sorting]]\n\nGiven an Array, derive a sequence of elements in which all duplicates are removed.\n\nThere are basically three...
Remove-duplicate-elements
[ { "code": "---\ncategory:\n- File handling\nfrom: http://rosettacode.org/wiki/Remove_lines_from_a_file\n", "language": "00-META" }, { "code": ";Task:\nRemove a specific line or a number of lines from a file. \n\nThis should be implemented as a routine that takes three parameters (filename, starting ...
Remove-lines-from-a-file
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Rename_a_file\nnote: File System Operations\n", "language": "00-META" }, { "code": ";Task:\nRename:\n:::* &nbsp; a file called &nbsp; &nbsp; '''input.txt''' &nbsp; &nbsp; into &nbsp; &nbsp; '''output.txt''' &nbsp; &nbsp; and \n:::* &nbsp; a directory...
Rename-a-file
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Rep-string\n", "language": "00-META" }, { "code": "Given a series of ones and zeroes in a string, define a repeated string or ''rep-string'' as a string which is created by repeating a substring of the ''first'' N characters of the string ''truncated...
Rep-string
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Repeat\n", "language": "00-META" }, { "code": ";Task:\nWrite a procedure which accepts as arguments another procedure and a positive integer. \n\nThe latter procedure is executed a number of times equal to the accepted integer.\n<br><br>\n\n", "l...
Repeat
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Repeat_a_string\nnote: String manipulation\n", "language": "00-META" }, { "code": "Take a string and repeat it some number of times. \n\nExample: repeat(\"ha\", 5) &nbsp; => &nbsp; \"hahahahaha\"\n\nIf there is a simpler/more efficient way to repeat...
Repeat-a-string
[ { "code": "---\ncategory:\n- Electronics\nfrom: http://rosettacode.org/wiki/Resistor_mesh\n", "language": "00-META" }, { "code": "[[image:resistor-mesh.svg|300px||right]]\n\n;Task:\nGiven &nbsp; <big> 10&times;10 </big> &nbsp; grid nodes &nbsp; (as shown in the image) &nbsp; interconnected by &nbsp;...
Resistor-mesh
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Respond_to_an_unknown_method_call\nnote: Object oriented\n", "language": "00-META" }, { "code": ";Task:\nDemonstrate how to make the object respond (sensibly/usefully) to an invocation of a method on it that it does not support through its class defi...
Respond-to-an-unknown-method-call
[ { "code": "---\ncategory:\n- Date and time\n- Networking and Web Interaction\n- Text processing\nfrom: http://rosettacode.org/wiki/Retrieve_and_search_chat_history\nnote: Programming environment operations\n", "language": "00-META" }, { "code": ";Task:\n\n'''Summary:''' Find and print the mentions o...
Retrieve-and-search-chat-history
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Reverse_a_string\nnote: String manipulation\n", "language": "00-META" }, { "code": ";Task:\nTake a string and reverse it.\n\nFor example, \"asdf\" becomes \"fdsa\".\n\n\n;Extra credit:\nPreserve Unicode combining characters. \n\nFor example, \"as⃝df̅...
Reverse-a-string
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Reverse_words_in_a_string\n", "language": "00-META" }, { "code": ";Task:\nReverse the order of all tokens in each of a number of strings and display the result; &nbsp; the order of characters within a token should not be modified.\n\n\n;Example:\n<bi...
Reverse-words-in-a-string
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Rhonda_numbers\n", "language": "00-META" }, { "code": "A positive integer '''''n''''' is said to be a Rhonda number to base '''''b''''' if the product of the base '''''b''''' digits of '''''n''''' is equal to '''''b''''' times the sum of '''''n''''''...
Rhonda-numbers
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Rock-paper-scissors\nnote: Games\n", "language": "00-META" }, { "code": ";Task:\nImplement the classic children's game [[wp:Rock-paper-scissors|Rock-paper-scissors]], as well as a simple predictive &nbsp; '''AI''' &nbsp; (<u>a</u>rtificial <u>i</u>nt...
Rock-paper-scissors
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Roman_numerals/Decode\n", "language": "00-META" }, { "code": ";Task:\nCreate a function that takes a Roman numeral as its argument and returns its value as a numeric decimal integer. \n\nYou don't need to validate the form of the Roman numeral.\n\nMo...
Roman-numerals-Decode
[ { "code": "---\ncategory:\n- String_manipulation\nfrom: http://rosettacode.org/wiki/Roman_numerals/Encode\n", "language": "00-META" }, { "code": ";Task:\nCreate a function taking a positive integer as its parameter and returning a string containing the Roman numeral representation of that integer. M...
Roman-numerals-Encode
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Roots_of_a_quadratic_function\nnote: Arithmetic operations\n", "language": "00-META" }, { "code": "Write a program to find the roots of a quadratic equation, i.e., solve the equation <math>ax^2 + bx + c = 0</math>. \nYour program must correctly handl...
Roots-of-a-quadratic-function
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Roots_of_unity\nnote: Arithmetic operations\n", "language": "00-META" }, { "code": "The purpose of this task is to explore working with &nbsp; [https://en.wikipedia.org/wiki/Complex_number complex numbers].\n\n\n;Task:\nGiven &nbsp; <big>'''n'''</big...
Roots-of-unity
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Rosetta_Code/Count_examples\nnote: Rosetta Code related\n", "language": "00-META" }, { "code": "Find the total number of programming examples for each [[:Category:Programming Tasks|task]] and the total for all tasks.\n\nEssentially, count the number ...
Rosetta-Code-Count-examples
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Rosetta_Code/Find_unimplemented_tasks\nnote: Rosetta Code related\n", "language": "00-META" }, { "code": ";Task:\nGiven the name of a language on Rosetta Code, find all tasks which are not implemented in that language.\n\n\nNote: Implementations shou...
Rosetta-Code-Find-unimplemented-tasks
[ { "code": "---\ncategory:\n- Rosetta Code related\nfrom: http://rosettacode.org/wiki/Rosetta_Code/Fix_code_tags\nnote: Text processing\n", "language": "00-META" }, { "code": ";; This task has been <em>revised</em> for the hosting change Rosetta Code has had in August 2022. \n;; See the Python exampl...
Rosetta-Code-Fix-code-tags
[ { "code": "---\ncategory:\n- Text processing\n- Networking and Web Interaction\n- Sorting\n- Rosetta Code related\nfrom: http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_number_of_users\n", "language": "00-META" }, { "code": ";Task:\nSort most popular programming languages based on the num...
Rosetta-Code-Rank-languages-by-number-of-users
[ { "code": "---\ncategory:\n- String_manipulation\nfrom: http://rosettacode.org/wiki/Rot-13\nnote: Encryption\n", "language": "00-META" }, { "code": ";Task:\nImplement a &nbsp; '''rot-13''' &nbsp; function &nbsp; (or procedure, class, subroutine, or other \"callable\" object as appropriate to your pr...
Rot-13
[ { "code": "---\ncategory:\n- Simple\nfrom: http://rosettacode.org/wiki/RPG_attributes_generator\n", "language": "00-META" }, { "code": "'''RPG''' &nbsp; = &nbsp; <u>R</u>ole <u>P</u>laying <u>G</u>ame.\n\n\n\nYou're running a tabletop RPG, and your players are creating characters.\n\nEach character ...
RPG-attributes-generator
[ { "code": "---\nfrom: http://rosettacode.org/wiki/RSA_code\nnote: Encryption\n", "language": "00-META" }, { "code": "Given an [[wp:RSA|RSA]] key (n,e,d), construct a program to encrypt and decrypt plaintext messages strings. \n\n'''Background'''\n\nRSA code is used to encode secret messages. It is n...
RSA-code
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Runge-Kutta_method\n", "language": "00-META" }, { "code": "Given the example Differential equation:\n:<math>y'(t) = t \\times \\sqrt {y(t)}</math>\nWith initial condition:\n:<math>t_0 = 0</math> and <math>y_0 = y(t_0) = y(0) = 1</math>\nThis equation...
Runge-Kutta-method
[ { "code": "---\nfrom: http://rosettacode.org/wiki/Runtime_evaluation\n", "language": "00-META" }, { "code": ";Task:\nDemonstrate a language's ability for programs to execute code written in the language provided at runtime. \n\nShow what kind of program fragments are permitted (e.g. expressions vs. ...
Runtime-evaluation