A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://rosettacode.org/wiki/Help:Request_a_new_programming_task below:

Rosetta Code:Village Pump/Suggest a programming task

So you want to see a problem solved? If you're not comfortable creating the task page yourself, feel free to edit this page, and describe the problem below. (To edit this page, click the "edit" tab at the top.) You also might want to check out the draft tasks to see if someone has already suggested one and partially produced the page; if so, just help them out by supplying what's needed to take the page from draft to full task.

When making a request, please place it in the Unsorted section. Also, feel free to review the others that are already here; help sort them into the other categories, based on the category descriptions. (If we need another category or two, you can create them.)

Incomplete General
See First-class functions --Paddy3118 15:34, 24 February 2009 (UTC)
Not entirely appropriate. Nothing prevents one from having a list of function pointers in C or C++ to apply to the same pointer or reference to the value in question. However, there appears to be significant discussion whether C is even appropriate in the task you link to. --Short Circuit 07:52, 25 February 2009 (UTC)
Could this be added to Comparing two integers? --Mwn3d 07:28, 21 December 2007 (MST)
Type-variant rather suggests dynamic polymorphism, i.e., when the specific type of the value (and the value itself) depends on the type tag of the object. MS VARIANT is rather a different thing. It is a union, a container type which content depends on the value of the constraint. This is also a form polymorphism, but different, a dynamically constrained type. The type of the object does not vary. A similar case represents unbounded array, which size depends on the actual bounds (the constraint). (Granted, MS VARIANT serves the purpose of dynamic polymorphism, but that is merely because MS wished to keep it conform to non-OO languages.) --Dmitry-kazakov 13:24, 9 April 2009 (UTC)
Is this close? --Mwn3d 20:22, 3 November 2009 (UTC)
Probably not quite what he's looking for. Different regex implementations (i.e. .Net's, Perl's, sed, Visual Studio's, etc.) have different extensions and escape sequences. It's likely he's looking for a comparison as though each variant of regex were treated as being distinct languages. Accessing the implementation is one thing, but performing various supported operations is another. --Michael Mol 21:50, 3 November 2009 (UTC)
POSIX specifies two levels of regular expressions, and then there's additional levels beyond that (c.f. Perl and PCRE). There's also a lot of disagreement between different camps here over the type of automaton that should be used in the implementation. It's a mess to be honest (as extensions beyond POSIX EREs aren't standardized). Because of that, if you're going to delve deeper into REs, I advise picking one of the POSIX levels and explicitly stating that that level only be supported. –Donal Fellows 23:03, 3 November 2009 (UTC)
yea in a long term it would be great to have something like Michael Mol said but that's a very nice start, thanks 187.37.58.35 14:39, 4 November 2009 (UTC)
UPDATE: now I noticed this page Regular_expression_matching is there for quite a time, but I didn't found it in the 'by Task' link, that's why I posted, also searching by "Regular expression" in the search box results nothing.. 187.37.58.35 16:17, 4 November 2009 (UTC)
That task is listed under Text processing on the Solutions by Task page. You can also look at Category:Programming Tasks to see a list with no sub-categories. I can set up a redirect from "Regular expressions" for now, though it seems like we need more tasks to cover REs. --Mwn3d 16:20, 4 November 2009 (UTC)
Games
  • magic squares of odd order has been implemented.   Magic squares of even order   has no known algorithm and therefore will be problematic to generate. -- Gerard Schildberger (talk) 04:41, 20 March 2014 (UTC)
Note that that assembler code makes deep use of very specific hardware which is not present on most systems. Just reading it for comprehension would take days of work, for someone like me. --Rdm 16:02, 17 December 2012 (UTC)
And the size of any entry is likely to be too large. --Paddy3118 16:15, 17 December 2012 (UTC)
You are both right, here is a link to a java implementation of pacman [2]
See User:DanBron/Game of Nim for history... --Paddy3118 (talk) 05:57, 22 May 2015 (UTC)
......#......
.#.#.#.#.#.#.
.......#.....
.#.###.#.#.#.
.....#.......
##.#.#.#.###.
...#.....#...
.###.#.#.#.##
.......#.....
.#.#.#.###.#.
.....#.......
.#.#.#.#.#.#.
......#......

and produce a diagram with the numbers in place and a skeleton set of clues in this format

