kionite231

joined 2 years ago
MODERATOR OF
[–] kionite231@lemmy.ca 7 points 3 months ago

I am curious as well!!

[–] kionite231@lemmy.ca 4 points 3 months ago (1 children)

pretty much dead, I no longer has symptoms of Schizophrenia and I was the only one posting in that community :)

[–] kionite231@lemmy.ca 2 points 3 months ago

I have also left Reddit, Facebook and instagram however quiting WhatsApp isn't easy since all my family and friends exclusively use it

[–] kionite231@lemmy.ca 1 points 4 months ago

Nice, more people will use XMPP :D

[–] kionite231@lemmy.ca 3 points 4 months ago

I haven't tried to scrape WhatsApp however I tried to use WhatsApp as a monitoring system so basically what I did was send CPU usage every second however it didn't make WhatsApp ban me. They just hid my message saying it couldn't load the message.

[–] kionite231@lemmy.ca 1 points 4 months ago (1 children)

That won't work because people here think the USA is an ideal country and do anything to get USA citizenship.

[–] kionite231@lemmy.ca 1 points 4 months ago

Yeah that could probably work, I will keep that sentence in mind

[–] kionite231@lemmy.ca 3 points 4 months ago (3 children)

no, they will ask for proof, they will be like "ohh that's weird, let me see if I can fix it"

[–] kionite231@lemmy.ca 6 points 4 months ago

yes, I agree, however if I can show them that Whatsapp is not letting me create an account they will be more sympathetic to me and would use Signal or any other privacy focused alternatives. but to achive that I have to make Whatsapp to not let me create an account.

[–] kionite231@lemmy.ca 1 points 4 months ago

