Questions tagged [rags-to-riches]

Rags-To-Riches is the tag of choice for entries to the corresponding CR-Game as proposed on meta. Questions tagged with this tag are polished Stack Exchange posts asking for a review.

Filter by
Sorted by
Tagged with
2 votes
1 answer
163 views

Hack assembler/disassembler in x86_64 assembly language

Starting from this answer I thought I would show a fully worked example of how to create a data-driven version of the assembler for the Hack assembly language. As I noted in that answer, having ...
Edward's user avatar
  • 65k
5 votes
1 answer
191 views

C++ Mine Sweeper Attempt

Saw this question and though I wanted to try. So my version of reading Mine Sweeper: For the Online Judge Some Utilities Classes ...
Martin York's user avatar
  • 93.4k
5 votes
0 answers
1k views

Scraping OddsPortal with requests only

This is a scraper written to do most of what had been attempted by another user in this question: How can I optimise this webscraping code I did the rewrite because I felt bad that the new user didn't ...
Reinderien's user avatar
  • 56.1k
11 votes
1 answer
319 views

Resizable containers with VueJS

A month ago I reviewed the code in Resizable split DIVs Vue.js, suggesting that the OP use computed properties and bound styles to simplify the code (at least reducing the need to use ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
6 votes
2 answers
3k views

Python Rock-Paper-Scissors via a class to handle the game

Original inspiration was by this Python beginner, and it prompted me to rewrite a bunch of stuff with my flair and my Python experience: First attempt: Python Rock Paper Scissors Okay, so I looked at ...
Thomas Ward -On Strike's user avatar
5 votes
1 answer
84 views

Rename files by editing their names in an editor

Inspired by a recent question to rename files by editing the list of names in an editor, I put together a similar script. Why: if you need to perform some complex renames that are not easy to ...
janos's user avatar
  • 110k
7 votes
1 answer
513 views

Rock-Paper-Scissors engine

Looking over Rock, Paper, Scissors. C++ from a beginning programmer prompted me to think about how I'd program this simple game in C++. The RockPaperScissors class ...
Edward's user avatar
  • 65k
6 votes
1 answer
176 views

Multithreaded testing for counting rooms from a floor plan solution

This is version 3 of Efficiently counting rooms from a floorplan. Version 2 is here Efficiently counting rooms from a floorplan (version 2) It also has a comprehensive test facility that is the ...
Edward's user avatar
  • 65k
4 votes
2 answers
101 views

Polishing partitions - Reimplementing a partitionOn

So I've read an F# question on partitioning a list in F# and wondered whether I could cleanly write the concept down in haskell and if that would help me review the code ... Now I have a haskell ...
Vogel612's user avatar
  • 25.2k
11 votes
4 answers
2k views

Homemade cyraz encryption algorithm

The "Cyraz" encryption algorithm was presented on SOPT community. This algorithm makes a cypher using a private key given in byte[] format with any arbitrary ...
Bruno Costa's user avatar
  • 5,556
15 votes
1 answer
6k views

Simple linear equation solver

In working on a review for Solve a set of "restricted" linear equations efficiently, I decided to reimplement from scratch using the method I proposed in my answer. The application I won't ...
Edward's user avatar
  • 65k
6 votes
1 answer
101 views

Object oriented, runtime expandable Sieve of Eratosthenes

In answering this question, it seemed to me that it would be nice to have a runtime expandable Sieve of Eratosthenes. This is my implementation of that notion. Design I've created a class named <...
Edward's user avatar
  • 65k
11 votes
1 answer
279 views

Check consistency of statements, with fuzzy rhyme matching (Kattis "Mårten's Theorem" challenge)

I wrote a review for Check consistency of a list of statements, with fuzzy rhyme matching, which basically required me to try writing my own solution to fully understand the challenge. So, I thought ...
200_success's user avatar
3 votes
1 answer
1k views

Calculator with history using Java 8

Yesterday, I saw this post from another user: Calculator with history I started refactoring the code while typing an answer but I end up not posting as an answer because I not sure if my ...
alexpfx's user avatar
  • 504
8 votes
2 answers
8k views

Accessing properties by name with compile-time typesafety

I've recently answered a question here, where the goal is to mimic some functions from System.Reflection in order to avoid it's direct usage as much as possible, ...
Denis's user avatar
  • 8,438
6 votes
1 answer
595 views

Locating the largest Collatz Sequence with memoization

Inspired by this question I wrote a memoized form of the collatz sequence calculator. The idea was to cache the sequence lengths for as many sequences as possible, from 0 to some value. I managed to (...
Der Kommissar's user avatar
10 votes
6 answers
3k views

Too Many Staff Meetings

I recently got in really deep on a question to find the overlapping meetings and I rewrote a bit of the code and added some things to the code, and I would just like a general review of my code and ...
Malachi's user avatar
  • 28.5k
5 votes
1 answer
3k views

Making sure a sentence exists of words in a dictionary

Today on Stack Overflow the following question came https://stackoverflow.com/questions/39393112/find-out-if-string-contains-english-words-only The question itself has following prerequisites: A ...
Icepickle's user avatar
  • 835
9 votes
1 answer
405 views

Scrabble tile-counting challenge

While reviewing this Scrabble Tile Counter, I decided to give it a try myself. Here is the challenge, from Reddit's /r/dailyprogrammer: Description For this challenge we will be using the ...
200_success's user avatar
7 votes
1 answer
1k views

Alternate letters to UpperCase

As an exercise I repeated this Java question, but in Go: Convert string to mixed case The objective is for every second letter to be converted to uppercase. Go string processing is relatively new to ...
rolfl's user avatar
  • 97.2k
6 votes
1 answer
842 views

Shortest knight path

In preparing a review of this question, I decided to rewrite the code from scratch using a more object oriented approach as I suggested in my review. To recapitulate the problem statement, we are ...
Edward's user avatar
  • 65k
10 votes
1 answer
2k views

Read stdin like a dictator

Rags. Introduction All too often I find myself wanting to allow only a certain list of characters to be written to stdin, and only recently did I actually bother ...
cat's user avatar
  • 977
3 votes
1 answer
1k views

Needle in a Haystack

This is a rags-to-riches of some recent "search word in multiple files" questions, such as this deleted question and this. The idea here is to do a case-insensitive word (complete, not partial) ...
h.j.k.'s user avatar
  • 19.2k
7 votes
1 answer
919 views

A generic implementation of Dijkstra

Here is an implementation of Dijkstra As an rags-to-riches version of this Object oriented approach to Dijkstra's algorithm ...
Martin York's user avatar
  • 93.4k
11 votes
3 answers
651 views

Multithreaded Mandelbrot Generator Ver 2

Update: Version 3 is here. My first version was an answer I provided to EBrown for his original post titled "Multithreaded Mandelbrot Generator". My answer had many good things in it, but I felt ...
Rick Davin's user avatar
  • 6,122
11 votes
1 answer
320 views

What's my personality?

This is a rags-to-riches take on this question, specifically an improvement of my original answer there. Copying my interpretation of the calculations involved from my answer: Given a 70-character <...
h.j.k.'s user avatar
  • 19.2k
40 votes
6 answers
3k views

SHOUTY_SNAKE_CASED NUMBERS

WE_ALL_LOVE_SHOUTY_SNAKE_CASE_SO_I_WROTE_A_PROGRAM_FOR_IT!!1! Alright, enough of this. This is a rags-to-riches from this question. The pattern is pretty simple, it takes a ...
IEatBagels's user avatar
  • 12.3k
4 votes
2 answers
562 views

Partitioning a string into chunks

Inspired by this question: Split a string into chunks of the same length The code is designed to work on text elements rather than chars to avoid unicode problems. ...
RobH's user avatar
  • 16.8k
7 votes
2 answers
207 views

99 times drunk on Java

This is a rags-to-riches attempt from this question, based on the popular 99 Bottles of Beer, by (lightly) using Java 8's stream-based processing. Any room for improvement in terms of readability? I ...
h.j.k.'s user avatar
  • 19.2k
5 votes
2 answers
16k views

Capitalize the first letter of all words in a String

A rags-to-riches of A method to capitalize the first letter of all words in a String. To recap the requirements: Please implement this method to capitalize all first letters of the words in the ...
cbojar's user avatar
  • 2,732
11 votes
3 answers
5k views

Fastest possible text template for repeated use?

While reviewing Sending templatized e-mail to a million contacts, I wrote this implementation to illustrate an alternate approach. It is designed to be the fastest possible way to generate templated ...
200_success's user avatar
6 votes
2 answers
552 views

Rock, Paper, Scissors, Lizard and Spock with OOP

Today I saw an extremely interesting question on the Rock, Paper, Scissors, Lizard and Spock game. I've decided to take my swing at it and I've written the following OOP implementation: ...
Ismael Miguel's user avatar
22 votes
5 answers
1k views

Numbers, pairs, and a difference

Problem statement: Write a function which returns the total number of combinations whose difference is k. For example, ...
Simon Forsberg's user avatar
4 votes
1 answer
131 views

Twisting words! (boustrophedon formatting)

I decided to implement properly the Code Golf challenge about twisting strings. I report the assignement verbatim for convenience: Twisting Words! Given a string and a positive integer. You ...
Caridorc's user avatar
  • 27.4k
8 votes
2 answers
290 views

Desktop notifications for queue items

I wasn't satisfied with Simon's alert on the orange alert. I wanted to know if even 1 review item was available, so I made some modifications to the userscript so that it runs on the Review page, and ...
Malachi's user avatar
  • 28.5k
5 votes
1 answer
132 views

How much time is left?

rags-to-riches of Convert seconds to hours, minutes and seconds. In that question, BigDecimal was chosen to be the model class, which doesn't seem like a right fit ...
h.j.k.'s user avatar
  • 19.2k
14 votes
5 answers
663 views

Checking three values are consecutive

This question was recently asked: Determining if three numbers are consecutive It intrigued me, even though it was broken. I have the following implementation I thought would be interesting, and I am ...
rolfl's user avatar
  • 97.2k
3 votes
4 answers
481 views

Are the words isomorph?

Are the words isomorphs? (Code-Golf) This is my non-golfed, readable and linear (quasi-linear?) in complexity take of the above problem. For completeness I include the description: Two words are ...
Caridorc's user avatar
  • 27.4k
7 votes
6 answers
4k views

Super Market Checkout Pricing Strategies

I saw this question and thought it looked like a great opportunity to try my hand at the Strategy Pattern. I've never used it before, but I think I did pretty well. Did I? The code below can also be ...
RubberDuck's user avatar
  • 30.8k
7 votes
1 answer
1k views

Project Euler 67 - Max path through triangle

This is a response to this brute-force version where the algorithm was not intended for review. In this challenge you are prompted to find the path through a large triangular set of numers, similar ...
rolfl's user avatar
  • 97.2k
6 votes
2 answers
573 views

Merging word streams from files

A follow-on, rags-to-riches implementation of The most efficient way to merge two lists in Java The original requirements are to: Identify the distinct values from two input files, and output the ...
rolfl's user avatar
  • 97.2k
3 votes
2 answers
164 views

Toggling html buttons and text

I went through a question on SO, and optimized the code according to OP's requirements. I would like a review if it is done properly or not. Here is the code snippet, there are 2 level buttons, when ...
viral's user avatar
  • 301
7 votes
1 answer
197 views

Project Euler #62 + Java 8 streams

(Inspired by this question) The digits of the cube, 41063625 (3453), can be permuted to produce two other cubes: 56623104 (3843) and 66430125 (4053). In fact, 41063625 is the smallest ...
h.j.k.'s user avatar
  • 19.2k
9 votes
1 answer
6k views

Highest pit - only climbing through the pit once

Problem description: A non-empty zero-indexed array A consisting of N integers is given. A pit in this array is any triplet of integers (P, Q, R) such that: 0 ≤ P < Q < R < N; ...
Simon Forsberg's user avatar
7 votes
1 answer
430 views

Onion Run Festival (or the unexpected anagram for Union of Intervals)

Original question: Union of intervals In the original code, the Interval model class implements Comparable so that an input of <...
h.j.k.'s user avatar
  • 19.2k
19 votes
1 answer
404 views

Streaming Collatz

Challenge The recent question The 3n + 1 algorithm for a range inspired me to investigate a Java-8 dependent streaming mechanism for solving the programming challenge: For any two numbers ...
rolfl's user avatar
  • 97.2k
20 votes
2 answers
5k views

Designing another Coffee Machine Application

After reading Designing a coffee machine yesterday, I decided I could also give the same problem a try. I have used the following problem statement (copied from the given question): Design a ...
skiwi's user avatar
  • 10.6k
12 votes
2 answers
608 views

Finding a word within a pre-defined set using a search string with wildcards

The other day I was intrigued by this question (originally from here): Write a program that answers YES/NO search queries containing * placeholders. Example: if the data you have is (hazem, ahmed,...
janos's user avatar
  • 110k
11 votes
1 answer
520 views

Let's Break Down the Party

This is a rags-to-riches question, the original is here: Coin dispenser program There are three parts to this, a Denomination ...
h.j.k.'s user avatar
  • 19.2k
2 votes
1 answer
5k views

Palindrome Checker with Stack

In my answer to this question, I wrote a new solution. Personally, I would not use a stack, but given that a stack was required, how good is this solution? In this solution, I add half of the word, ...
user avatar