|--------------------------------------|
|1 |  |2 |  |3 |  |##|4 |5 |  |6 |  |7 |
|  |  |  |  |  |  |##|  |  |  |  |  |  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|  |##|  |##|  |##|8 |##|  |##|  |##|  |
|  |##|  |##|  |##|  |##|  |##|  |##|  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|  |##|  |##|##|##|  |##|  |##|  |##|  |
|  |##|  |##|##|##|  |##|  |##|  |##|  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|11|  |  |  |12|##|13|  |  |  |  |  |  |
|  |  |  |  |  |##|  |  |  |  |  |  |  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|##|##|  |##|  |##|  |##|  |##|##|##|  |
|##|##|  |##|  |##|  |##|  |##|##|##|  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|14|  |  |##|15|  |  |  |  |##|16|  |  |
|  |  |  |##|  |  |  |  |  |##|  |  |  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|  |##|##|##|  |##|  |##|  |##|  |##|##|
|  |##|##|##|  |##|  |##|  |##|  |##|##|
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|17|  |18|  |  |  |  |##|19|  |  |  |20|
|  |  |  |  |  |  |  |##|  |  |  |  |  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|  |##|  |##|  |##|  |##|##|##|  |##|  |
|  |##|  |##|  |##|  |##|##|##|  |##|  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|21|  |  |  |  |##|22|  |23|  |  |  |  |
|  |  |  |  |  |##|  |  |  |  |  |  |  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|  |##|  |##|  |##|  |##|  |##|  |##|  |
|  |##|  |##|  |##|  |##|  |##|  |##|  |
|--+--+--+--+--+--+--+--+--+--+--+--+--|
|24|  |  |  |  |  |##|25|  |  |  |  |  |
|  |  |  |  |  |  |##|  |  |  |  |  |  |
|--------------------------------------|

Across
   1 (6)
   4 (6)
   9 (7)
  10 (5)
  11 (5)
  13 (7)
  14 (3)
  15 (5)
  16 (3)
  17 (7)
  19 (5)
  21 (5)
  22 (7)
  24 (6)
  25 (6)

Down
   1 (5)
   2 (7)
   3 (7)
   5 (9)
   6 (5)
   7 (7)
   8 (11)
  12 (9)
  14 (7)
  16 (7)
  18 (5)
  20 (5)
  23 (3)

where the bracket numbers are the lengths of the corresponding solutions.

A much harder task would be, given a set of simple definition type clues and the language used, solve the crossword.

--Brnikat (talk) 15:03, 10 July 2015 (UTC)

Python implementation: [3]
Database / Network Data structures and algorithms
It seems to be specific to C/C++ and would it be best practice or just some kind of optimisation? --Paddy3118 (talk) 17:54, 20 May 2014 (UTC)
In Emacs Lisp: <lang lisp>(defun is-include (l1 l2)
 "test if l1 is a part of l2. In other words, if each element of l1
  is an element of l2"
 (cond
  ((null l1) t)
  ((member (car l1) l2) (is-include (cdr l1) l2))
  (t nil)))</lang>
Is that intended to model a subset operation? –Donal Fellows 13:52, 18 December 2012 (UTC)
I might be interested in wp:Introsort and wp:Timsort, as both are reported to be highly efficient sorts. However, they're also not the best-described sorting algorithms (e.g., no actual algorithm on the WP pages) so I'm not in a hurry to actually take them on. –Donal Fellows 09:15, 2 September 2010 (UTC)
The Timsort algorithm description might only be its source! I suspect it may not be a good candidate for an RC task for that reason, but if someone knowledgable could break out a sub-algorithm, such as finding optimal runs of pre-sorted data then implementing that sub-algorithm might form a useful task. --Paddy3118 10:51, 10 November 2011 (UTC)
Timsort is actually very well described - the Wikipedia page now has an algorithm description, and this page has a detailed description from the author. Gereeter 15:51, 17 March 2013 (UTC)
* Strand sort
* Smooth sort
* wp:Patience sort
* wp:Tree sort - would demonstrate the use of binary search trees
* *TimSort http://en.wikipedia.org/wiki/Tim_sort
Check out Natural sorting. It may be what you're after. --Paddy3118 17:07, 21 September 2012 (UTC)
JSON is large. Range expansion requires the parsing of structured text and is smaller. Will that do? --Paddy3118 05:23, 23 November 2010 (UTC)
Done as Move-to-front algorithm --Paddy3118 (talk) 20:21, 20 May 2014 (UTC)
Hmm; there's Associative array (and its associated tasks). Not quite as obvious as I hoped for. Maybe we need some more tasks in this area. –Donal Fellows 09:26, 21 January 2011 (UTC)
In Lua: <lang lua>local function hashCode(str)
 local total = 0
 local n = #str
 for i=1, n do
   total = (total + str:byte(i) * 31^(n-i)) % 2^32
 end
 return total

end </lang> --STUART 21:18, 8 January 2012 (UTC)

Graph algorithms System calls Mathematical Operations
   A(0,n) , A(1,0) , A(1,1) , A(2,0) , A(1,2) , A(1,3) , A(1,4) , A(1,5) , A(2,1) , A(1,6) , A(3,0) , A(1,7) , ...
