GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have some legitimate challenges for you. If you are wanting to sprain your brain a little.
Make webkit2gtk work with youtube without core dumping.
Make Qt5/Qt6webengine answer query requests, so that you can get past the square of "Choose all squares with traffic lamps" without going around in circles infinitely.
Make a Python Tk/Tcl browser that has a javascript engine.
Recompile dillo so that it uses ssl3.
A simple challenge. Make it snow in a terminal. Like this for an example:
Code:
#!/usr/bin/bash
declare -A sf
declare -A lf
clear
l=$(($(tput lines) + 1))
c=$(($(tput cols) + 1))
move() {
i="$1"
if [ "${sf[$i]}" = "" ] || [ "${sf[$i]}" = "$l" ]; then
sf[$i]=0
elif [ "${lf[$i]}" != "" ]; then
printf "\033[%s;%sH \033[0;0H" "${lf[$i]}" "$i"
fi
printf "\033[%s;%sH*\033[0;0H" "${sf[$i]}" "$i"
lf[$i]="${sf[$i]}"
sf[$i]="$((${sf[$i]} + 1))"
}
while :; do
i=$(($RANDOM % $c))
move "$i"
for x in "${!lf[@]}"; do
move "$x"
done
sleep 0.07
done
Oh, I've got one here. I won't post it. Make the snow flakes fall at different rates. Make the snow blow sideways every now and then. make the snow pile up at the bottom.
I also had a lot of fun solving this "circle of squares problem" also a few years back. Though that one ended up eating much more than a few hours by the time I'd finished.
Or, how about converting between decimal and Roman Numerals. That should be a nice quick one.
My favorite was the Eight Queens Puzzle. Find all of the positions on a standard chessboard where "8 Queens" can be positioned, but none of them can capture the other.
No fair(!) "Googling" the answer. (As is: "reading the entirety of(!) the WikiPedia article that I linked to!) If you resort to this, you are entirely missing the point. Instead: "read just page one," to understand the nature of the problem, then ponder how you would go about solving it.
This is a classic example where "a very optimal solution actually exists." But let it be up to you to find out what it is – entirely without help. (Let's just say that: "if you are thinking about 'eight nested loops' without thinking deeper," you are definitely doing it wrong.) The "right approach" will spit out all 92 solutions almost instantly. (With or without Python. The first solution I saw was in BASIC.)
Last edited by sundialsvcs; 05-12-2024 at 08:56 PM.
Create a program that solves(shows the steps) of a 3x3 sliding puzzle. Note... Not all combinations of a 3x3 sliding puzzle can be solved. That's why I included a link to 3x3 puzzles that are solvable.
Back when the online game "Terracaching" was a thing, I encountered a Puzzle Terracache series which involved, among other things, "the mother of all Sudoku puzzles," and one of those "logic problems" with 21 statements. (Stuff like: "The man in the orange hat does not have a zebra as a pet.")
I had fun solving both of these using the (free and open source, "GNU")gprolog programming language, which features a "finite-domain (FD) problem solver" built in. For a geek like me, it was both great fun and very instructive to research and then learn how to use this tool to solve both kinds of problems. (And, to politely inform the cache owner that "statement #20 does not contribute to your logic problem and can be omitted.")
"Logic Programming" is a very interesting non-procedural programming discipline in which your "program" expresses the problem to be solved, not the way that the system will solve it.
Last edited by sundialsvcs; 05-13-2024 at 05:17 PM.
Write a C program, using no library calls, allocating no memory, using no temporary holding variables, to reverse a string in place.
Advanced: Sort a string into alphabetical, or numerical order, depending on the contents, all of one type, within the same original constraints. Or sort a mixed alphanumeric string placing numerals in order either before or after the alphabetically sorted characters.
Not sure that I can meet those requirements. Here is a start.
Common need which I totally get, you wanted printf() to validate. You could however replace that with your own code but that's taking the intent too far. Similarly you could validate in a debugger, neeeing no output capability. Not specifically an instructor however I probably would guide students to validate but leave that out in a submitted solution, or have them first develop a replacement output logger tool and use that. Anyways great job! I hope the OP if still paying attention appreciates it.
And one interesting interpretation, because I would reverse the entire command line string, as opposed to each element, but no argument. I feel you get it and similarly could sort also. +100
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.