• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Search results from inside ~comp only. Search all groups
    1. Is OneDrive for Linux Mature Enough Yet?

      I'm looking to see if anyone can speak to how life is (good, bad, or meh) with using one of the popular OneDrive clients on a common enough Linux distribution. Ok, so allow me to set the...

      I'm looking to see if anyone can speak to how life is (good, bad, or meh) with using one of the popular OneDrive clients on a common enough Linux distribution.

      Ok, so allow me to set the context...

      • My partner uses Windows laptop, and with next year's end of life on Win10, I need to make decision to advise them on whether we get them another Windows laptop (presumably running Win11), or finally get them to take the plunge on using Linux - (a laptop running some common enough linux distro).
      • I run linux as my personal daily driver on my laptop for more than a decade, and on server side having been using and dabbling with linux since about 2004. So, i will add also that i'm all bought in on the linux, libre/free and open source lifestyle.
      • I'm not a fan of Windows, but not judging that others like my partner use it. By the way, my partner doesn't care about tech nor computing, they simply use applications and move on with their life. (Yes, i have politely nudged them over the years to try linux, but they have been hesitant to do so without a true need, so why rock the love boat, right?)
      • My partner's computing needs are quite basic, but slightly tricky...Here is what i mean:
        • They use a web browser or mobile apps for the vast majority of their compouting/app needs
        • For office suite, they use desktop versions of MS Word and Excel
        • Quite importanrtly, they use OneDrive to sync their files (and there are alot important files for them and our family)

      So, from a computing needs perspective, that's pretty much it. For every other function and need (e.g. email, productivity, etc.), they simply use browser or mobile apps as noted above.

      You might be thinking, well, move them to linux, and if they like Microsoft, then use the Word or Excel browser app, right? Well, they LOATH having to use the browser or mobile versions of Microsoft Office. Being of a certain age, they might be ok with LibreOffice, since it mimics close enough to desktop versions of Word, Excel desktop apps...So, I think the desktop and office suite are less of a problem to find an alternative if needed...
      But, OneDrive, yeah, this is the one app that they won't let go. Not because they love Microsoft (they could careless about the company), but because they have a good trust and experience of its functions to date on Windows. Onedrive has really empowered their workflow. That is, because they jump from browser to mobile app often through their day, etc....the feature of having a file easily and reliably sync (via onedrive) between devices is probably the most important need that they have.

      Now, before anyone says, well try "NextCloud"...yeah, been there and done that. Nextcloud works wonderfully for me (has for years)...but it does not conform exactly to my partner's workflow. I've tried Collabera, but could never get it to work reliably enough. I want to state again, i am a strong, emphatic open source advocate...But if my partner can't get their work done without me constantly diagnosing and fixing things....then its not proper solution for them.

      So, while i have a solid linux or open source option for all of their other needs, Onedrive is the challenge here. So, can anyone advise, how things are with onedrive clients on linux? Any particular client that is worth me looking into? What about a specific linux distro that, maybe possibly works best with a particular onedrive linux client? I should add that my partner is willing to pay for file synching and does NOT want to have me self-host things for this single function since they don't want to have me kill myself in supporting it. So, if there is a valid alternative to onedrive that is awesome on linux, and that they can pay a company to reliably host, that is welcome as well.

      Or, should i simply advise them to stick to Windows through EOL, get them set on Win11 along with native Onedrive, and move on with our lives?

      I'm thankful for anyone's recommendations and advice. Cheers!

      3 votes
    2. Thinking of getting into emacs, any advice?

      Recently I’ve been growing dissatisfied with my current workflow (Obsidian and iA) and looking to try something new, and someone recommended emacs, as long as I was up for the challenge. I figure...

      Recently I’ve been growing dissatisfied with my current workflow (Obsidian and iA) and looking to try something new, and someone recommended emacs, as long as I was up for the challenge. I figure it can’t hurt to try, and if I don’t implement it, well, I’ll have learned something.

      I’m fairly comfortable with CLIs, but will likely use a GUI, and will be using on a Mac.

      Anyone have advice for a total novice?

      17 votes
    3. Women Who Code shutting down

      There isn't any public announcement yet, but they sent out this email to leadership: Dear Women Who Code Community, It is with a heavy heart that we write to inform you of the difficult decision...

      There isn't any public announcement yet, but they sent out this email to leadership:

      Dear Women Who Code Community,

      It is with a heavy heart that we write to inform you of the difficult decision to close Women Who Code, following a vote by the Board of Directors to dissolve the organization. This decision has not been made lightly. It only comes after careful consideration of all options and is due to a variety of factors that have materially impacted our funding sources. We understand that this news may come as a disappointment, and we want to express our deepest gratitude to each and every one of you who have been a part of our journey.

      As a community, we are powerful. For more than a decade, Women Who Code has created a sense of belonging in tech and support for our community, thanks to the dedication and commitment of our members, volunteers, and staff. We have brought together a vibrant community of over 360,000 technologists who deeply care about building an industry that is more diverse, inclusive, and equitable. We’ve delivered more than 20K community-led events, awarded more than $3.5 million in scholarships, held developer conferences and technical summits in tech hubs around the world, logged more than one million high-skilled, leadership-building volunteer hours, given away more than $2.5 million in conference tickets for broader industry engagement, and shared more than 14K job opportunities. Even more than these trackable outputs, we’ve come together to support each other, navigate the industry as a powerful force, share both technical protips and strategies for rising in our careers, and break barriers.

      While so much has been accomplished, our mission is not complete and our vision of a tech industry where diverse women and historically excluded people thrive at every level is not fulfilled. Despite our collective efforts, the challenges we face have become insurmountable and we must confront that what worked for us is no longer working. We are deeply saddened by the difficult decision to dissolve the organanization.

      As we embark on the process of winding down operations, we are committed to ensuring a smooth transition and fulfilling any remaining obligations to the best of our ability. Unfortunately, we will not be able to continue offering any program services, and will be cancelling all upcoming events. We will be refunding any ticket purchases made by members for our upcoming developer conference, WWCode CONNECT 2024.

      Although this chapter is coming to a close, we believe that the spirit of our community will endure and hope that the relationships and experiences you've gained through your involvement with Women Who Code will continue to inspire you in your future endeavors.

      On behalf of the Board of Directors and staff of Women Who Code, we extend our heartfelt thanks for being part of the movement, and encourage you to continue to seek support from other like-minded organizations who authentically support the careers of women in the tech industry and keep inspiring each other as you navigate the industry. It has been an honor and a privilege to serve the mission, and work alongside such passionate individuals.

      Thank you for your understanding and support during this challenging time.

      39 votes
    4. Fun programming challenge: figure out which sets of passports grant visa-free access to the whole world

      Hey there, I wanted to know which sets of passports grant together visa-free access to every country in the world, but I could not easily find that info online. So I figured that I could try to...

      Hey there,

      I wanted to know which sets of passports grant together visa-free access to every country in the world, but I could not easily find that info online. So I figured that I could try to write a small program to determine these sets of passports myself, and then it occurred to me that it would probably be a fun programming challenge to organize, so here we go.


      Here's the challenge.

      1. Scrape the data you need for instance from The Henley Passport Index.
      2. Design a clever algorithm to efficiently find out which are the smallest sets of passports that will grant you visa-free access to every country in the world.
      3. Optional. Allow the user to specify which passports they already hold and find out which sets of passports would complement their passports well.
      4. Optional. Rank the sets of passports by how easy it is to acquire citizenship in those countries.

      The choice of the programming language is yours, bonus points if you write it in assembly 😂

      Feel free to collaborate and share your solutions (the algorithms and the actual results) in the comments, and feel free to share your own twists to the challenge that could make it even more fun & interesting.

      The person with the most clever, efficient and elegant algorithm wins!

      Happy coding folks!

      32 votes
    5. Immersive Labs "Haunted Halloween" Challenges 2023

      Hey everyone! Just wanted to share that Immersive Labs has rolled out their "Haunted Halloween" challenges for 2023. For those unfamiliar, Immersive Labs offers a platform for interactive,...

      Hey everyone! Just wanted to share that Immersive Labs has rolled out their "Haunted Halloween" challenges for 2023. For those unfamiliar, Immersive Labs offers a platform for interactive, gamified learning in the realm of cybersecurity. They've been known to host challenges that test and enhance cyber skills.

      You can sign up for free using code HAUNTEDHOLLOW to try it out hubs.ly/Q026LTZV0.

      Now, I'm not posting this solely out of altruism. I could use some help on the 'Mirrored Mayhem' task.

      Spoiler Alert: Details about the challenge below I've managed to get the RCE. I've crafted a PNG and successfully executed remote code. However, I'm only able to find the 'webapp-token'. I'm at a loss when it comes to the 'user-token' or 'root-token'. The 'whats in the mirror?' file isn't giving me any leads either. I've also got a username/password from it but can't figure out where to use them.

      Would appreciate any pointers or hints from anyone who's tackled this challenge. Thanks in advance!

      4 votes
    6. What is the most advanced or creative program you can create using the LOX programming language?

      Lox is a toy programming language that is designed in Java and C at craftinginterpreters.com. My challenge to you is: given the constraints of the Lox language, what are some creative or advanced...

      Lox is a toy programming language that is designed in Java and C at craftinginterpreters.com.

      My challenge to you is: given the constraints of the Lox language, what are some creative or advanced programs you can create?

      This page provides a rundown of the design of Lox.

      To kick it off, here's a simple function that estimates the value of pi:

      fun estimatePi(rounds) {
      	var pi = 0;
      	var alt = 1;
      	for (var i = 0; i < rounds; i = i + 1) {
      		pi = pi + alt * 4/(2 * i + 1);
      		alt = -alt;
      	}
      	return pi;
      }
      
      print "The value of pi is:";
      print getPi(100000);
      
      3 votes
    7. Programming Challenge: Mini Calendar Display

      It has been a while since the last time we did something like a programming challenge, so here's one for ya. The life story of the author before you get to the recipe I've been working on a little...

      It has been a while since the last time we did something like a programming challenge, so here's one for ya.

      The life story of the author before you get to the recipe

      I've been working on a little "today" website, showing what day it is, if it's a significant date for holiday/independence/... reasons, and one of the things I wanted was a small calendar display that showed the full month and days in each week. Like how XFCE's Clock plugin does it.

      So I got to figuring it out and after finishing it up I thought this could be a nice little programming challenge. It has one input (the date) that can be in any of the rows and columns, and it's up to you to figure out all the rest.

      Here's how mine looks in about 250ish lines of TypeScript (TSX technically) and SCSS.


      The Recipe

      Make a mini calendar display that shows all the days of the current month and at least one day of each adjacent month. So for example for May 2023: the 31 days in May, the 30th of April and the 1st of June should at least be visible.

      It can be in any language with any method of rendering; simple text, TUI/GUI toolkit, web-based, raytraced in some game engine, nixie tubes, whatever.

      Bonus Points

      • Highlight the current day name in the first row, if you're including day names.
      • Highlight the current day number, wherever it is.
      • Highlight the current week row, wherever it is.
      • Differentiate the days of current month and the days of the other adjacent months, wherever they are.

      Some Tips

      The week number

      If your programming language of choice doesn't have a built-in way to get the week number, like JavaScript doesn't, this website may have you covered.

      Testing

      Make sure to test multiple different input dates, I thought I was finished with my display until I tried some other dates and noticed that there were still some bugs left to squash.

      Starting

      If you know what the first day in the calendar should be, counting up is as easy as "one two three"!

      Weeks

      If you use 6 weeks in the display, you will always have enough space to fit all the current month's days and the minimum 1 day of the adjacent month's too.


      Showcase

      If at all possible and with at least a few entries I will try to run all the submissions myself and create a little showcase website for it.

      16 votes
    8. Programming Challenge: Over-engineer obfuscation of a mailto link on a hypothetical webpage

      This is a bit of a silly challenge that came to mind when I saw a discussion about obfuscating mailto links on the unofficial Discord server. This challenge is intentionally meant to be ridiculous...

      This is a bit of a silly challenge that came to mind when I saw a discussion about obfuscating mailto links on the unofficial Discord server. This challenge is intentionally meant to be ridiculous and encourages horrendous solutions that should never see the light of day in actual production code.


      Some Background

      On the internet, bots are an incredibly common. They may do anything from crawling through webpages to map out valid links on the web, to spamming forums with links to scam websites. Among some of the less ethical uses of bots is the collection of any email addresses that might be sitting around in a webpage's source code, either made visible to the user or hidden behind some alternative text. These bots collect these email addresses for any number of purposes, including phishing attempts to hijack accounts.

      Commonly, these emails can be found sitting inside of so-called mailto links, which will open your default mail application and pre-populate the recipient's address, preparing you to send a new email in a single click. It's a safe bet that the vast majority of mailto link implementations aren't very sophisticated, simply providing a snippet that looks much like the following:

      <a href="mailto:johnsmith@example.com">Contact Me</a>
      

      Given the above, most bots will likely only ever scrape a webpage for a link containing href="mailto:. A simple form of obfuscation to combat a bot could be to leave the href attribute empty on initial page load, capture the on click event, dump the mailto email address into the href attribute, and finally remove the on click event handler from the link before re-sending the click event.

      We're not here for simple, however.


      Challenge

      As suggested in the title, the challenge is to over-engineer this obfuscation. There is only one hard requirement:

      Clicking the "Contact Me" link should, to the user's perception, function (mostly) identically to a simple mailto link. Specifically, clicking the link should ultimately result in the user's mail application opening (or being prompted to open) with no further input from the user and the "to" field being correctly pre-populated with the intended email address. This means that captchas and the like are not allowed. Delays in triggering the mail application due to processing layers of obfuscation, however, are expected and acceptable (although "until well after the heat death of the universe" is not an acceptable delay, so let's be reasonable).

      Apart from the requirement above, solutions that require increasingly more sophisticated methods of de-obfuscation for a bot to discover your email address are preferred. The more complicated a bot's design would need to be to discover your email address, and the more painful it is for other programmers to see the abomination you've created, the better.

      CSS is not required. A functioning webpage is not required. An entire web server is not required. A full, working web project including a framework with defined routes, security features, a VM provisioning script, and whatever the fuck else you would need is not required. You can build an actual web project around this if you wish, but code snippets and some comments explaining what does what will be more than sufficient.

      11 votes
    9. What do you think of LeetCode? Did anyone of you succeed thanks to it?

      I've come across this website recently, and I'm genuinely wondering if it's really that useful for passing interviews. For example, I think it can not replace a solid background in algorithms/data...

      I've come across this website recently, and I'm genuinely wondering if it's really that useful for passing interviews.

      For example, I think it can not replace a solid background in algorithms/data structures and maybe CS courses in general.

      7 votes
    10. Information on SaaS companies and enterprise software companies

      I would like to know more about SaaS companies and enterprise software companies from a business and technology perspective - to know about challenges in the industries, what has been...

      I would like to know more about SaaS companies and enterprise software companies from a business and technology perspective - to know about challenges in the industries, what has been revolutionary, what hasn't, where it is headed, etc. Where would be a good place to start on this?

      3 votes
    11. Programming Challenge: Convert between units

      Hi everyone! It's been a long time since last programming challenge list, and here's a nice one I've encountered. If you search for something like 7km to AU, you'll get your answer. But how is it...

      Hi everyone! It's been a long time since last programming challenge list, and here's a nice one I've encountered.

      If you search for something like 7km to AU, you'll get your answer. But how is it done? I don't think they hardcoded all 23 units of distance and every conversion factor between them.

      If you were programming a conversion system - how would you do it?

      First of all, you have input in format that you can specify, for example something like this:

      meter kilometer 1000
      mile kilometer 1.609344
      second minute 60
      ...
      

      Then you should be able answer queries. For example 7 mile meter should convert 7 miles to meters, which is 11265.41.

      Can you design an algorithm that will convert any unit into any other unit?

      Edit: Some conversion rates I extracted from wikipedia:

      ångström
      0.1nm
      astronomical unit
      149597870700m
      attometre
      0.000000000000000001m
      barleycorn
      8.4m
      bohr
      0.00846
      cable length (imperial)
      185.3184m
      cable length
      185.2m
      cable length (US)
      219.456m
      chain (Gunters)
      20.11684m
      cubit
      0.5m
      ell
      1.143m
      fathom
      1.8288m
      femtometre
      0.00000000000001m
      fermi
      0.00000000000001m
      finger
      0.022225m
      finger (cloth)
      0.1143m
      foot (Benoit)
      0.304799735m
      foot (Cape) (H)
      0.314858m
      foot (Clarke's) (H)
      0.3047972654m
      foot (Indian) (H)
      0.304799514m
      foot,metric
      0.31622776602m
      foot,metric (long)
      0.3m
      foot,metric (short)
      0.30m
      foot (International)
      0.3048m
      foot (Sear's) (H)
      0.30479947m
      foot (US Survey)
      0.304800610
      french
      0.0003m
      furlong
      201.168m
      hand
      0.1016m
      inch
      0.0254m
      league
      4828m
      light-day
      25902068371200m
      light-hour
      107925284880m
      light-minute
      17987547480
      light-second
      299792458m
      light-year
      31557600light-second
      line
      0.002116m
      link (Gunter's)
      0.2011684m
      link (Ramsden's; Engineer's)
      0.3048m
      metre
      1m
      m
      1metre
      km
      1000m
      mickey
      0.000127
      micrometre
      0.000001
      mil; thou
      0.0000254
      mil
      10km
      mile (geographical)
      6082foot (International)
      quarter
      0.2286m
      rod
      5.0292m
      rope
      6.096m
      shaku
      0.303 0303m
      span (H)
      0.2286m
      stick (H)
      0.0508m
      toise
      1.949 0363m
      twip
      1.76310
      yard
      0.9144m
      
      17 votes
    12. Python challenges or projects with just the standard library?

      I've been slowly learning python for some months already. I used the Python Crash Course book from No Starch Press, it teaches the basics and then goes on with some projects with pygame,...

      I've been slowly learning python for some months already. I used the Python Crash Course book from No Starch Press, it teaches the basics and then goes on with some projects with pygame, matplotlib, etc.

      However, I feel that my Python skills aren't very good yet, and before learning to use libraries I would like to have a better command of the standard library.

      I have been looking for some book with projects or, even better, challenges using just the standard library, but haven't found any good ones. Most of them either are for absolute beginners, or use additional libraries, or are very technical and without focus on practice.

      Do you know of any good book or resource with challenges or projects that don't depend on additional libraries? Or, do you have any idea for a project or challenge using just the standard library?

      Thanks in advance!

      14 votes
    13. Challenge: defuse this fork bomb

      On lobste.rs I found link to an article from Vidar Holen, the author of shellcheck. He made a fork bomb that is really interesting. Here's the bomb: DO NOT RUN THIS. eval $(echo...

      On lobste.rs I found link to an article from Vidar Holen, the author of shellcheck. He made a fork bomb that is really interesting. Here's the bomb:

      DO NOT RUN THIS.

      eval $(echo "I<RA('1E<W3t`rYWdl&r()(Y29j&r{,3Rl7Ig}&r{,T31wo});r`26<F]F;==" | uudecode)
      

      This may look pretty obvious, but it's harder than you think. I fell for it. twice. Can you find out how this bomb works?

      Warning: executing the bomb will slow down your computer and will force you to restart.
      You can limit impact of the fork bomb by setting FUNCNEST.

      export FUNCNEST=3
      

      Have fun!

      12 votes
    14. Genetic Algorithms

      Introduction to Genetic Algorithms Genetic algorithms can be used to solve problems that are difficult, or impossible to solve with traditional algorithms. Much like neural networks, they provide...

      Introduction to Genetic Algorithms

      Genetic algorithms can be used to solve problems that are difficult, or impossible to solve with traditional algorithms. Much like neural networks, they provide good-enough solution in short amount of time, but rarely find the best one. While they're not as popular as neural networks nor as widely used, they still have their place, as we can use them to solve complicated problems very fast, without expensive training rigs and with no knowledge of math.

      Genetic algorithms can be used for variety of tasks, for example for determining the best radio antenna shape, aerodynamic shapes of cars and planes, wind mill shapes, or various queing problems. We'll use it to print "Hello, World!".

      How does it work?

      Genetic algorithm works in three steps.

      1. Generate random solutions
      2. Test how good they are
      3. Pick the best ones, breed and mutate them, go to step 2

      It works just like evolution in nature. First, we generate randomised solutions to our problem (in this case: random strings of letters).

      Then, we test each solution and give it points, where better solutions gain more points. In our problem, we would give one point for each correct letter in the string.

      Afterwards, we pick the best solutions and breed it together (just combine the strings). It's not bad idea to mutate (or randomize) the string a bit.

      We collect the offsprings, and repeat the process until we find good enough solution.

      Generate random solutions

      First of all, we need to decide in which form we will encode our solutions. In this case, it will be simply string. If we wanted to build race cars, we would encode each solution (each car) as array of numbers, where first number would be size of the first wheel, the second number would be size of the second wheel, etc. If we wanted to build animals that try to find food, fight and survive, we would choose a decision tree (something like this).

      So let's start and make few solutions, or entities. One hundred should be enough.

      from random import randint
      
      goal = "Hello, World!"
      allowed_characters = list("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM ,!")
      
      def get_random_entity(n, string_length):
          entities = []
          for _ in range(0, n):
              entity = ""
              for _ in range(0, string_length):
                  entity += allowed_characters[randint(0, len(allowed_characters)-1)]
              entities.append(entity)
          return entities
      
      print(get_random_entity(100, 13))
      

      Test how good they are

      This is called a "fitness function". Fitness function determines how good a solution is, be it a car (travel distance), animal (food gathered), or a string (number of correct letters).

      The most simple function we can use right now will simply count correct letters. If we wanted, we could make something like Levenshtein distance instead.

      def get_fitness(entity):
          points = 0
          for i in range(0, len(entity)):
              if goal[i] == entity[i]:
                  points += 1
          return points
      

      Crossover and mutation

      Now it's time to select the best ones and throw away the less fortunate entities. Let's order entities by their fitness.

      Crossover is a process, when we take two entities (strings) and breed them to create new one. For example, we could just give the offspring one part from one parent and another part from second parent.

      There are many ways how to do this, and I encourage you to try multiple approaches when you will be doing something like this.

      P:  AAAABBB|BCCCC
      P:  DDDDEEE|FGGGG
      
      F1: AAAABBB|FGGGG
      

      Or we can just choose at random which letter will go from which parent, which works the best here. After we have the offsprint (F1), we should mutate it. What if we were unfortunate, and H (which we need for our Hello, World!) was not in any of the 100 entities? So we take the string and for each character of the string, there is a small chance to mutate it - change it at random.

      F1:  ADDDEBEFGCGG
      F1`: ADHDEBEFGCGG
      

      And it's done. Now kill certain part of old population. I don't know which percentage is best, but I usually kill about 90% of old population. The 90% that we killed will be replaced by new offsprings.

      There is just one more thing: which entities do we select for crossover? It isn't bad idea - and it generally works just fine - to just give better entities higher chance to breed.

      def get_offspring(first_parent, second_parent, mutation_chance):
          new_entity = ""
          for i in range(0, len(first_parent)):
              if randint(0, 100) < mutation_chance:
                  new_entity += allowed_characters[randint(0, len(allowed_characters)-1)]
              else:
                  if randint(0, 1) == 0:
                      new_entity += first_parent[i]
                  else:
                      new_entity += second_parent[i]
          return new_entity
      

      When we add everything together, we get this output:

      Generation 1, best score: 2 ::: QxZPjoptHfNgX
      Generation 2, best score: 3 ::: XeNlTOQuAZjuZ
      Generation 3, best score: 4 ::: weolTSQuoZjuK
      Generation 4, best score: 5 ::: weTgnC uobNdJ
      Generation 5, best score: 6 ::: weTvny uobldb
      Generation 6, best score: 6 ::: HellSy mYbZdC
      Generation 7, best score: 7 ::: selOoXBWoAKn!
      Generation 8, best score: 8 ::: HeTloSoWYZlh!
      Generation 9, best score: 8 ::: sellpX WobKd!
      Generation 10, best score: 9 ::: welloq WobSdb
      Generation 11, best score: 9 ::: selloc WoZjd!
      Generation 12, best score: 10 ::: wellxX WoVld!
      Generation 13, best score: 10 ::: welltX World!
      Generation 14, best score: 10 ::: welltX World!
      Generation 15, best score: 10 ::: welltX World!
      Generation 16, best score: 11 ::: zellov Wobld!
      Generation 17, best score: 11 ::: Hellty World!
      Generation 18, best score: 11 ::: welloX World!
      Generation 19, best score: 11 ::: welloX World!
      Generation 20, best score: 11 ::: welloX World!
      Generation 21, best score: 12 ::: welloX World!
      Generation 22, best score: 12 ::: Helloy World!
      Generation 23, best score: 12 ::: Helloy World!
      Generation 24, best score: 12 ::: Helloy World!
      Generation 25, best score: 12 ::: Helloy World!
      Generation 26, best score: 12 ::: Helloy World!
      Generation 27, best score: 12 ::: Helloy World!
      Generation 28, best score: 12 ::: Helloy World!
      Generation 29, best score: 12 ::: Helloy World!
      Generation 30, best score: 12 ::: Helloy World!
      Generation 31, best score: 12 ::: Helloy World!
      Generation 32, best score: 12 ::: Helloy World!
      Generation 33, best score: 12 ::: Helloy World!
      Generation 34, best score: 13 ::: Helloy World!
      Generation 35, best score: 13 ::: Hello, World!
      

      As we can see, we find pretty good solution very fast, but it takes very long to find perfect solution. The complete code is here.

      Maintaining diversity

      When we solve difficult problems, it starts to be increasingly important to maintain diversity. When all your entities are basically the same (which happened in this example), it's difficult to find other solutions than those that are almost the same as the currently best one. There might be a much better solution, but we didn't find it, because all solutions that are different to currently best one are discarded. Solving this is the real challenge of genetic algorithms. One of the ideas is to boost diverse solutions in fitness function. So for every solution, we compute distance to the current best solutions and add bonus points for distance from it.

      20 votes
    15. Programming Challenge: Text compression

      In an effort to make these weekly, I present a new programming challenge. The challenge this week is to compress some text using a prefix code. Prefix codes associate each letter with a given bit...

      In an effort to make these weekly, I present a new programming challenge.

      The challenge this week is to compress some text using a prefix code. Prefix codes associate each letter with a given bit string, such that no encoded bitstring is the prefix of any other. These bit strings are then concatenated into one long integer which is separated into bytes for ease of reading. These bytes can be represented as hex values as well. The provided prefix encoding is as follows:

      char value char value
      ' ' 11 'e' 101
      't' 1001 'o' 10001
      'n' 10000 'a' 011
      's' 0101 'i' 01001
      'r' 01000 'h' 0011
      'd' 00101 'l' 001001
      '~' 001000 'u' 00011
      'c' 000101 'f' 000100
      'm' 000011 'p' 0000101
      'g' 0000100 'w' 0000011
      'b' 0000010 'y' 0000001
      'v' 00000001 'j' 000000001
      'k' 0000000001 'x' 00000000001
      'q' 000000000001 'z' 000000000000

      Challenge

      Your program should accept a lowercase string (including the ~ character), and should output the formatted compressed bit string in binary and hex. Your final byte should be 0 padded so that it has 8 bits as required. For your convenience, here is the above table in a text file for easy read-in.

      Example

      Here is an example:

      $> tildes ~comp
      10010100 10010010 01011010 10111001 00000010 11000100 00110000 10100000
      94 92 5A B9 02 C4 30 A0
      

      Bonuses

      1. Print the data compression ratio for a given compression, assuming the original input was encoded in 8 bit ASCII (one byte per character).
        2. Output the ASCII string corresponding to the encoded byte string in addition to the above outputs.
      2. @onyxleopard points out that many bytes won't actually be valid ASCII. Instead, do as they suggested and treat each byte as an ordinal value and print it as if encoded as UTF-8.
      3. An input prefixed by 'D' should be interpreted as an already compressed string using this encoding, and should be decompressed (by inverting the above procedure).

      Previous Challenges (I am aware of prior existing ones, but it is hard to collect them as they were irregular. Thus I list last week's challenge as 'Week 1')
      Week 1

      13 votes
    16. Programming Challenge: Dice Roller

      Its been a while since we did one of these, which is a shame. Create a program that takes is an input of the type: "d6 + 3" or "2d20 - 5", and return a valid roll. The result should display both...

      Its been a while since we did one of these, which is a shame.

      Create a program that takes is an input of the type: "d6 + 3" or "2d20 - 5", and return a valid roll.
      The result should display both the actual rolls as well as the final result. The program should accept any valid roll of the type 'xdx'
      Bonuses:

      • Multiplication "d6 * 3"
      • Division "d12 / 6"
      • Polish notation "4d6 * (5d4 - 3)"

      As a side note, it would be really cool if weekly programming challenges became a thing

      33 votes
    17. I challenge you to use Epiphany for a week!

      When Edge died, I got worried about loosing competition to the Blink engine and as such, I went exploring other alternatives to realize.. there's not a whole lot, there's blink, gecko and webkit....

      When Edge died, I got worried about loosing competition to the Blink engine and as such, I went exploring other alternatives to realize.. there's not a whole lot, there's blink, gecko and webkit.

      So with that, I decided to try epiphany - Gnome's web browser. It uses Webkit which is what Blink was forked from so it's not terribly different in theory but the years apart has made that more apparent. It's fairly elegant in my opinion and it lacks some features, sure.


      Anyways, to get to what I wanted to do this week, well, I'd like to challenge you all to use it for a week, mostly for bug hunting purposes and possibly to throw ideas at the project. Worth mentioning, I'm not affiliated with the project, just a user.

      So to make sure we're all on the same page, we'll use the development Epiphany flatpak, this way we can be sure that the problem is in the current codebase. So, to install it :

      Let's install the gnome-nightly repos as per instructions here :

      flatpak remote-add --if-not-exists gnome-nightly https://sdk.gnome.org/gnome-nightly.flatpakrepo
      flatpak remote-add --if-not-exists gnome-apps-nightly --from https://sdk.gnome.org/gnome-apps-nightly.flatpakrepo
      

      Then, let's install the development version by doing so :

      flatpak install org.gnome.Epiphany.Devel
      

      Then just launch it and have fun with it!


      if you run into any bugs, look at the contribution guide here and report the bugs in the repo after checking that the bug is not already present of course!

      12 votes
    18. Coding Challenge - Design network communication protocol

      Previous challenges It's time for another coding challenge! This challenge isn't mine, it's this challenge (year 5, season 3, challenge 3) by ČVUT FIKS. The task is to design a network...

      Previous challenges

      It's time for another coding challenge!

      This challenge isn't mine, it's this challenge (year 5, season 3, challenge 3) by ČVUT FIKS.

      The task is to design a network communication protocol. You're sending large amount of bits over the network. The problem is that network is not perfect and the message sometimes arrives corrupted. Design a network protocol, that will guarantee that the decoded message will be exactly same as the message that was encoded.

      MESSAGE => (encoding) => message corrupted => (decoding) => MESSAGE
      

      Corruption

      Transmitting the message might corrupt it and introduce errors. Each error in a message (there might be more than one error in a single message) will flip all following bits of the message.

      Example:

      011101 => 011|010
      

      (| is place where an error occured).

      There might be more than one error in a message, but there are some rules:

      • Minimum distance between two errors in a single message is k

      • Number of bits between two errors is always odd number

      According to these rules, describe a communication protocol, that will encode a message, and later decode message with errors.

      Bonus

      • Guarantee your protocol will work always - even when errors are as common as possible

      • Try to make the protocol as short as possible.

      8 votes
    19. Programming Challenge - Find path from city A to city B with least traffic controls inbetween.

      Previous challenges Hi, it's been very long time from last Programming Challenge, and I'd like to revive the tradition. The point of programming challenge is to create your own solution, and if...

      Previous challenges

      Hi, it's been very long time from last Programming Challenge, and I'd like to revive the tradition.

      The point of programming challenge is to create your own solution, and if you're bored, even program it in your favourite programming language. Today's challenge isn't mine. It was created by ČVUT FIKS (year 5, season 2, challenge #4).

      You need to transport plans for your quantum computer through Totalitatia. The problem is, that Totalitatia's government would love to have the plans. And they know you're going to transport the computer through the country. You'll receive number N, which denotes number of cities on the map. Then, you'll get M paths, each going from one city to another. Each path has k traffic controls. They're not that much effective, but the less of them you have to pass, the better. Find path from city A to city B, so the maximum number of traffic controls between any two cities is minimal. City A is always the first one (0) and city B is always the last one (N-1).

      Input format:

      N
      M
      A1 B1 K1
      A2 B2 K2
      ...
      

      On the first two lines, you'll get numbers N (number of cities) and M (number of paths). Than, on next M lines, you'll get definition of a path. The definition looks like 1 2 6, where 1 is id of first city and 2 is id of second city (delimited by a space). You can go from city 1 to city 2, or from city 2 to city 1. The third number (6) is number of traffic controls.

      Output format:

      Single number, which denotes maximum number of traffic controls encountered on one path.

      Hint: This means, that path that goes via roads with numbers of traffic controls 4 4 4 is better than path via roads with numbers of traffic controls 1 5 1. First example would have output 4, the second one would have output 5.

      Example:

      IN:

      4
      5
      0 1 3
      0 2 2
      1 2 1
      1 3 4
      2 3 5
      

      OUT:

      4
      

      Solution: The optimal path is either 0 2 1 3 or 0 1 3.

      Bonus

      • Describe time complexity of your algorithm.
      • If multiple optimal paths exist, find the shortest one.
      • Does your algorithm work without changing the core logic, if the source city and the target city is not known beforehand (it changes on each input)?
      • Do you use special collection to speed up minimum value search?

      Hints

      Special collection to speed up algorithm

      13 votes
    20. Why open source projects don't charge (while keeping the code open)?

      I'd gladly pay a reasonable price for professional packages/support for programs like Emacs/Melpa, Debian, and Xfce. As a user, I empathize with the complaints by developers that are constantly...

      I'd gladly pay a reasonable price for professional packages/support for programs like Emacs/Melpa, Debian, and Xfce. As a user, I empathize with the complaints by developers that are constantly overworked. Even if this doesn't generate enough money to pay for everything, it might be enough to hire someone to handle the issues and communities, something that clearly drains their efforts, especially because programmers tend to prefer technical challenges rather than dealing with people.

      I understand that many projects accept donations, but I think providing an actual reward (even if its something minimal, like an updated package instead of having to build it from source) might be a good way to get resources and avoid developer burndown.

      11 votes
    21. Programming Challenge - It's raining!

      Hi everyone, it's been 12 days since last programming challenge. So here's another one. The task is to make an algorithm that'll count how long would it take to fill system of lakes with water....

      Hi everyone, it's been 12 days since last programming challenge. So here's another one. The task is to make an algorithm that'll count how long would it take to fill system of lakes with water.

      It's raining in the forest. The forest is full of lakes, which are close to each other. Every lake is below the previous one (so 1st lake is higher than 2nd lake, which is higher than 3rd lake). Lakes are empty at the beginning, and they're filling at rate of 1l/h. Once a lake is full, all water that'd normally fall into the lake will flow to the next lake.

      For example, you have lakes A, B, and C. Lake A can hold 1 l of water, lake B can hold 3 l of water and lake C can hold 5 l of water. How long would it take to fill all the lakes?
      After one hour, the lakes would be: A (1/1), B (1/3), C(1/5). After two hours, the lakes would be: A(1/1), B(3/3), C(2/5) (because this hour, B received 2l/h - 1l/h from the rain and 1l/h from lake A). After three hours, the lakes would be: A(1/1), B(3/3), C(5/5). So the answer is 3. Please note, that the answer can be any rational number. For example if lake C could hold only 4l instead of 5, the answer would be 2.66666....

      Hour 0:

      
      \            /
        ----(A)----
                             \                /
                              \              /
                               \            /
                                ----(B)----
                                                   \           /
                                                    \         /
                                                     \       /
                                                     |       |
                                                     |       |
                                                      --(C)--
      

      Hour 1:

      
      \============/
        ----(A)----
                             \                /
                              \              /
                               \============/
                                ----(B)----
                                                   \           /
                                                    \         /
                                                     \       /
                                                     |       |
                                                     |=======|
                                                      --(C)--
      

      Hour 2:

                  ==============
      \============/           |
        ----(A)----            |
                             \================/
                              \==============/
                               \============/
                                ----(B)----
                                                   \           /
                                                    \         /
                                                     \       /
                                                     |=======|
                                                     |=======|
                                                      --(C)--
      

      Hour 3:

                  ==============
      \============/           |
        ----(A)----            |             ========
                             \================/       |
                              \==============/        |
                               \============/         |
                                ----(B)----           |
                                                   \===========/
                                                    \=========/
                                                     \=======/
                                                     |=======|
                                                     |=======|
                                                      --(C)--
      

      Good luck everyone! Tell me if you need clarification or a hint. I already have a solution, but it sometimes doesn't work, so I'm really interested in seeing yours :-)

      21 votes
    22. Meta Discussion: Is there interest in topics concerning code quality?

      I've posted a few lengthy topics here outside of programming challenges, and I've noticed that the ones that seem to have spurred the most interest and generated some discussion were ones that...

      I've posted a few lengthy topics here outside of programming challenges, and I've noticed that the ones that seem to have spurred the most interest and generated some discussion were ones that were directly related to code quality. To avoid falling for confirmation bias, though, I thought I would ask directly.

      Is there generally a greater interest in code quality discussions? If so, then what kind of things are you interested in seeing in those discussions? What do you prefer not to see? If not, then what kinds of programming-related discussions would you prefer to see more of? What about non-programming discussions?

      Also, is there any interest in an informal series of topics much like the programming challenges or the a layperson's introduction to... series (i.e. decentralized and available for anyone to participate whenever)? Personally, I'd be interested in seeing more on the subject from others!

      17 votes
    23. Programming Challenge: Shape detection.

      The programming challenges have kind of come to a grinding halt recently. I think it's time to get another challenge started! Given a grid of symbols, representing a simple binary state of...

      The programming challenges have kind of come to a grinding halt recently. I think it's time to get another challenge started!

      Given a grid of symbols, representing a simple binary state of "filled" or "unfilled", determine whether or not a square is present on the grid. Squares must be 2x2 in size or larger, must be completely solid (i.e. all symbols in the NxN space are "filled"), and must not be directly adjacent to any other filled spaces.

      Example, where 0 is "empty" and 1 is "filled":

      000000
      011100
      011100
      011100
      000010
      
      // Returns true.
      
      000000
      011100
      011100
      011110
      000000
      
      // Returns false.
      
      000000
      011100
      010100
      011100
      000000
      
      // Returns false.
      

      For those who want a greater challenge, try any of the following:

      1. Get a count of all squares.
      2. Detect squares that are touching (but not as a rectangle).
      3. Detect other specific shapes like triangles or circles (you will need to be creative).
      4. If doing (1) and (3), count shapes separately based on type.
      5. Detect shapes within unfilled space as well (a checkerboard pattern is a great use case).
      13 votes
    24. Programming Challenge: Build an Interpreter

      Hello everyone! It has been a while since last programming challenge, it's time for another one! This week's goal would be to build your own interpreter. Interpreter is program that receives input...

      Hello everyone! It has been a while since last programming challenge, it's time for another one!

      This week's goal would be to build your own interpreter.

      Interpreter is program that receives input and executes it. For example Python is interpreted language, meaning you are actually writing instructions for the interpreter, which does the magic.

      Probably the easiest interpereter to write is Brainfuck interpreter. If someone here doesn't know, Brainfuck is programming language, which contains following instructions: ,.<>[]-+. Other characters are ignored. It has memory in form of array of integers. At the start, pointer that points to one specific memory cell points to cell 0. We can use < to move pointer to left (decrement) and > to move pointer to right (increment). . can be used to print value of cell the pointer is currently pointing to (ascii). , can be used to read one character from stdin and write it to memory. [ is beggining of loop and ] is end of loop. Loops can be nested. Loop is terminated when we reach ] character and current value in memory is equal to 0. - can be used to decrement value in memory by 1 and + can be used to increment value in memory by 1. Here's Hello World:

      ++++++++++[>+++++++>++++++++++>+++>+<<<<
      -]>++.>+.+++++++..+++.>++.<<++++++++++++
      +++.>.+++.------.--------.>+.>.
      

      People with nothing to do today can attemp to make an interpreter for the Taxi programming language.

      You can even make your own language! There are no limits for this challenge.

      23 votes
    25. Breaking all the rules

      In most of my programming, I try and remain professional, and do things in a readable, maintainable way, that doesn't involve pushing the language to breaking point. But, occasionally, I give...

      In most of my programming, I try and remain professional, and do things in a readable, maintainable way, that doesn't involve pushing the language to breaking point.

      But, occasionally, I give myself free reign. What if you didn't care about the programmer who came after you? What if you didn't care about what a programmer should do in a certain circumstance?

      For myself, over the years I've written and rewritten a C library, I like to call CNoEvil. Here's a little taste of what you could do:

      #define EVIL_IO
      #define EVIL_COROUTINE
      #include "evil.h"
      
      proc(example, int)
        static int i = 0;
        coroutine();
        While 1 then
          co_return(++i);
        end
        co_end();
        return i;
      end
      
      Main then
        displayln(example());
        displayln(example());
      end
      

      (And yes, that compiles. Without warnings. Even with -Wpedantic.)

      So... Here's the challenge:

      Ignoring the rules, and best practices... How can you take your favourite programming language... And make it completely unrecogniseable?

      (Might be best to choose a language with macros, like Nim, Rust, any of the Lisps. Though, you can still do some impressively awful things in Java or Python, thanks to overloading inbuilt classes.)

      Challenge Ideas:

      • Make Python look like C
      • Make Java look like Python
      • Make anything look like BrainFuck

      I don’t know how to really explain my fascination with programming, but I’ll try. To somebody who does it, it’s the most interesting thing in the world. It’s a game much more involved than chess, a game where you can make up your own rules and where the end result is whatever you can make of it. - Linus Torvalds

      21 votes
    26. XML Data Munging Problem

      Here’s a problem I had to solve at work this week that I enjoyed solving. I think it’s a good programming challenge that will test if you really grok XML. Your input is some XML such as this:...

      Here’s a problem I had to solve at work this week that I enjoyed solving. I think it’s a good programming challenge that will test if you really grok XML.

      Your input is some XML such as this:

      <DOC>
      <TEXT PARTNO="000">
      <TAG ID="3">This</TAG> is <TAG ID="0">some *JUNK* data</TAG> .
      </TEXT>
      <TEXT PARTNO="001">
      *FOO* Sometimes <TAG ID="1">tags in <TAG ID="0">the data</TAG> are nested</TAG> .
      </TEXT>
      <TEXT PARTNO="002">
      In addition to <TAG ID="1">nested tags</TAG> , sometimes there is also <TAG ID="2">junk</TAG> we need to ignore .
      </TEXT>
      <TEXT PARTNO="003">*BAR*-1
      <TAG ID="2">Junk</TAG> is marked by uppercase characters between asterisks and can also optionally be followed by a dash and then one or more digits . *JUNK*-123
      </TEXT>
      <TEXT PARTNO="004">
      Note that <TAG ID="4">*this*</TAG> is just emphasized . It's not <TAG ID="2">junk</TAG> !
      </TEXT>
      </DOC>
      

      The above XML has so-called in-line textual annotations because the XML <TAG> elements are embedded within the document text itself.

      Your goal is to convert the in-line XML annotations to so-called stand-off annotations where the text is separated from the annotations and the annotations refer to the text via slicing into the text as a character array with starting and ending character offsets. While in-line annotations are more human-readable, stand-off annotations are equally machine-readable, and stand-off annotations can be modified without changing the document content itself (the text is immutable).

      The challenge, then, is to convert to a stand-off JSON format that includes the plain-text of the document and the XML tag annotations grouped by their tag element IDs. In order to preserve the annotation information from the original XML, you must keep track of each <TAG>’s starting and ending character offset within the plain-text of the document. The plain-text is defined as the character data in the XML document ignoring any junk. We’ll define junk as one or more uppercase ASCII characters [A-Z]+ between two *, and optionally a trailing dash - followed by any number of digits [0-9]+.

      Here is the desired JSON output for the above example to test your solution:

      {
        "data": "\nThis is some data .\n\n\nSometimes tags in the data are nested .\n\n\nIn addition to nested tags , sometimes there is also junk we need to ignore .\n\nJunk is marked by uppercase characters between asterisks and can also optionally be followed by a dash and then one or more digits . \n\nNote that *this* is just emphasized . It's not junk !\n\n",
        "entities": [
          {
            "id": 0,
            "mentions": [
              {
                "start": 9,
                "end": 18,
                "id": 0,
                "text": "some data"
              },
              {
                "start": 41,
                "end": 49,
                "id": 0,
                "text": "the data"
              }
            ]
          },
          {
            "id": 1,
            "mentions": [
              {
                "start": 33,
                "end": 60,
                "id": 1,
                "text": "tags in the data are nested"
              },
              {
                "start": 80,
                "end": 91,
                "id": 1,
                "text": "nested tags"
              }
            ]
          },
          {
            "id": 2,
            "mentions": [
              {
                "start": 118,
                "end": 122,
                "id": 2,
                "text": "junk"
              },
              {
                "start": 144,
                "end": 148,
                "id": 2,
                "text": "Junk"
              },
              {
                "start": 326,
                "end": 330,
                "id": 2,
                "text": "junk"
              }
            ]
          },
          {
            "id": 3,
            "mentions": [
              {
                "start": 1,
                "end": 5,
                "id": 3,
                "text": "This"
              }
            ]
          },
          {
            "id": 4,
            "mentions": [
              {
                "start": 289,
                "end": 295,
                "id": 4,
                "text": "*this*"
              }
            ]
          }
        ]
      }
      

      Python 3 solution here.

      If you need a hint, see if you can find an event-based XML parser (or if you’re feeling really motivated, write your own).

      4 votes
    27. Programming Challenge: Polygon analysis.

      It's time for another programming challenge! Given a list of coordinate pairs on a 2D plane that describe the vertices of a polygon, determine whether the polygon is concave or convex. Since a...

      It's time for another programming challenge!

      Given a list of coordinate pairs on a 2D plane that describe the vertices of a polygon, determine whether the polygon is concave or convex.

      Since a polygon could potentially be any shape if we don't specify which vertices connect to which, we'll assume that the coordinates are given in strict order such that adjacent coordinates in the list are connected. Specifically, if we call the list V[1, n] and say that V[i] <-> V[j] means "vertex i and vertex j are connected", then for each arbitrary V[i] we have V[i-1] <-> V[i] <-> V[i+1]. Moreover, since V[1] and V[n] are at the ends of the list, V[1] <-> V[n] holds (i.e. the list "wraps around").

      Finally, for simplicity we can assume that all coordinates are unique, that all polygon descriptions generate valid polygons with 3 or more non-overlapping sides, and that, yes, we're working with coordinates that exist in the set of real numbers only. Don't over-complicate it :)

      For those who want an even greater challenge, extend this out to work with 3D space!

      8 votes
    28. Programming Challenge: Counting isolated regions.

      Another week, another challenge! This time, assume you're given a grid where each . represents an empty space and each # represents a "wall". We'll call any contiguous space of .s a "region". You...

      Another week, another challenge!

      This time, assume you're given a grid where each . represents an empty space and each # represents a "wall". We'll call any contiguous space of .s a "region". You can also think of a grid with no walls the "base" region. The walls may subdivide the base region into any number of isolated sub-regions of any shape or size.

      Write a program that will, given a grid description, compute the total number of isolated regions.

      For example, the following grid has 5 isolated regions:

      ....#....#
      ....#.###.
      ....#.#.#.
      #...#..#..
      .#..#...#.
      
      16 votes
    29. Programming Challenge: Compute the shortest path to visit all target spots on a grid.

      Let's do something a little more challenging this time. Given an MxN grid of arbitrary size, and given a random starting place on that grid and a list of points to visit, find the shortest path...

      Let's do something a little more challenging this time.

      Given an MxN grid of arbitrary size, and given a random starting place on that grid and a list of points to visit, find the shortest path such that you visit all of them. Path lengths will be computed using taxicab distances rather than strict coordinate distance calculations.

      There are no restrictions on expected input this time. Output should be the total distance traveled between points.


      Example

      Assume that we use the character # to denote a spot on the grid, the character @ to denote your starting point, and the character * to denote a place on the grid that you're required to visit. One such grid may look something like this:

      ######
      ######
      **####
      #*####
      #*#*##
      #@####
      ######
      

      In this case, let's say that the bottom-left point on the grid is point (0, 0) and we're starting on point (1, 1). One valid solution would be to move to point (3, 2), then (1, 2), then (1, 3), then (1, 4), and finally (0, 4). The shortest path available is thus 8. Note that it's not enough just to visit the next nearest point on the grid!

      15 votes
    30. Programming Mini-Challenge: KnightBot

      Another programming mini-challenge for you. It's been a month since the first one and that seemed to be rather successful. (I appreciate that there are other challenges on here but trying to sync...

      Another programming mini-challenge for you. It's been a month since the first one and that seemed to be rather successful. (I appreciate that there are other challenges on here but trying to sync with them seems tricky!)

      A reminder:
      I'm certain that many of you might find these pretty straight forward, but I still think there's merit in sharing different approaches to simple problems, including weird-and-wonderful ones.


      KnightBot


      Info

      You will be writing a small part of a Chess program, specifically focusing on the Knight, on an 8 x 8 board.


      Input

      The top-left square of the board will have index 0, and the bottom-right square will have index 63.

      • The first input is the starting square of the knight.
      • The second input is the requested finishing square of the knight.
      • The third input is the number of maximum moves allowed.

      Output

      The expected outcome is either True or False, determined by whether or not the Knight can reach the requested finishing square within the number of allowed moves when stating on the starting square.

      e.g. The expected output for the input 16, 21, 4 is True since the Knight can move 16->33->27->21, which is 3 moves.
      

      Extensions

      Some additional ideas for extending this challenge...

      1. Instead of an 8x8, what if the board was nxn?
      2. Instead of "within x moves", what if it was "with exactly x moves?"
      3. Instead of a traditional Knight's move (2 long, 1 short), what if it was n long and m short?
      4. What if the board was infinite?
      5. What if the board looped back around when crossing the edges? (e.g. the square to the right of 7 is 0)
      17 votes
    31. Programming Challenge: Reverse Polish Notation Calculator

      It's been nearly a week, so it's time for another programming challenge! This time, let's create a calculator that accepts reverse Polish notation (RPN), also known as postfix notation. For a bit...

      It's been nearly a week, so it's time for another programming challenge!

      This time, let's create a calculator that accepts reverse Polish notation (RPN), also known as postfix notation.

      For a bit of background, RPN is where you take your two operands in an expression and place the operator after them. For example, the expression 3 + 5 would be written as 3 5 +. A more complicated expression like (5 - 3) x 8 would be written as 5 3 - 8 x, or 8 5 3 - x.

      All your program has to do is accept a valid RPN string and apply the operations in the correct order to produce the expected result.

      18 votes
    32. Programming Challenge: Merge an arbitrary number of arrays in sorted order.

      It looks like it's been over a week and a half since our last coding challenge, so let's get one going. This challenge is a relatively simple one, but it's complex enough that you can take a...

      It looks like it's been over a week and a half since our last coding challenge, so let's get one going. This challenge is a relatively simple one, but it's complex enough that you can take a variety of different approaches to it.

      As the title suggests, write a program that accepts an arbitrary number of arrays, in whatever form or manner you see fit (if you want to e.g. parse a potentially massive CSV file, then go nuts!), and returns a single array containing all of the elements of the other arrays in sorted order. That's it!

      Bonus points for creative, efficient, or generalized solutions!

      24 votes