Conjecture: R(x+z,y)>R(x,y) and R(x,y+z)>R(x,y) for all positive integer z and all positive integer x where R is the function returning the number of recursions in the corresponding call to the Ackermann function. Can anyone prove this conjecture? -Zelah (talk) 02:34, 7 May 2014 (UTC)
See Bitwise operations. --Paddy3118 (talk) 17:40, 19 November 2014 (UTC)
Looks like he wants it re-implemented even if the language already covers it. --Mwn3d (talk) 17:56, 19 November 2014 (UTC)
Color Spaces
That would not be Color Space conversion. You can not convert a color space into a color model. sRGB is a color space that uses RGB color model. HSL, HSV and CMYK are color models. Maybe you mean color model conversion? However, conversion to CMYK requires information about the inks, paper and printing device used. In practice, it requires color space conversion, too. --PauliKL 15:29, 2 December 2009 (UTC)
Ok, how about: Color Model Conversion. Convert a value from RGB to HSL, from HSL to HSV, HSV to YUV, and from YUV to RGB. Or using some other chain order that can better take advantage of color model similarities. --Michael Mol 13:34, 8 October 2010 (UTC)
Terminal Control API-specific Library-specific Implementation-specific Language-specific

Add a sample Makefile to demonstrate how to build a dummy executable for several programming languages (distinguish between several platforms: Linux,Windows,etc)

Duck typing specifically my DuckDecoy Example? --Paddy3118 18:28, 5 May 2009 (UTC)

The example is a bit confusing, but I think it's marking the difference between classes as true types and classes as patterns (with method invocations as message sends), yes? –Donal Fellows 08:22, 3 January 2010 (UTC)

A language called LC3 is a great tool for students wishing to learn assembly and wish to see what is actually in the RAM space. It is extremely simple. I think a language page would be worth the trouble. I have a few old examples that I can add in this language. --Michael Chrisco 12:35, 26 July 2010

Project level

Which project, RC ? --Hajo (talk) 07:20, 21 November 2014 (UTC)

If possible, find ways to break these into smaller tasks which can ultimately be assembled into the final project.

Self-hosting compiler Super Simple p2p network
Could be done with FIFOs for streams, and a constant number of clients. Needs to be more specific regarding what it does. --Short Circuit 22:28, 6 December 2007 (MST)
probably means some thing like this http://ansuz.sooke.bc.ca/software/molester/molester. To make it suitable for rc the restrictions need to be spelt out - i.e. fixing the protocol and discovery mechanisms Rahul 20:24, 7 October 2008 (UTC)
A table-based native code assembler

implement a table-based native code (macro?) assembler in various HLLs

Stateful behavior simulation

Demonstrate discrete event simulation and stateful behaviour by simulating a simple pick-and-place or storage/retrieval system robot. The robot would be given commands to retrieve from location A and place into location B. The robot would in turn command its 4 motors in sequence in order to accomplish the task. The amount of time that a motor runs would be dependant on the distance required to move. A scheduler would be set up to generate callback events to the motors at proper times to indicate their motion was complete. The complete specification of this task would be somewhat involved. --Rldrenth 18:09, 20 January 2009 (UTC)

This needs to be simplified/clarified from requiring "four motors" to having three commands, "set velocity forward/back", "no-op" and "claw open/close".
Subsequently, it can be divided into four parts:
  1. Call a function at a constant interval
  2. Create a function which reads from a primary queue containing simple commands and a secondary queue containing complex commands, processing exactly one of these commands, and then calls the state update function.
  3. Create a function that converts a complex command "starting from x1, pick up at x2 and drop at x3" to one of the three simple commands
  4. Create a function that updates the state (velocity and position) based on the currently executing command.

In the interest of simplicity, it can be assumed that the program may terminate once the secondary queue is empty, that the robot has a constant velocity either forward or backward, and that the velocity and position values at termination are irrelevant. --Short Circuit 05:40, 19 May 2009 (UTC)

Unit test framework

Demonstrate the use of a unit test framework for your language

Is Test a function a suitable demonstration? –Donal Fellows 11:41, 26 February 2010 (UTC)
Simple Shell

Execute system commands, pipes, I/O redirection, command history, custom PATH variable, etc. --CheesyPuffs144 01:44, 9 August 2009 (UTC)

Prolog interpreter

The Prolog's syntax looks incredibly simple, and I'm wondering how difficult it would be to write a prolog interpreter in various langauges. --Michael Mol 08:21, 13 November 2009 (UTC)

Interesting and relevant suggestion, Michael. Many such projects exist for reference, including Norvig's in "Paradigms of Artificial Intelligence Programming," Paul Graham's in "On Lisp," the interpreter that is part of Poplog, and PyPy's. User:qu1j0t3

Prolog's syntax seems relatively simple, when compared with some other languages, but I do not think it is "incredibly simple". For example, it has three distinct syntaxes for function calls, three different kinds of operators (prefix, infix and postfix), operator precedence, various forms of control flow syntax, and so on... --Rdm 02:16, 3 September 2010 (UTC)
Even though Prolog's syntax is simple, there is a rather elaborate parser necessary (including redefining operators and precedence, IIRC) plus the runtime operation of Prolog is rather complicated to implement (SWI-Prolog for example is quite a large project), this would only be feasible if you define a subset of Prolog (e.g. only logical terms). --AlexLehm 10:30, 28 October 2011 (UTC)
Edinburgh Prolog standard has rather elaborate character definition syntax. Prolog parser is anything but trivial. WillNess 08:43, 2 December 2011 (UTC)
Compact Whitespace interpreter

Implement a whitespace interpreter such that the program used to implement it is as small as possible while still correctly implementing whitespace

General 2D morphing

I have an idea for a task but it might require original work, possibly on research level. It's inspired from recent research about self-assembling robots: http://phys.org/news/2013-10-surprisingly-simple-scheme-self-assembling-robots.html

What I have in mind is a simplified 2D model for an algorithm that would allow a set of square robots to take any arbitray shape.

Here is how I may formulate the task:

Given N randomly selected points on a possibly infinite grid, and a given arbitrary target set of N points on this very same grid, find a set of N non-colliding trajectories such that the set of points at the end of the trajectories is the same as the target.

--Grondilu (talk) 09:42, 7 October 2013 (UTC)

Chat Server, Client and Gateway

I'll get started on a demo of this and proper write up over the next couple weeks. There's already a Chat server task, but it doesn't really specify a protocol. Most implementations seem to be pretty straightforward, query the client for a nick, then announce all messages to everyone.

The chat server I'd propose is slightly more complicated, but not as complex as IRC. I'll work on a more clear protocol spec, but at a minimum changing of nicks and private messages, some others that will come up I'm sure (more features would be permitted, but a minimum and compatible protocol for the later projects).

The second project is a Chat Client, it would hide the protocol (similar to IRC clients) so that the user can simply type messages, pm people via something like `/pm rabuf Hey, going to the movie tonight?`. Filtering messages received from the server that the user doesn't need (like PING/PONG messages), or optionally killlists to hide messages from annoying people. This could be split into 2+ projects. A simple CLI, this would look like the result of telnetting into the current chat servers. Hides the protocol, user simply sees prompts for a name at the start, and a prompt for messages. A more complex CLI version using something like ncurses or slang to build a more featureful UI (separate panel for PMs, text input in a panel at the bottom, etc.). And a GUI client (ideally, each language would have one `client` core that people build these UI wrappers around).

The third part is what IRC Gateway is proposing now, but simplified. Connect two servers, announce messages between them or extend the protocol of the servers to allow gateways to be special. Announce messages as rabuf if the user is local, rabuf@rosettacode if they're from the other side of the gateway, etc. This is mainly to address what I (personally, nothing against the task, but it's potentially very easy or ludicrously hard) see as a problem in the IRC Gateway task. In the TCL version the code is largley provided by an existing library, in languages lacking such a library one would need to be made or found. Potentially allow PMs across the gateway `/pm rabuf@rosettacode Yo!`.

Overall, these three projects build on existing projects around UIs and networked interfaces, they *may* be a bit large, but we've got some pretty hefty tasks floating about now, and I feel these should all be manageable. The name might be changed so that it doesn't conflict with the existing and simple Chat Server task, it doesn't need to be replaced, it's a nice simple example of client/server architecture in each language. Perhaps something like "Rosetta Chat". As I said, I'll be working on this over the next couple weeks and feedback, advice, criticism, etc are all welcome.

--Rabuf (talk) 20:47, 5 November 2013 (UTC)

Unsorted
I am trying to write the following instructions in Pharo or SmallTalk:

- a linked list with tests - a simple program equivalent of javadoc system that generates a mini javadoc like html file for a class passed as argument.


Place new items here, if it's unclear where they belong.

Splat/Unpack

Many languages have either an operator or magic function that takes a list/tuple, and turns it into multiple values that can be used as seperate function arguments or similar. This is `table.unpack` in lua, `*` in python, and `...` in js. It would be nice to have a comprehensive comparison of how this is written in different languages.

Count Consonants

Create a program to count consonants in a string input by the user using the ASCII character set. The program must only count the letters that are not vowels. It should not count white space, punctuation, control characters, or numeric digits. For instance, and Ada solution is: <lang Ada> with Ada.Text_IO; use Ada.Text_IO;

procedure Main is

  subtype letter is Character with
       Static_Predicate => letter in 'A' .. 'Z' | 'a' .. 'z';
  subtype Vowel is Character with
    Static_Predicate => Vowel in 'A' | 'E' | 'I' | 'O' | 'U' |
                                 'a' | 'e' | 'i' | 'o' | 'u';
  subtype consonant is character with
    dynamic_predicate => consonant in letter and then consonant not in vowel;
  Input : String(1..1024);
  length : natural;
  consonant_count : Natural := 0;

