Skip to content

Commit

Permalink
Minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-kast committed Nov 12, 2018
1 parent a57494d commit ad7e9a5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ words.
before running it for the first time, you must generate one. See [here](tools/gen-words/README.md)
for more details.

Fair warning — at the time of writing this readme, ***the wordlist IS NOT
censored***. I have plans to allow blacklisting words, but I have not gotten
there yet, so if you want to run the game as it currently is, play at your own
risk.

## Controls

Aside from basic text-editing controls for the word box, the following is a list
Expand Down
18 changes: 6 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn main() {

let mut len: Option<usize> = None;

loop {
'main: loop {
let key;
let set = {
let mut keys = loop {
Expand Down Expand Up @@ -93,7 +93,7 @@ fn main() {
use std::collections::hash_map::Entry::*;

let mut table = markov::analyze_corpus(
set.iter().map(|s| ((s.len() as f64).powf(1.5), s.chars())),
set.iter().map(|s| ((s.len() as f64).powf(3.4), s.chars())),
);
let chars: HashSet<_> = set.iter().flat_map(|s| s.chars()).collect();

Expand Down Expand Up @@ -214,11 +214,7 @@ fn main() {
// TODO: handle modifier keys better
// TODO: up and down should be history controls, not text editing controls
match nc::wgetch(win) {
0x04 => {
// EOT
nc::endwin(); // TODO: break out of the outer loop instead
return;
}
0x04 => break 'main,
0x09 => word_box.borrow_mut().shuffle(&markov), // HT
0x17 => word_box.borrow_mut().clear(), // ETB (ctrl+bksp)
0x1B => {
Expand Down Expand Up @@ -246,11 +242,7 @@ fn main() {
word_box.borrow_mut().render_cur();

match nc::wgetch(win) {
0x04 => {
// EOT
nc::endwin(); // TODO: break out of the outer loop instead
return;
}
0x04 => break 'main,
_ => {}
}

Expand Down Expand Up @@ -350,4 +342,6 @@ fn main() {

nc::endwin();
}

nc::endwin();
}
1 change: 0 additions & 1 deletion tools/gen-words/src/thread_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ enum WorkerMessage {

use self::{SchedMessage as SM, WorkerMessage as WM};

// TODO: is the 'static necessary, or can it be parameterized?
impl<T> ThreadPool<T>
where
T: Send + 'static,
Expand Down
2 changes: 1 addition & 1 deletion tools/scrape-words/src/scrape/reddit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ where

{
let mut listings = listings.lock().unwrap();
links = listings.into_iter().flat_map(|l| l.children).collect();
links = listings.drain(0..).flat_map(|l| l.children).collect();
}

writeln!(io::stderr(), "retrieving comments...").unwrap();
Expand Down

0 comments on commit ad7e9a5

Please sign in to comment.