[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Assignment Help

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 11
Thread images: 1

File: 56tvouk.gif (83KB, 361x112px) Image search: [Google]
56tvouk.gif
83KB, 361x112px
I gotta make this BASH script reminiscent of Spritz. It's basically a speed reading program, pic very related. I don't want to do it from scratch. If anyone has ever done a similar assignment, I'd appreciate a copy of that. It doesn't have to be exact, and I'm going to make a bunch of changes too it regardless so I can figure out how it works. Thanks in advance.
>>
>>231880
I'm trying really hard, and I'm struggling to think of a language less appropriate for this task than bash.

Maybe befunge, but even befunge is at least designed to be interactive.
>>
>>231889
Tell me about it, but that's the task.

I got a look at the proff's code and despite it working it looks convoluted as fuck.
>>
>>231880
Also
>speed reading
Most people just call that "reading". If you can't read faster than you can talk, then you have a learning difficulty you need to overcome, because most people can read without needing to vocalise.
>>
>>231892
Hey that's what they call this style of program in the assignment instructions, I didn't think it up.
>>
>>231890
Are you allowed to call out to AWK, or are you going to have to tokenise the lines yourself?

At least the core loop is pretty straightforward:
echo \r
echo $A_BUNCH_OF_SPACES
echo \r
echo $ONE_WORD
sleep $CALCULATED_DELAY
>>
>>231890
For tokenising, see http://stackoverflow.com/a/10586169

Other than that, it's just glue code.
>>
>>231890
And I guess you already know this, but here's how to do arithmetic in bash: https://bash.cyberciti.biz/guide/Perform_arithmetic_operations

I'd work in integer numbers of microseconds, because bash sucks at floating point.
>>
Some nice links, I'm allowed to use AWK, but I'll look into the tokenising.

Thanks.
>>
>>231903
AWK can call sleep, so technically you could do it in AWK.

But if AWK is on the cards, then I'd probably do it like this:

- use mktemp to get a unique temporary file
- use awk to write the temp file with one word per line
- while read temp file do core loop
>>
Alright I'll work on that.

Thanks for your help!
Thread posts: 11
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.