begin

  Put("Enter a string: ");
  Get_Line(Item => Input, Last => length);
  -- count consonants
  for char of input(1..length) loop
     if char in consonant then
        consonant_count := consonant_count + 1;
     end if;
  end loop;
  New_Line;
  Put_Line(Input(1..Length));
  Put_Line("contains" & consonant_count'image & " consonants.");

end Main; </lang> See also https://rosettacode.org/wiki/Count_how_many_vowels_and_consonants_occur_in_a_string. wherrera

Multiple Mice

If 2 or more USB mice (or trackballs / trackpads) are connected to the system, read the input of each separately (for multiple mouse pointers or for multiplayer game input).

Colorwheel

description

Versions:

Operators polymorphism

For many OO programming languages we need simple examples of operator overloading and (if applicable to language) examples how to create new operators.--Zmi007 (talk) 10:31, 16 April 2015 (UTC)

Not only OO languages. Algol68 allows operator overloading and creation of new operators. For instance <lang ALGOL68> OP FACTORIAL = (INT n) INT : IF n < 1 THEN 1 ELSE

  INT fact:= 1;
  FOR i FROM 2 TO n DO fact TIMESAB i OD;
  fact

FI; OP * = (CHAR c, INT n) []CHAR : ( [n]CHAR result := HEAP [n] CHAR;

 FOR i TO n DO result[i]:=c OD;
 result

); print ((FACTORIAL 5, newline)); print (("X" * 6, newline)) </lang> Output: <lang>

      +120

XXXXXX </lang> Brnikat (talk) 11:58, 10 July 2015 (UTC)

Simple OCR

("optical character recognition") - Find text (or numbers) in pictures, for example comics (like Dilbert), or screenshots.
WRT "simple", we restrict this to chars of known fonts, e.g. by giving the program some picture(s) with known text-samples. --13:07, 13 December 2014 (UTC)

Page-splitter

A bot for splitting pages into sub-pages. If possible, with only a single captcha-check.
E.g. I moved some entries from 99_Bottles_of_Beer to separate pages,
to organize them into groups of languages per subpage,
see Category:99_Bottles_of_Beer. The Page-splitter should be able to automate such tasks. --Hajo (talk) 07:20, 21 November 2014 (UTC)

Reversible random bit generator

Implement a random bit generator that can be run forward and backward. When run backward it produces bits in reverse order. I suggest using a maximal period minimal cost linear hybrid cellular automaton utilizing rules 90 and 150. -Zelah (talk) 02:35, 7 May 2014 (UTC)

Duff's Device

Implement Duff's Device or a near equivalent Axtens (talk) 03:27, 26 April 2014 (UTC)

Bank Routing Number Validator

All banks are assigned one or more 9-digit routing numbers (aka. transit routing number) that are self checking according to this algorithm. From the left, multiply each digit by a corresponding weight (3,7,1,3,7,1,3,7,1) and add all products. If the sum ends in zero, the number is a valid routing number. Try it for 121000248 - it should sum up to 60. Also try it on the 9-digit routing number found at the bottom of your checking account)

Clipboard Manipulation

Display the clipboard content & Write new content to the clipboard

Minilight

A minimal global illumination renderer http://www.hxa.name/minilight/

Random RC task

Select a random task or draft task from RC, filtering out the non-task pages

See this IRC discussion for more information -- Erik Siers 05:46, 21 November 2011 (UTC)
Noises

http://en.wikipedia.org/wiki/Perlin_noise http://en.wikipedia.org/wiki/Simplex_noise http://en.wikipedia.org/wiki/Worley_noise https://gist.github.com/304522 http://libnoise.sourceforge.net/

Thread safe circular buffer

Using mutexes or semaphores to conduct thread safe and robust read and writes from a circular buffer.

Henderson Escher Picture Language

PDF as made famous by SICP Section 2.2.4 Video, Lecture 3a. Here is an implementation in Lisp by Frank Buss. --Alanning 04:00, 27 May 2011 (UTC)

Phonecode

Given a list of words, and a telephone number, find all possible encodings of that telephone number by words. This task has already been used in a few comparative studies of language performance and productivity, for example [6]

Thanks so much for that link! I had read the paper some time ago but I probably have the link on an old hard drive somewhere...
You have to remember though, that the aims of RC are very different to the authors of that paper and any task would have to be written for RC. If anyone has the number to a cold-calling firm, we could find the most appropriate phrase for their number ;-) or maybe not. --Paddy3118 08:15, 7 May 2011 (UTC)
Here's an easy one. The phone number to the White House switch board: 202-456-1414. Nothing specific or political intended here; it's just a published, public number. I do like the task idea, though. --Michael Mol 13:15, 8 May 2011 (UTC)
Weather Routing

The weather routing problem has the following parts:

Given the above information and a specific path, progress along path and therefore arrival time are determined. The weather routing problem, conversely, is to determine the path which results in the earliest arrival time. JimTheriot (talk) 00:33, 8 July 2015 (UTC)