I went to a psychiatrist and he asked me some questions like do you hear voices? and I think it was mistake that I said yes. I thought having thoughts is like hearing voices for example I remember things my father said to me in certain situations. also I said that I have depression and I don't like to do anything at all. he also asked "do you think people are talking about you, or staring at you?" I said I don't think people are talking about me but I often feel like people are staring at me and looking at me. he said I have schizophrenia. at first I didn't believe it because schizophrenia is a very serious disorder and it affects people very badly however in my case I was mostly fine, it wasn't affecting my life that badly however psychiatrist suggested that I should take ETC otherwise you will end up like those crazy people eventually, I was scared and decided to take ETC, I should have said no :(

[–] kionite231@lemmy.ca 1 points 4 months ago

The user is not in the sudoers file!

[–] kionite231@lemmy.ca 2 points 4 months ago

It's a mineral name :)

 
use std::fs;

fn update_guard_loc(map: &mut Vec<Vec<char>>, guard_loc: &mut (i32, i32)) {
    match map[guard_loc.0 as usize][guard_loc.1 as usize] {
	'^' => {
	    if map[(guard_loc.0 - 1) as usize][guard_loc.1 as usize] == '#' {
		map[guard_loc.0 as usize][guard_loc.1 as usize] = '>'
	    } else {
		map[guard_loc.0 as usize][guard_loc.1 as usize] = 'X';
		guard_loc.0 -= 1;
		map[guard_loc.0 as usize][guard_loc.1 as usize] = '^';
	    }
	},
	'>' => {
	    if map[guard_loc.0 as usize][(guard_loc.1 + 1) as usize] == '#' {
		map[guard_loc.0 as usize][guard_loc.1 as usize] = 'v'
	    } else {
		map[guard_loc.0 as usize][guard_loc.1 as usize] = 'X';
		guard_loc.1 += 1;
		map[guard_loc.0 as usize][guard_loc.1 as usize] = '>';
	    }
	},
	'v' => {
	    if map[(guard_loc.0 + 1) as usize][guard_loc.1 as usize] == '#' {
		map[guard_loc.0 as usize][guard_loc.1 as usize] = '<'
	    } else {
		map[guard_loc.0 as usize][guard_loc.1 as usize] = 'X';
		guard_loc.0 += 1;
		map[guard_loc.0 as usize][guard_loc.1 as usize] = 'v';
	    }
	},
	'<' => {
	    if map[guard_loc.0 as usize][(guard_loc.1 - 1) as usize] == '#' {
		map[guard_loc.0 as usize][guard_loc.1 as usize] = '^'
	    } else {
		map[guard_loc.0 as usize][guard_loc.1 as usize] = 'X';
		guard_loc.1 -= 1;
		map[guard_loc.0 as usize][guard_loc.1 as usize] = '<';
	    }
	},

	_ => println!("unreachable"),
    }
}

fn main() {
    let contents = fs::read_to_string("input.txt").expect("Should have able to read the file");
    let mut map: Vec<Vec<char>> = Vec::new();
    let lines = contents.split("\n").collect::<Vec<&str>>();
    for line in lines {
	if line.len() == 0 {
	    // ignore empty line
	    break;
	}
	map.push(line.chars().collect::<Vec<char>>());
    }
    // Getting the first location of guard
    let mut height: i32 = 0;
    let mut width: i32 = 0;
    let mut guard_loc: (i32, i32) = (0, 0);
    for (i, lines) in map.iter().enumerate() {
	for (j, chr) in lines.iter().enumerate() {
	    if *chr == '^' {
		guard_loc.0 = i as i32;
		guard_loc.1 = j as i32;
	    }
	    height = (i + 1) as i32;
	    width = (j + 1) as i32;
	}
    }
    loop {
	update_guard_loc(&mut map, &mut guard_loc);
	match map[guard_loc.0 as usize][guard_loc.1 as usize] {
	    '^' => {
		if guard_loc.0 - 1 < 0 {
		    break;
		}
	    },
	    'v' => {
		if guard_loc.0 + 1 > height - 1 {
		    break;
		}
	    },
	    '>' => {
		if guard_loc.1 + 1 > width - 1 {
		    break;
		}
	    },
	    '<' => {
		if guard_loc.1 - 1 < 0 {
		    break;
		}
	    },
	    _ => println!("ureachable"),
	}
    }

    for line in map.iter() {
	println!("{:?}", line);
    }

    let mut count = 0;
    for line in map.iter() {
	for c in line.iter() {
	    if *c == 'X' {
		count += 1;
	    }
	}
    }
    println!("count: {}", count + 1);
}

 
use std::fs;
use std::collections::HashMap;

fn reorder_pages<'a>(rules_hash_map: HashMap<&str, Vec<&str>>, page_numbers: &'a str) -> Vec<&'a str>{
    let mut tmp = page_numbers.split(",").collect::<Vec<&str>>();
    for i in 0..tmp.len()-1 {
        for j in i+1..tmp.len() {
            match rules_hash_map.get(&tmp[i]) {
                Some(vec) => {
                    if !vec.contains(&tmp[j]) {
			if let Some(v2) = rules_hash_map.get(&tmp[j]) {
			    if v2.contains(&tmp[i]) {
				// swap two elements
				let t = tmp[i];
				tmp[i] = tmp[j];
				tmp[j] = t;
			    }
			}

                    }
                }
                None => {
		    if let Some(v2) = rules_hash_map.get(&tmp[j]) {
			if v2.contains(&tmp[i]) {
			    // swap two elements
			    let t = tmp[i];
			    tmp[i] = tmp[j];
			    tmp[j] = t;
			}
		    }
                }
            }
        }
    }
    return tmp;
}

