-
16 votes
-
Better CLI Commands
21 votes -
Programming Challenge: Make a game in 1 hour!
Background There's been some talk on ~ before, and it seems like there are quite a few people who are either interested in, learning, or working in game development, so I thought this could be a...
Background
There's been some talk on ~ before, and it seems like there are quite a few people who are either interested in, learning, or working in game development, so I thought this could be a fun programming challenge.
This one is fairly open-ended: make a game in 1 hour. Any game, any engine, don't worry about art or sound or anything.
Doing is the best way to learn. Most people's first project is something overly ambitious, and when they find that it's more difficult than they thought, they can get discouraged, or even give up entirely. This is why the 1 hour limit is important: it forces you to finish something, even if it's small. When you're done, you can come out of it saying you made a game, and you learned from it.
Chances are the game might not be fun, look bad, be buggy, etc. But don't worry about that, everyone's game will have problems, and if you do create something really fun or innovative, congratulations, you have a prototype that you can expand on later!
"Rules"
Like I said before, these "rules" are pretty simple: make a game in (approximately) 1 hour. You can use any tools you want. If you use external assets (art, sound), it's probably best you use something you have the rights to (see resources). If you're completely new to game development/programming, your goal could even be to finish a tutorial.
If you're the kind of person who tends to get carried away with these things, you might want to post a comment saying you're starting, then another one once you've finished your game.
Please share your finished game, I'm sure everyone would love to try them! If your game is web-based, it can be hosted for free on Github Pages or Itch.io. If downloadable, it can be hosted for free on Google Drive, Mega, Dropbox, Itch.io, etc.
Resources
Engines
If you're a beginner, a good engine to start with is LÖVE. It's very simple, and uses Lua, which is very easy to learn.
If you're familiar with another language, you could use a library to make it in that language. Some examples:
Javascript: kontra, Phaser, pixi.js
Python: pygame
If you want something more complex, consider Godot, Unity, or Unreal.
You can also try something visual like Construct, Clickteam Fusion, or GDevelop
Art
For such a short time constraint, I'd suggest you use your own "programmer art": just use some basic shapes. Your primary focus should be gameplay.
If you think you have time to find something, try looking on OpenGameArt.
Sound
You can make simple sound effects very quickly with sfxr (or in this case, a web port of sfxr called jsfxr).
27 votes -
What computer/programming/etc. project are you working on this weekend?
This is a thread to discuss the projects you have planned for the weekend. Previous threads: 2018-07-27 2018-06-16
38 votes -
Learning to Program
Hi folks, I figured this would be a good place to ask a rather simple question. Where do I start to learn to code? I'm in high school, so I have (some) time to dedicate to it, and it seems there...
Hi folks,
I figured this would be a good place to ask a rather simple question.
Where do I start to learn to code?
I'm in high school, so I have (some) time to dedicate to it, and it seems there are a plethora of websites/resources out there, so I ask: what do you recommend, and why has it worked for you? I have no prior experience. I believe that this would really help out in the long run, as I will graduate high school with an Associate's Degree in Business. Thank you!
EDIT: Thank you for all your responses! I'll start with Python and move on from there. You guys have been a great help, and I'll vote you up or reply.
26 votes -
Programming Mini-Challenge: TicTacToeBot
I've seen the programming challenges on ~comp as well as quite a few users who are interested in getting started with programming. I thought it would be interesting to post some 'mini-challenges'...
I've seen the programming challenges on ~comp as well as quite a few users who are interested in getting started with programming. I thought it would be interesting to post some 'mini-challenges' that all could have a go at. 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.
This is my first post and I'm a maths-guy who dabbles in programming, so I'm not promising anything mind-blowing. If these gain any sort of traction I'll post some more.
Starting of with...
TicTacToeBot
Info
You will be writing code for a programme that will check to see if a player has won a game of tic-tac-toe.
Input
The input will be 9 characters that denote the situation of each square on the grid.
- 'X' represents the X-player has moved on that square.
- 'O' represents the O-player has moved on that square.
- '#' represents that this square is empty.
Example:
|O| |X| |X|X|O| The input for this grid will be O#XXXOO## |O| | |
Output
The expected output is the character representing the winning player, or "#" if the game is not won.
(e.g. The expected output for the example above is '#' since no player has won)
29 votes -
Programming Challenge: Two Wizards algorithm challenge
I'm running out of ideas, if you have any, please make your own programming challenge. This challenge is about designing algorithm to solve this problem. Let's have game field of size x, y (like...
I'm running out of ideas, if you have any, please make your own programming challenge.
This challenge is about designing algorithm to solve this problem.
Let's have game field of size x, y (like in chess). There are two wizards, that are standing at
[ 0, 0 ]
and are teleporting themselves using spells. The goal is to not be the one who teleports them outside of the map. Each spell teleports wizard by at least +1 tile. Given map size and collection of spells, who wins (they do not make any mistakes)?Here are few examples:
Example 1
x:4,y:5
Spells:
{ 0, 2 }
Output:
false
Description: Wizard A starts, teleporting both of them to 0, 2. Wizard B teleports them to 0, 4. Wizard A has to teleport them to 0,6, which overflows from the map, so he loses the game. Because starting wizard (wizard A) loses, output is
false
.Example 2
x:4,y:4
Spells:
{ 1,1 }
Output:
true
Example 3
x:4,y:5
Spells:
{ 1,1 },{ 3,2 },{ 1,4 },{ 0,2 },{ 6,5 },{ 3,1 }
Output:
true
Example 4
x:400,y:400
Spells:
{9,2},{15,1},{1,4},{7,20},{3,100},{6,4},{9,0},{7,0},{8,3},{8,44}
Ouput:
true
Good luck! I'll comment here my solution in about a day.
Note: This challenge comes from fiks, programming competition by Czech college ČVUT (CTU).
15 votes -
Luna — a programming language with dual (textual/visual) representation
5 votes -
This Week in Rust 247
4 votes -
Top Linux developers' recommended programming books
7 votes -
The Worst Computer Bugs in History: Race conditions in Therac-25
6 votes -
status.im sponsors full-time development of the open source language Nim
8 votes -
Weekly Programming Challenge - making our own data format
Hi everyone! There was no coding challenge last week, so I decided to make one this week. If someone wants to make his own challenge, wait few days and post it. I'm running out of ideas and I'd...
Hi everyone! There was no coding challenge last week, so I decided to make one this week. If someone wants to make his own challenge, wait few days and post it. I'm running out of ideas and I'd like to keep these challenges running on Tildes.
Everyone here knows data formats - I'm talking about XML or JSON. The task is to make your own format. The format can be as compact as possible, as human-readable as possible, or something that's really unique. Bonus points for writing encoder/decoder for your data format!
How do you handle long texts? Various unicode characters? Complex objects? Cyclic references? It's up to you if you make it fast and simple, or really complex.
I'm looking forward to your data formats. I'm sure they will beat at least csv. Good luck!
8 votes -
Michael MacInnis: Oh a new Unix shell - BSDCan 2018
6 votes -
#showdev share your current project
Do you have any project that you are currently working on that you would like to showcase and/or need people to test?
10 votes -
What are you working on this weekend?
This is a thread to discuss the projects you have planned for the weekend. Previous threads: 2018-06-16
28 votes -
Programming Challenge: creative FizzBuzz
Pretty standard: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which...
Pretty standard:
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
The twist: come up with the most creative or unusual way to solve this in your language of choice.
39 votes -
Programming Challenge: Freestyle textual analysis.
I just realized that I completely glossed over this week's programming challenge. For this week, let's do something more flexible: write a program that accepts a file as input--either through a...
I just realized that I completely glossed over this week's programming challenge. For this week, let's do something more flexible: write a program that accepts a file as input--either through a file name/path or through standard input--and perform any form of analysis you want on its contents. That's it!
For instance, you could count the occurrences of each word and find the most common ones, or you could determine the average sentence length, or the average unique words per sentence. You could even perform an analysis on changes in words and sentence structure over time (could be useful for e.g. poetry where metre may play an important role). You can stick with simple numbers or dive right into the grittiest forms of textual analysis currently available. You could output raw text or even a graphical representation. You could even do a bit of everything!
How simple or complex your solution ends up being is completely up to you, but I encourage you to challenge yourself by e.g. learning a new language or about different textual analysis techniques, or by focusing on code quality rather than complexity, or even by taking a completely different approach to the problem than you ordinarily would. There are a lot of learning opportunities available here.
11 votes -
Codingame.com lets you write programs to play games.
2 votes -
Programming Challenge - Let's build some AI!
Hi everyone! In this challenge, we will build simple genetic algorithm. The goal is to create genetic algorithm that will learn and output predefined text ("Hello World!"). The goal can be...
Hi everyone! In this challenge, we will build simple genetic algorithm.
The goal is to create genetic algorithm that will learn and output predefined text ("Hello World!").
The goal can be achieved with any language and you'll need just simple loops, collection and knowledge how to create and use objects, even beginners can try to complete this challenge.
How?
I'll try to explain it as best as I can. Genetic algorithms are approximation algorithms - they often do not find the best solution, but they can find very good solutions, fast. It's used when traditional algorithms are either way too slow, or they even don't exist. It's used to, for example, design antennas, or wind turbines. We will use it to write "Hello World".
First of all, we define our
Entity
. It is solution to given problem, it can be list of integers that describe antenna shape, decision tree, or string ("Hello World"). Each entity contains the solution (string solution
) and fitness function. Fitness function says, how good our entity is. Our fitness function will return, how similar is entitysolution
text to "Hello World" string.But how will the program work? First of all, we will create list of entities
List<Entity>
. We will make, for example, 1000 entities (randomly generated). TheirEntity.solution
will be randomized string of length 11 (because "Hello World" is 11 characters long).Once we have these entities, we will repeat following steps, until the best entity has
fitness == 1.0
, or 100% similarity to target string.First of all, we compute fitness function of all entities. Then, we will create empty list of entities of length 1000. Now, we will 1000-times pick two entities (probably weighted based on their fitness) and combine their strings. We will use the string to create new entity and we will add the new entity to the new list of entities.
Now, we delete old entities and replace them with entities we just made.
The last step is mutation - because what if no entity has the "W" character? We will never get our "Hello World". So we will go through every entity and change 5% (or whatever number you want) of characters in their solution to random characters.
We let it run for a while - and it is done!
So to sum up what we did:
entities <- 1000 random entities while entities.best.fitness < 1: for every entity: compute fitness newEntities <- empty list 1000-times: choose two entities from "entities", based on their fitness combine solutions of these entities and make newEntity newEntities.add(newEntity) for every entity: mutate // Randomly change parts of their strings print(entities.best.solution) // Hello World!
Now go and create the best, fastest, and most pointless, genetic algorithm we've ever seen!
23 votes -
Rockstar is a dynamically-typed Turing-complete programming language, designed for creating computer programs that are also song lyrics
11 votes -
Python has brought computer programming to a vast new audience
11 votes -
Programming Challenge: Construct and traverse a binary tree.
It's that time of week again! For this week's programming challenge, I thought I would focus on data structures. Goal: Construct a binary tree data structure. It may handle any data type you...
It's that time of week again! For this week's programming challenge, I thought I would focus on data structures.
Goal: Construct a binary tree data structure. It may handle any data type you choose, but you must handle sorting correctly. You must also provide a print function that prints each value in the tree on a new line, and the values must be printed in strictly increasing order.
If you're unfamiliar with this data structure, it's a structure that starts with a single "root" node, and this root can have a left child, right child, both, or neither. Each of these child nodes is exactly the same as the root node, except the root has no parent. This branching structure is why it's called a tree. Furthermore, left descendants always have values smaller than the parent, and right descendants always have larger values.
12 votes -
My Conversation With a Coding Nun
3 votes -
Starters, Finishers, and Large Teams
7 votes -
The 128 Language Quine Relay
15 votes -
Programming Challenge: Markov Chain Text Generator
Markov Chains are a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event. By analyzing a...
Markov Chains are a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event. By analyzing a document in some way and producing a model it’s possible to use this model to generate sentences.
For example, let’s consider this quote:
Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind.
Let’s start with a seed of
be
, which there is only one of in this text and it’s following word iswho
. Thus, a 100% chance of the next state beingwho
. Fromwho
, there are several next states:you
,mind
, andmatter
. Since there are 3 options to choose from, the next state has a 1/3 probability of each. It’s important that if there were for example two instances ofwho you
thenyou
would have a 2/4 probability of next state. Generate a random number and choose the next state, perhapsmind
and continue until reaching a full stop. The string of states we reached is then printed and we have a complete sentence (albeit almost certainly gibberish).Note: if we were in the state
mind
, our next two options would be.
ordon’t
, in which if we hit.
we would end the generation. (or not, up to you how you handle this!)To take it a step further, you could also consider choosing the number of words to consider a state. For example, two words instead of one:
those who
has two possible next states:who matter
orwho mind
. By using much longer strings of words for our states we can get more natural text but will need much more volume to get unique sentences.This programming challenge is for you to create a Markov Chain and Text Generator in your language of choice. The input being a source document of anything you like (fun things include your favourite book, a famous person’s tweets, datasets of reddit / tildes comments), and possibly a seed. The output being a sentence generated using the Markov Chain.
Bonus points for:
- Try it a bunch of times on different sources and tell us the best generated sentences
- Using longer strings of words for the state, or even having it be variable based on input
- Not requiring a seed as an input, instead implementing that into your Markov Chain (careful as infinite loops can occur without considering the seed)
- Implement saving the Markov Chain itself, as it can take very long to generate with huge documents
- Particularly Fast, efficient, short or unique methods
Good luck!
P.S A great place to find many large plain text documents for you to play with is Project Gutenberg.
17 votes -
Python 3.7 has been officially released!
25 votes -
What are you working on this weekend?
This is a thread to discuss what projects you're working on this weekend. (I've basically stolen this idea from Lobste.rs.)
15 votes -
Programming Challenge: Given a triangle of numbers, find the path from the top to the bottom of the triangle with the largest sum.
This problem is based on the Project Euler problem here. Goal: Given some input describing a triangle of numbers, find the path starting from the top-most row of the triangle and ending at the...
This problem is based on the Project Euler problem here.
Goal: Given some input describing a triangle of numbers, find the path starting from the top-most row of the triangle and ending at the bottom-most row of the triangle that contains the largest sum of all of the numbers along the path. You may only move downward and you must select an adjacent position to move to. Efficiency is not a requirement for completion.
Constraints:
- The first line of input for a triangle will be a single integer telling you how many rows the triangle will have.
- Each following line of input will be the next row of the number triangle, starting at the first row.
- For each line describing the number triangle, the individual numbers will be separated by a single space.
Note: The constraints above are to keep hard-coded triangles out of submitted solutions while also ensuring that all languages can equally handle this problem without annoying workarounds for lower-level languages. The consistency also makes it easier for beginners to review and understand someone else's code, and makes it easier to receive help if you get stuck. They're not necessarily required, but are highly encouraged.
Example input:
4 1 3 2 4 5 6 7 8 9 10
Corresponding triangle:
1 3 2 4 5 6 7 8 9 10
Expected result:
19
(1 + 2 + 6 + 10)Extra Credit: As noted on the Project Euler page, you can solve this using a brute force method, but it's incredibly inefficient. Specifically, a brute force solution would be O(2n) time (exponential). There exists a solution that can be solved in O(n2) time (quadratic). Find this solution.
13 votes -
Angular with PureScript
I have to do an assignment for university soon-ish, and it requires Angular. I'm not very fond of that framework specifically, but I would be interested in making it more interesting as a learning...
I have to do an assignment for university soon-ish, and it requires Angular. I'm not very fond of that framework specifically, but I would be interested in making it more interesting as a learning project. I've also recently discovered PureScript, which I have no experience with right now.
Searching online, I've purescript-angular, which hasn't been updated in years. I also couldn't find much else. Of course, I may be missing something simple (for instance, it's actually supported by default in Angular these days), so I wanted to ask if any of you know if this is possible, and if so, how?
6 votes -
Why doesn't Common Lisp see more usage?
Hey all, I've been studying Common Lisp recently, and as far as I can see, this is a pretty capable, mature language. Moreover, Lisp has been around since the 60s and it doesn't see much usage (as...
Hey all,
I've been studying Common Lisp recently, and as far as I can see, this is a pretty capable, mature language. Moreover, Lisp has been around since the 60s and it doesn't see much usage (as far as I'm aware) outside of Emacs Lisp and AutoLISP. What gives?17 votes -
What should replace Electron as a WORA framework?
2 votes -
How do you model complicated or tricky problems to solve them? What benefit do you get from using that model?
Everyone has their own way of visualizing a problem they're working on, and every strategy has some reason for being used. Some people prefer text (e.g. pseudocode) while others prefer diagrams,...
Everyone has their own way of visualizing a problem they're working on, and every strategy has some reason for being used. Some people prefer text (e.g. pseudocode) while others prefer diagrams, for example. What do you use to make problems easier to approach, conceptualize, and solve? Why that particular strategy rather than some other one? What kind of practical implementations of your strategy exemplifies the benefits of your strategy for modeling the problem?
6 votes -
How Did You Learn C++?
I'm a beginner-ish at c++ and cannot find any good places to learn it. I tried learning from the books but they didn't help that much.
7 votes -
Most instructive/well made educational computer science/math videos?
What are some of your favorite videos that explain deep topics in depth? I've recently been on a 3blue1brown binge (youtube) and am looking for more videos of that ilk. Doesn't have to be a series...
What are some of your favorite videos that explain deep topics in depth?
I've recently been on a 3blue1brown binge (youtube) and am looking for more videos of that ilk. Doesn't have to be a series or a consistent uploader, one off videos are sometimes the best. Just thought I'd ask ~comp if there's anything in particular that comes to mind.
This is in part inspired by the video posted by /u/Deimos in the Technical Goals section of Tildes, titled Simplicity Matters
11 votes -
William Byrd on "The Most Beautiful Program Ever Written"
4 votes -
Any programmers here? Do you care more for the code, the product, or both equally?
^
13 votes -
Visualizing Entropy in Binary Files
8 votes -
What is Software Engineering? (Go & Versioning, Part 9)
5 votes -
Programming challenge: undo this "Caesar" cipher.
Disclaimer: I'm a novice and this is a half baked idea Recap The Caesar cipher is fairly straight forward as it just shifts letters along by a set amount. This means that it's quite easy to brute...
Disclaimer: I'm a novice and this is a half baked idea
Recap
The Caesar cipher is fairly straight forward as it just shifts letters along by a set amount. This means that it's quite easy to brute force. There's only 25 offsets, after all. Try to decode this to see what i mean:
Plqfh 3 foryhv ri jduolf, dqg frpelqh lq d vpdoo erzo zlwk pdbrqqdlvh, dqfkrylhv, 2 wdeohvsrrqv ri wkh Sduphvdq fkhhvh, Zrufhvwhuvkluh vdxfh, pxvwdug dqg ohprq mxlfh. Vhdvrq wr wdvwh zlwk vdow dqg eodfn shsshu. Uhiuljhudwh xqwlo uhdgb wr xvh. Khdw rlo lq d odujh iublqj sdq ryhu phglxp khdw. Fxw wkh uhpdlqlqj 3 foryhv ri jduolf lqwr txduwhuv, dqg dgg wr krw rlo. Frrn dqg vwlu xqwlo eurzq, dqg wkhq uhpryh jduolf iurp sdq. Dgg euhdg fxehv wr wkh krw rlo. Frrn, wxuqlqj iuhtxhqwob, xqwlo oljkwob eurzqhg. Uhpryh euhdg fxehv iurp rlo, dqg vhdvrq zlwk vdow dqg shsshu. Sodfh ohwwxfh lq d odujh erzo. Wrvv zlwk guhvvlqj, uhpdlqlqj Sduphvdq fkhhvh, dqg vhdvrqhg euhdg fxehv.
bonus points for a program that takes the above text and outputs the shift I used without any human inputMy dumb idea (didn't work, my bad. They're in normal Caeser cipher now)
I like the simplicity of the shifting characters but having it always be in one direction, and always being the same offset makes it easy to notice the pattern and decode.
If we have the shift value determined by the length of the current word, and the direction of it dependent on if it's a vowel or a consonant.
a pirate is nothing without his ship
becomes
b jolgnk kq gvmapgz ppmavbm elp odml
so we still have a visibly Caesar-y cipher, but we'll know it's not a true Caesar cipher.
The offset changes for every word and then is applied based on each letter in the word. If it's a vowel, then the encoded value is shifted upwards but if not, it slides down.For the purposes of the below tomfoolery; prime numbers are consonants and the rest are vowels.
A Valley Without Wind 1 and 2 Steam Key: B qjsbuf jt opuijoh xjuipvu ijt tijq FWR0H-GQM7B-5344H Aces Wild: Manic Brawling Action: C rktcvg ku pqvjkpi ykvjqwv jku ujkr K5R0H-29NPM-A3OTE Age of Empires Legacy Bundle: D sludwh lv qrwklqj zlwkrxw klv vkls 69PQW-UY3H7-7SQWT AI War + 4 DLC packs & Tidalis Steam Key: E tmvexi mw rsxlmrk amxlsyx lmw wlmt KO99D-73JZ2-XNIK3 AI War: Vengeance Steam Key: F unwfyj nx stymnsl bnymtzy mnx xmnu 7M2I8-I99N9-6E9F2 Alan Wake Collector's Edition Steam Key: G voxgzk oy tuznotm coznuaz noy ynov 6ZNJ5-BIVFN-6ZSDZ Alan Wake's American Nightmare Steam Key: H wpyhal pz uvaopun dpaovba opz zopw 7RERD-4ACYN-TCDQ2 Amnesia: Dark Descent Steam Key: I xqzibm qa vwbpqvo eqbpwcb pqa apqx VGEO8-OU48X-MU7BL Anachronox: J yrajcn rb wxcqrwp frcqxdc qrb bqry 3589L-YGF9V-NKGW0 Anodyne: K zsbkdo sc xydrsxq gsdryed rsc crsz 9HW7H-7Z73Z-6302D Anomaly Defenders: L atclep td yzestyr hteszfe std dsta ICPIB-M63TI-9Y96V Anomaly Korea: M budmfq ue zaftuzs iuftagf tue etub QMPZ2-JUK8B-JRK3V Anomaly Korea: N cvengr vf abguvat jvgubhg uvf fuvc 30R9T-C02AA-7DQLG Anomaly Warzone Earth: O dwfohs wg bchvwbu kwhvcih vwg gvwd 38UM9-Z26PH-Q4VAU Anomaly Warzone Earth Mobile Campaign: P exgpit xh cdiwxcv lxiwdji wxh hwxe 54TYN-AU26Q-5AGGY Aquaria Steam key: Q fyhqju yi dejxydw myjxekj xyi ixyf 3853A-YSB4J-6243A Awesomenauts: R gzirkv zj efkyzex nzkyflk yzj jyzg DH9T5-BWOQC-KB6TB Awesomenauts: S hajslw ak fglzafy oalzgml zak kzah RNRJ0-CPT4O-S9UHE Awesomenauts Cluck Costume: T ibktmx bl ghmabgz pbmahnm abl labi VOWWW-QTR3Q-EAS9J
These are encoded using a Caeser shift. The line under the title is a fixed phrase (a pirate is nothing without his ship) for aid in the bonus points
I can post my code if it turns out to be unsolvable (like a bug https://trinket.io/python/dabf2b61f9), but if not; I can also keep going from letters A to Y (sans U) over the weeks with my humble bundle reserves (plaintext or not). I've had these keys for far too long and I'm never going to actually use them, but I also noticed a surge of keys being donated here so figured I might as well change it up.
Have fun
9 votes -
What trick/pattern/concept/whatever did you adopt that has improved your code quality?
One big thing that has made maintenance of my older code easier has been considering the concept of cyclomatic complexity. In particular, limiting conditional checks to exceptional cases as much...
One big thing that has made maintenance of my older code easier has been considering the concept of cyclomatic complexity. In particular, limiting conditional checks to exceptional cases as much as is reasonable has made it easier to focus on the "happy" path of code execution and easily track down the errors, and the limited nesting depth has made things easier to read as well. Overall, my code remains relatively flat and I'm not branching through layers of logic trying to track down a simple bug.
What are some simple things you do to keep your code from being a massive headache long-term?
26 votes -
Programming Challenge: Translate 24-hour time into words
This is an adapted version of Talking Clock from /r/DailyProgrammer. The point of this thread is to post your code for solving the task. Other will comment with feedback and new ideas. Post what...
This is an adapted version of Talking Clock from /r/DailyProgrammer.
The point of this thread is to post your code for solving the task. Other will comment with feedback and new ideas. Post what language (and version, if relevant) your code is written in.
Task description
Your task is to translate a 24-hour formatted time to words.
Input description
An hour between 00 and 23 followed by a colon followed by a minute between 0 and 59.
Output description
The time expressed in words, in 12-hour format followed by "am" or "pm".
Sample input
00:00 01:30 12:05 14:01
Sample output
It's twelve am It's one thirty am It's twelve oh five pm It's two oh one pm
27 votes -
Daily (or at least regular) programming challenges
I am a great fan of the subreddit /r/DailyProgrammer. I think it's pretty fun to do some curated programming challenges now and again, and I learn a lot by reading other people's solutions. What...
I am a great fan of the subreddit /r/DailyProgrammer. I think it's pretty fun to do some curated programming challenges now and again, and I learn a lot by reading other people's solutions.
What does the ~comp Tildarians think?
21 votes -
Parabola.io - Graphical Automation
8 votes -
RSoC: Porting tokio to Redox
5 votes -
The Power of Prolog
4 votes -
My random notes for Nim lang
-> Nim notes <- Some background I am learning a new programming language Nim. As many would do, I also take my own notes as I am learning it, running little example by myself, etc. .. but I doing...
-> Nim notes <-
Some background
I am learning a new programming language Nim. As many would do, I also take my own notes as I am learning it, running little example by myself, etc.
.. but I doing that a bit differently.
-
I take notes in Emacs Org mode. Org mode has a feature set called Org Babel. That allows one to document the code snippets, and also run them directly in that document, and insert their output results below them -- Notes in Org
This also helps me document regression of the language behavior between different Nim versions of any, as the exact outputs are documented too. After each major Nim update, I press a single binding (
C-v C-v b
) in Emacs, and all the output blocks get recalculated. -
But not everyone uses Emacs and Org mode. So to be able to share them to a wider audience, I need to export (Org term) that to a format like HTML, PDF, or Markdown..
-
Hugo is a really fast static site generator that uses Markdown as one of the primary content formats. It parses that to HTML using a Go Markdown library called Blackfriday.
-
As my notes are in Org mode, and converting them to HTML via Hugo needs them to be in Blackfriday compatible Markdown (which is almost like GitHub flavored Markdown), I starting working on an Emacs Org mode package
ox-hugo
about a year back. Using that, this Markdown file is generated. Hugo natively supports a subset of Org, but I needed to write this package to use the full power of Org mode. -
Hugo then takes that Markdown and generates the final Nim notes page in HTML.
In the end, I have something that ties together all things of my interest: Nim, Emacs, Org mode and Hugo :)
8 votes -
-
Code Vigorous' PyCon US 2018 Wrapup
8 votes -
Crafting Interpreters - Chapter 16 - Scanning on Demand
12 votes