Project Euler problems
Isn't most of that captured in Tree traversal? --Paddy3118 14:58, 3 November 2010 (UTC)
The page would be too long. --Paddy3118 15:06, 26 February 2010 (UTC)
That's something that's been discussed on and off for a couple years. The key problem is logically dividing examples, moving them to a separate area, and using transclusion to pull them back. I created a "Example" wiki namespace specifically for the purpose. --Michael Mol 15:59, 26 February 2010 (UTC)
Any measure of concision would need a metric for both code size and code clarity. Your proposed measurement of just code size would lead to code "golfing". I think it is better for the examples to be written as idiomatic examples of a language that either fulfils the entirety of a task description, or at least states what is missing. --Paddy3118 03:25, 1 September 2010 (UTC)
Agreed. While code golf is sometimes awe-inspiring, it's typically of horribly low value because it leads to things that people can't read. We're not exploring the Kolmogorov Complexity of a problem, we're showing how a task should be done in many languages (i.e., with good style; making code the way we'd like it to be if we encountered it). –Donal Fellows 09:59, 1 September 2010 (UTC)
This sounds like it would be more appropriate for Project Euler than Rosetta Code: How many useful programming projects really need an implementation of a Becket-Gray search? And, how much would a typical programmer learn about translation by studying such implementations? --Rdm 14:11, 19 May 2010 (UTC)
I never thought of RC as about studying translation. The closest to that is studying unfamiliar languages by seeing a task implemented in a familiar one. Project Euler focuses on implement before observation, where RC is geared more towards observation, and implementation if nobody's already provided it. Apart from being an interesting curiosity (you'd be surprised how many people who actually stick around and look at code came in on curiosity pages like Ethiopian Multiplication and Quine; come for the show, stick around and contribute code), the task I described allows code langauges to exercise dataset manipulation and idiomatic examples of concurrency, the latter of which, at least, doesn't have much presence on the site. --Michael Mol 18:31, 19 May 2010 (UTC)
But a Beckett Gray search has only one interesting case (5 bits wide). The 6 bit wide case takes 15+ hours which makes testing a 6 bit solution for accuracy problematic, the 0, 1 and 2 bit cases are trivial, and the 3 and 4 bit cases are not doable (and what does it mean to "show that no such code exists"? Is reporting that the last value in the found sequence has 3 bits set sufficient?). [And, if my implementation is correct that 5 bit case has 16 distinct valid results -- and each of them has 120 permutations all of which are valid for a total of 1920 different, valid 5 bit beckett gray codes.] --Rdm 19:57, 19 May 2010 (UTC)
The 6-bit-wide case discussed on the WP page indicates that a full search of the data set takes 15 hours, but doesn't indicate the hardware, language or techniques used to find it. See Lucas-Lehmer test for another task that takes a while to run. When originally written, it specified to allow the program to run until it found M47, which wasn't even known at the time. NevilleDNZ apparently has a sense of humor.
There are multiple possible solutions for the 5-bit and 6-bit cases, but only one (but no necessarily any particular one) needs to be found. Conveniently, this is one of those problems where verifying that a solution is valid is easier than finding the solution in the first place; the way I'd expect it to be written is generate gray codes/foreach gray code check for satisfying Beckett restrictions/display first satisfier found and terminate. A final, redundant validity check would be to verify that the presented sequence is a gray code, and that the presented sequence satisfies the Beckett restriction.
By "show that no such code exists," I meant prove that there is no 3-bit or 4-bit Beckett-Gray code; there may gray codes, but there are no gray codes in that space that satisfy the additional constraints placed by the Beckett playwright. If the entire problem space is searched without a found solution, then either there is no solution, or the searching program is in error. in the generate->check(terminate) pipeline, if the generator runs dry without the check ever succeeding, then it's been shown that no example exists.
Going back, you don't need to show all BG codes for a number of bits, but show at least one if any exist, or show none if none exist. At least, that's what I had in mind when I suggested the task. --Michael Mol 03:20, 20 May 2010 (UTC)
RCRPG/Perl was the result of me scratching a nostalgic itch while stuck in bed sick one weekend. I didn't have a deeper goal than that. --Michael Mol 09:33, 20 June 2010 (UTC)
You may not get the answer you were expecting as the idiomatic Python solution might be to add this to the C solution then call the C from Python using that wrapper generator. Their are several toolsets around that use Python as a wrapper around existing C and Fortran libraries and allow the easy wrapping of C routines. --Paddy3118 05:53, 23 November 2010 (UTC)
This Python solution is acceptable. The point of this task is not to keep Python out of the page, but to show how various languages face a computation-heavy task.
See Ackermann function where the extremely compute intensive function needs bigints and other optimisations to get to larger answers. On that page, the C version might be compute intensive, but inefficient compared to the Python one.
See File IO. Actually, I've been watching the analytics data closely over the last week, and that task has seen a large number of hits from a link on the relevant StackOverflow page. --Michael Mol 18:37, 27 August 2010 (UTC)
It probably means that people come on this site to learn and copy code, it's positive. But the File IO Task is very simple. A similar but a bit more complex task may be added.
Well, the StackOverflow case looks rather unique. IIRC, they already had a code golf/chrestomathy section on their site (We've often gotten referral hits from SO in "how do I do X" or "how do I do X in Y" questions, and I've seen mention of "move it to the SO wiki" before.), and the big deal with that task involves the social structure and politics of the appropriateness of the posted SO question, its closing and its temporary deletion. Also, it's inappropriate to copy content from places like SO if that copying violates Rosetta Code:Copyrights. --Michael Mol 03:23, 29 August 2010 (UTC)
I hope I havent stepped on anyones toes here but I've been trying to get the reddit community interested in the site. The more eyeballs, the more chances of good code and tasks (and donations wink wink). IO tasks could be done with blocks, bits, and implementing different database models. I dont know about the language of such a task (like implement SQL or something) but it would be interesting.--MichaelChrisco 00:16, 29 August 2010 (UTC)
Hey, you're not stepping on anyone's toes there. I prefer word-of-mouth to any other form of advertisement I could get. :) --Michael Mol 03:23, 29 August 2010 (UTC)
Try Longest common subsequence too. --Paddy3118 22:32, 16 February 2011 (UTC)
Here is link to an implementation of Longest common subsequence in C and C++.
This is an Anti-pattern. Why code it? --Paddy3118 19:57, 5 April 2011 (UTC)
Perhaps the original commenter overspecified. Make it less specific? Call it Set filter. --Michael Mol 20:16, 5 April 2011 (UTC)
Some languages provide this operation, exactly as the original commenter specified. Common Lisp has delete-if-not, Factor has filter!, and Ruby has Array#select!. Java hackers might implement this with java.util.Iterator.remove() from Java API. I added this task as an option to Filter, along with code for Factor and Ruby. (The page already had Common Lisp.) --Kernigh 01:55, 6 April 2011 (UTC)
The hash join algorithm is very useful in the development of a relational database systems. The task consists in implementing the following algorithm and provinduing a simple reproducible example: The records of files R and S are both hashed to the same hash file, using the same hashing function on the join attributes A of R and B of S as hash keys. A single pass through the file with fewer records (say, R) hashes its records to the hash file buckets. A single pass through the other file (S) then hashes each of its records to the appropriate bucket, where the record is combined with all matching records from R.