fn main() {
    let contents = fs::read_to_string("input.txt")
        .expect("Should have been able to read the file");
    let parts = contents.split("\n\n").collect::<Vec<&str>>();
    let rules = parts[0];
    let page_numbers = parts[1];
    let mut rules_hash_map: HashMap<&str, Vec<&str>> = HashMap::new();

    for rule in rules.split("\n") {
        let tmp = rule.split("|").collect::<Vec<&str>>();
        rules_hash_map.entry(tmp[0]).and_modify(|vec| vec.push(tmp[1])).or_insert(vec![tmp[1]]);
    }

    let mut answer = 0;
    for page_numbers_line in page_numbers.split("\n").collect::<Vec<&str>>() {
        if page_numbers_line.len() == 0 {
            break;
        }
	let none_reordered_pages = page_numbers_line.split(",").collect::<Vec<&str>>();
        let reordered_pages = reorder_pages(rules_hash_map.clone(), page_numbers_line);
	let doesnt_matching = none_reordered_pages.iter().zip(&reordered_pages).filter(|&(a, b)| a != b).count();
	if doesnt_matching > 0 {
	    //println!("reorder_pages: {:?}", reordered_pages);
	   // println!("number of doesn't match: {:?}", doesnt_matching);
	    answer += reordered_pages[reordered_pages.len() / 2].parse::<i32>().unwrap();
	}


    }

    println!("answer: {answer}");
}

 
use std::fs;
use std::collections::HashMap;

fn count_correct(rules_hash_map: HashMap<&str, Vec<&str>>, page_numbers: &str) -> bool{
        let tmp = page_numbers.split(",").collect::<Vec<&str>>();
        for i in 0..tmp.len()-1 {
            for j in i+1..tmp.len() {
                match rules_hash_map.get(&tmp[i]) {
                    Some(vec) => {
                        if !vec.contains(&tmp[j]) {
                            return false;
                        }
                    }
                    None => {
                        return false;
                    }
                }
            }
        }
    

    return true;
}

fn main() {
    let contents = fs::read_to_string("input.txt")
        .expect("Should have been able to read the file");
    let parts = contents.split("\n\n").collect::<Vec<&str>>();
    let rules = parts[0];
    let page_numbers = parts[1];
    let mut rules_hash_map: HashMap<&str, Vec<&str>> = HashMap::new();

    for rule in rules.split("\n") {
        let tmp = rule.split("|").collect::<Vec<&str>>();
        rules_hash_map.entry(tmp[0]).and_modify(|vec| vec.push(tmp[1])).or_insert(vec![tmp[1]]);
    }

    let mut count = 0;
    let mut answer = 0;
    for page_numbers_line in page_numbers.split("\n").collect::<Vec<&str>>() {
        if page_numbers_line.len() == 0 {
            break;
        }
        let ok = count_correct(rules_hash_map.clone(), page_numbers_line);
        if ok {
            let tmp = page_numbers_line.split(",").collect::<Vec<&str>>();
            answer += tmp[tmp.len()/2].parse::<i32>().expect("parsing error");
            count += 1;
        }
    }

    println!("true_count: {count}");
    println!("answer: {answer}");
}

any suggestions would be appreciated :)

 

Hello,

some time ago I shared a Guess game that I made from scratch and this time I thought to do something different so I decided to make a Guess game over IRC.

It's pretty basic but I learned a lot about destructing Enum, unwrap and if let syntax.

I would appreciate any suggestion :)

here is the source code:

use futures::prelude::*;
use irc::client::prelude::*;

use rand::Rng;

#[tokio::main]
async fn main() -> irc::error::Result<()> {
    let config = Config {
        nickname: Some("beep_boop".to_owned()),
        server: Some("irc.libera.chat".to_owned()),
        channels: vec!["#test".to_owned()],
        ..Default::default()
    };

    let mut client = Client::from_config(config).await?;
    client.identify()?;

    let mut stream = client.stream()?;
    let mut secret_number = rand::thread_rng().gen_range(0..101);
    let mut attempts = 0;

    while let Some(message) = stream.next().await.transpose()? {
        print!("{}", message);

        match message.command {
            Command::PRIVMSG(channel, message) => {
                if let Some(command) = message.get(0..6) {
                    if command == "!guess" {
                        let parts = message.split(' ').collect::<Vec<_>>();
                        if let Some(part2) = parts.get(1) {
                            if let Ok(num) = part2.to_string().parse::<u32>() {
                                println!("{:?}", num);
                                if num == secret_number {
                                    client.send_privmsg(&channel, format!("You won with {attempts} attempts! generating next number")).unwrap();
                                    secret_number = rand::thread_rng().gen_range(0..101);
                                    attempts = 0; // reseting the number of attempts 
                                } else if num > secret_number {
                                    client.send_privmsg(&channel, "too high").unwrap();
                                    attempts += 1;
                                } else {
                                    client.send_privmsg(&channel, "too low").unwrap();
                                    attempts += 1;
                                }
                            }
                        }
                    }
                }
                else {
                    continue;
                }
                if message.contains(client.current_nickname()) {
                    client.send_privmsg(channel, "beep boop").unwrap();
                }
            },
            _ => println!("IRC command not implemented: {message}"),
        }
    }

    Ok(())
}

 

