mirror of
https://github.com/kmc7468/cs220.git
synced 2025-12-15 22:48:45 +00:00
Assignment 12 Done
This commit is contained in:
@@ -45,6 +45,20 @@ impl Player {
|
|||||||
|
|
||||||
/// This function should return the index of the card to flip and the color to change to.
|
/// This function should return the index of the card to flip and the color to change to.
|
||||||
pub fn flip_card_strategy(&mut self) -> (usize, Color) {
|
pub fn flip_card_strategy(&mut self) -> (usize, Color) {
|
||||||
todo!()
|
let dist = 400;
|
||||||
|
let counter_entry = self.memory.entry(0).or_insert(0);
|
||||||
|
|
||||||
|
if *counter_entry % dist % 4 == 0 {
|
||||||
|
*counter_entry += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let index = (*counter_entry % 25) * dist + (*counter_entry / 25);
|
||||||
|
*counter_entry += 1;
|
||||||
|
|
||||||
|
if *counter_entry == 10000 {
|
||||||
|
*counter_entry = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
(index as usize, Color::White)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user