Some languages support Design by contract as part of the language (e.g. Eiffel) or via libraries or language extensions (cofoja, gcontracts, C#), I think it would be useful to have a simple (probably incorrect) implementation of a task and the contracts that exhibit the programming mistake. --AlexLehm 09:01, 28 October 2011 (UTC)

1  2  3  4
5  8  9  10
6  11 13 14
7  12 15 16

if the input is 5 then the output will be

1  2  3  4  5
6  10 11 12 13
7  14 17 18 19
8  15 20 22 23
9  16 21 24 24
Playfair encryption and decryption

This is a specific example of the encryption problem mentioned in the general section. Playfair is a simple 25-character bigram alphabetic cipher which was still being used by the military in WW1. The task is to use a given keyword or phrase to generate a key which is used to encrypt a plain text and then to decrypt the corresponding cypher text. As only 25 different letters can be used, one must be chosen not to be used in the plaintext, substituting a valid character as needed to maintain unambiguity of the message. As adjacent identical letters can not be present in the plaintext before encryption, one or more dummy characters must be inserted between them. The plaintext must be padded to an even number of characters before encryption.

I don't yet have a suggested plaintext which trips all the above special conditions but will produce one, along with a pass phrase, the corresponding key and the cipher text.

Brnikat (talk) 11:16, 10 July 2015 (UTC)

There is already a draft task Playfair_cipher --Andreas Perstinger (talk) 05:32, 11 July 2015 (UTC)
Trifid Cipher

To complement the Bifid_cipher task, add the Trifid Cipher.

ICMP Ping

Send an ICMP ping to some local resource, such as the current default gateway or even just 127.0.0.1 or ::1, and display information about the response or the absence of the response.

Generate a Regular Expression for a Range of Integers

Write a function that, given the integers 0 <= min < = max, returns a regular expression that will match the decimal representation of any integer in the range [min, max]. You may assume there are no thousand-separators, leading 0's, or other problematic characters in the string to be processed. You may also assume the caller of your function will prepend/append appropriate anchors (e.g., ^, $, or \b) depending on need, so don't include them. Don't use \d as an alias for [0-9] since \d can match weird unicode characters on some systems.

Example:

min = 1
max = 31
f(min, max) = [1-9]|[1-2][0-9]|3[0-1] /* possible result */
f(min, max) = [1-9]|[12][0-9]|3[01] /* equally-valid alternate result */

Example:

min = 91
max = 417
f(min, max) = 9[1-9]|[1-3][0-9]{2}|4(0[0-9]|1[0-7]) /* possible result */
f(min, max) = 9[1-9]|[1-3][0-9][0-9]|4(0[0-9]|1[0-7]) /* equally-valid alternate result */


Hint: Use a recursive, divide-and-conquer approach. You will have to handle cases where max contains more digits than min.

Bonus: support ranges containing negative integers.

Weighted Random

Pick a random item from a list of dozen items, where each item has different weight (rarity). If the language permits, the list should be made in a way that makes it easy to add new items without having to adjust the weights of the other items.

Gaming example: random treasure generation in roguelikes. I've found that this is extremely awkward to do in some languages, and simple in others.

Partitioning

Task for "partition an integer into X primes". For example, partition 19 into 3 primes could return 3+5+11.

This request was just created today.


See the Rosetta Code task:


-- Gerard Schildberger (talk) 03:48, 3 March 2017 (UTC)

Bron-Kerbosch algorithm

Implement any of the variants of the Bron-Kerbosch algorithm for finding maximal cliques (maximal complete subgraphs) in an undirected graph.

This should likely be sorted under 1.2.2.1, Graph algorithms.

Radix-50 encoding and decoding

Radix-50 is a method of encoding a restricted character set, used by DEC to store compiler labels and filenames. Each 16-bit word stores three characters encoded as char1*40*40 + char2*40 + char3. The name Radix-50 comes from 50(octal) = 40(decimal).

Challenge:


The character set to be used is:

 " ABCDEFGHIJKLMNOPQRSTUVWXYZ$?%0123456789"

Jgh (talk) 17:14, 15 May 2020 (UTC)

That sounds like a good idea for a task which will particularly appeal to the 'old timers' amongst us. Why don't you create a draft task for it and add an implementation to start the ball rolling.

PureFox (talk) 08:14, 17 May 2020 (UTC)

Modulo operation

The table wp:Modulo_operation#In_programming_languages deserves to be somewhere on this site, with additional information and features.

In my own docs (for Phix) I have this (as a suggestion for the kind of info I think would be useful):

              x,y: -9,-4  -9,+4  +9,-4  +9,+4
   remainder(x,y):    -1     -1     +1     +1
         mod(x,y):    -1     +3     -3     +1      -- (matches C's % operator)   

I was thinking there could be checkboxes to filter the list to languages that can and cannot get the results you need/prefer, have an infix operator (or two), work on integers and floating point values or not, and probably something about precedence and associativity. Also the availability of a divmod function, and whether native/bigint/gmp wrappers all agree.

A table would clearly be better than a long list of individual entries, I know we can do sorting (eg), I don't know whether filtering is possible. --Pete Lomax (talk) 08:06, 29 March 2021 (UTC)

Media files

Determine the duration of an audio or video file. Extract a thumbnail from a video file. --Petelomax (talk) 01:53, 1 August 2023 (UTC)

Insufficient information

These task suggestions do not have sufficient information to allow the creation of a task. This section will be cleaned out periodically, but these may inspire the creation of other tasks in the mean time.

Design patterns Recently Completed

If a task has been completed, move the request to this category. Add a link to the task page, and sign (add --~~~~) to the request. Completed tasks more than a week old should be removed from the list.

Discuss
This should probably be split into Query SNMP server and Retrieve configuration setting (for an application, not the SNMP server). There are already tasks for outputting to a file. --Short Circuit 23:43, 16 February 2008 (MST)
This should be as trivial as Call function in shared library, if the Fortran code has been compiled into a shared library. (Regardless of OS) --Short Circuit 23:43, 16 February 2008 (MST)
Serialization and deserialization are extremely common programming tasks, and there are a fair number of open formats for the purpose. Serialization and deserialization should probably get their own category under Category:Solutions by Programming Task. Additionally, json.org has a list of existing JSON implementations, sorted by language, to refer to. This should be a very quick thing to implement for JSON. Other formats that should be considered are XML and binary (packed) formats. --Short Circuit 04:38, 20 June 2009 (UTC)
and started thinking about them in terms of proofs of concept in a larger framework of dynamically extending objects, classes, methods, etc.. It seems to me that tasks that allowed for more dynamic object manipulation like:
  • Add a variable/method to a class runtime
  • Add a method to a class instance at runtime

would be useful to that end. I was thinking that doing these as small proof of concepts rather than trying to build some kind of big framework would be most useful. Now since I'm not a heavy user of OO, I might go overboard here and was wondering what others might think. --Dgamey 17:38, 27 December 2011 (UTC)

via the child's std in, and getting data from the chid's std out. I want to extend this procedure to provide access to the child's std err output. I'd like to submit this procedure to rosettacode.org as it is now working satisfactorily. Sian Mountbatten <poenikatu@fastmail.co.uk>

Logarithm, sine and cosine implementations

I just wanted to know if we could do this, I searched the site and was suprised there wasn't an article about this yet, ofcourse the idea is not to use the standard libraries, what do you think? Rainb (talk) 13:14, 19 July 2013 (UTC)

For the trigonometric (trig) functions, see the Rosetta Code task:   Trigonometric functions.   For the various logarithms, I agree, it would be nice to have Rosetta Code have algorithms for the various log functions (LOG (LOG10), LN, LG (LOG2), LNLN, LOGLOG, LOGP1, LOG to any base, etc.) -- Gerard Schildberger (talk) 04:50, 20 March 2014 (UTC)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4