Hello,

I learned about struct in Rust, so I just wanted to share what I have learned.

what is struct in Rust? It's the same as what's in C language. eg,

struct Point {
    x: i32,
    y: i32,
}

that's it this is how we define a struct. we can create all sort of struct with different data types. ( here I have used only i32 but you can use any data type you want)

now Rust also have which we find in OOPs languages like Java. it's called method. here is how we can define methods for a specific struct in Rust.

impl Point {
    fn print_point(&self) {
        println!("x: {} y: {}", self.x, self.y);
    }
}

see it's that easy. tell me if I forgot about something I should include about struct in Rust.

 

hello,

last time I made a fibonacci series generator in Rust and now I have made something different :)

use std::io;

fn main() {
    let mut input: String = String::new();
    let stdin = io::stdin();

    let x = rand::random::<u32>() % 101;
    let mut attempts = 0;

    loop {
        println!("Guess a number from 0 to 100:");
        stdin.read_line(&mut input);
        input = input.to_string().replace("\n", ""); // removing the \n
        let user_input: u32 = input.parse::<u32>().unwrap();
        if x == user_input {
            println!("You won! attempts: {attempts}");
            break;
        }
        else if x < user_input {
            println!("too big");
            attempts += 1;
        }
        else {
            println!("too small");
            attempts += 1;
        }
        input.clear()
    }
}

feel free to give me suggestion :)

 

Hello,

As I said in the previous post that I have started learning Rust and made a simple fibonacci series generator. Today I made a palindrome string checker. it's very basic. I haven't used Enum or Struct in the code since I don't think it's necessary in this simple code.

here is the code:

use std::io;

fn main() {
    let mut input = String::new();
    let stdin = io::stdin();
    stdin.read_line(&mut input).unwrap(); // we want to exit in case it couldn't read from stdin

    input = input.replace("\n", ""); // Removing newline

    let mut is_palindrome: bool = true;
    for i in 0..input.len()/2 {
        let first_char: &str = &input[i..i+1];
        let last_char: &str = &input[input.len()-i-1..input.len()-i];
        if first_char != "\n" {
            if first_char != last_char {
                is_palindrome = false;
            }
        }
    }

    println!("palindrome: {}", is_palindrome);
}
 

Hello,

I went to another pdoc because the previous one was asking for more money and I don't have money to pay pdoc. So I went to a government funded pdoc and he diagnosed me with Parkinson's disease and schizophrenia. I feel like this pdoc would cure schizophrenia, at least I hope so.

 

hello,

I am @schizo987 in there if you want to have conversation with me there :)

I will try to link more good posts from that forum here or whichever post I find interesting. you guys could also post interesting discussion here too.

 

seriously! like how do you become addicted to coffee, I drink it regularly but I can't say I am caffeine addict or something. how one become a caffeine addict?

 

Hello,

I went to my psychiatrist yesterday, he increased the dose of Triflux by 50% because I am still having schizophrenia symptoms like "people are plotting against me" specially in the college.

I wonder how would I know if I am recovering or not? he asks me if there is any improvements and I am like how do I know if I had any improvements. he also asked me if I doubt everyone and I said yes because I feel like everyone wants to do something to me :/

view more: ‹ prev next ›