-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
918d9af
commit 9993b10
Showing
5 changed files
with
110 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
mod chicken; | ||
use crate::coop::chicken::Chicken; | ||
|
||
pub struct Coop { | ||
chicken: Chicken, | ||
} | ||
|
||
impl Coop { | ||
pub fn new() -> Coop { | ||
Coop { | ||
// chicken: { Chicken { awake: false } }, | ||
chicken: Chicken::new(), | ||
} | ||
} | ||
|
||
pub async fn run(&self) { | ||
loop { | ||
self.is_time_to_wake_up().await; | ||
self.turn_on_light(); | ||
self.open_door(); | ||
// join(self.open_door(), GATE_POSITION.send(self.door_position())).await; | ||
self.is_light_enough_to_see().await; | ||
self.turn_off_light(); | ||
self.is_time_to_get_ready_for_bed().await; | ||
self.turn_on_light(); | ||
self.close_door(); | ||
self.is_time_for_sleep().await; | ||
self.turn_off_light(); | ||
} | ||
} | ||
|
||
pub async fn is_time_to_wake_up(&self) {} | ||
pub async fn is_light_enough_to_see(&self) {} | ||
pub async fn is_time_to_get_ready_for_bed(&self) {} | ||
pub async fn is_time_for_sleep(&self) {} | ||
pub fn turn_on_light(&self) {} | ||
pub fn turn_off_light(&self) {} | ||
pub fn open_door(&self) {} | ||
pub fn close_door(&self) {} | ||
pub fn door_position(&self) -> u32 { | ||
1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters