diff --git a/corelib/Scarb.lock b/corelib/Scarb.lock index 0bd6895c9..18d39df00 100644 --- a/corelib/Scarb.lock +++ b/corelib/Scarb.lock @@ -3,4 +3,4 @@ version = 1 [[package]] name = "core" -version = "2.4.1" +version = "2.5.3" diff --git a/exercises/dict/dict1.cairo b/exercises/dict/dict1.cairo index de389fd96..31ee23581 100644 --- a/exercises/dict/dict1.cairo +++ b/exercises/dict/dict1.cairo @@ -10,10 +10,9 @@ // I AM NOT DONE - fn create_dictionary() -> Felt252Dict { let mut dict: Felt252Dict = Default::default(); - //TODO +//TODO } diff --git a/exercises/dict/dict2.cairo b/exercises/dict/dict2.cairo index 156eb8857..3f1469343 100644 --- a/exercises/dict/dict2.cairo +++ b/exercises/dict/dict2.cairo @@ -7,7 +7,6 @@ // I AM NOT DONE - fn multiply_element_by_10(ref dict: Felt252Dict, n: usize) { //TODO : make a function that multiplies the elements stored at the indexes 0 to n of a dictionary by 10 diff --git a/exercises/dict/dict3.cairo b/exercises/dict/dict3.cairo index aef34eb29..5b6a0e30f 100644 --- a/exercises/dict/dict3.cairo +++ b/exercises/dict/dict3.cairo @@ -7,14 +7,12 @@ // Make me compile and pass the test! // Execute `starklings hint dict3` or use the `hint` watch subcommand for a hint. - // I AM NOT DONE - #[derive(Destruct)] struct Team { - level: Felt252Dict, - players_count: usize + level: Felt252Dict, + players_count: usize } #[generate_trait] @@ -41,11 +39,9 @@ impl TeamImpl of TeamTrait { } - #[test] #[available_gas(200000)] fn test_add_player() { - let mut team = TeamTrait::new(); team.add_player('bob', 10); team.add_player('alice', 20); @@ -58,9 +54,8 @@ fn test_add_player() { #[test] #[available_gas(200000)] fn test_level_up() { - let mut team = TeamTrait::new(); - team.add_player('bobby',10); + team.add_player('bobby', 10); team.level_up('bobby'); assert(team.level.get('bobby') == 11, 'Wrong level'); diff --git a/exercises/enums/enums1.cairo b/exercises/enums/enums1.cairo index d425f395a..93575091a 100644 --- a/exercises/enums/enums1.cairo +++ b/exercises/enums/enums1.cairo @@ -3,7 +3,6 @@ // I AM NOT DONE -use debug::print; use debug::PrintTrait; enum Message { // TODO: define a few types of messages as used below } @@ -18,10 +17,10 @@ fn main() { impl MessagePrintImpl of PrintTrait { fn print(self: Message) { match self { - Message::Quit => ('Quit').print(), - Message::Echo => ('Echo').print(), - Message::Move => ('Move').print(), - Message::ChangeColor => ('ChangeColor').print() + Message::Quit => println!("Quit"), + Message::Echo => println!("Echo"), + Message::Move => println!("Move"), + Message::ChangeColor => println!("ChangeColor") } } } diff --git a/exercises/enums/enums2.cairo b/exercises/enums/enums2.cairo index 445c895a6..33e245662 100644 --- a/exercises/enums/enums2.cairo +++ b/exercises/enums/enums2.cairo @@ -54,20 +54,20 @@ fn print_messages_recursive(messages: Array, index: u32) { impl MessagePrintImpl of PrintTrait { fn print(self: Message) { - ('___MESSAGE BEGINS___').print(); + println!("___MESSAGE BEGINS___"); match self { - Message::Quit => ('Quit').print(), - Message::Echo(msg) => msg.print(), + Message::Quit => println!("Quit"), + Message::Echo(msg) => println!("{}", msg), Message::Move((a, b)) => { - a.print(); - b.print(); + println!("{}", a); + println!("{}",b); }, Message::ChangeColor((red, green, blue)) => { - red.print(); - green.print(); - blue.print(); + println!("{}",red); + println!("{}",green); + println!("{}",blue); } } - ('___MESSAGE ENDS___').print(); + println!("___MESSAGE ENDS___"); } } diff --git a/exercises/enums/enums3.cairo b/exercises/enums/enums3.cairo index ad2188f42..385161a0d 100644 --- a/exercises/enums/enums3.cairo +++ b/exercises/enums/enums3.cairo @@ -41,7 +41,7 @@ impl StateImpl of StateTrait { } fn echo(ref self: State, s: felt252) { - s.print(); + println!("{}", s); } fn move_position(ref self: State, p: Point) { diff --git a/exercises/functions/functions2.cairo b/exercises/functions/functions2.cairo index 9a65c72a8..f43a9a295 100644 --- a/exercises/functions/functions2.cairo +++ b/exercises/functions/functions2.cairo @@ -2,12 +2,11 @@ // Execute `starklings hint functions2` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use debug::PrintTrait; fn main() { call_me(3); } fn call_me(num:) { - num.print(); + println!("num is {}", num); } diff --git a/exercises/functions/functions3.cairo b/exercises/functions/functions3.cairo index 7eb6d6742..df0407dd4 100644 --- a/exercises/functions/functions3.cairo +++ b/exercises/functions/functions3.cairo @@ -2,12 +2,11 @@ // Execute `starklings hint functions3` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use debug::PrintTrait; fn main() { call_me(); } fn call_me(num: u64) { - num.print(); + println!("num is {}", num); } diff --git a/exercises/functions/functions4.cairo b/exercises/functions/functions4.cairo index b21f5cbee..07df25646 100644 --- a/exercises/functions/functions4.cairo +++ b/exercises/functions/functions4.cairo @@ -8,11 +8,10 @@ // to future exercises!) // I AM NOT DONE -use debug::PrintTrait; fn main() { let original_price = 51; - sale_price(original_price).print(); + println!("sale_price is {}", sale_price(original_price)); } fn sale_price(price: u32) -> { diff --git a/exercises/modules/modules2.cairo b/exercises/modules/modules2.cairo index 2f67a8ce3..259d83836 100644 --- a/exercises/modules/modules2.cairo +++ b/exercises/modules/modules2.cairo @@ -2,7 +2,6 @@ // These modules have some issues, can you fix? // Run `starklings hint modules2` or `hint` watch command for a hint. -use debug::PrintTrait; const YEAR: u16 = 2050; mod order { diff --git a/exercises/operations/operations1.cairo b/exercises/operations/operations1.cairo index d6f689734..6bddc2535 100644 --- a/exercises/operations/operations1.cairo +++ b/exercises/operations/operations1.cairo @@ -6,8 +6,6 @@ // TODO // Return the solution of x^3 + y - 2 -use debug::PrintTrait; - fn poly(x: usize, y: usize) -> usize { // FILL ME res // Do not change diff --git a/exercises/options/options2.cairo b/exercises/options/options2.cairo index 7999676fb..2e703de1b 100644 --- a/exercises/options/options2.cairo +++ b/exercises/options/options2.cairo @@ -4,7 +4,6 @@ // I AM NOT DONE use option::OptionTrait; -use debug::PrintTrait; #[test] fn test_options() { @@ -19,5 +18,5 @@ fn simple_option(optional_target: Option) { // TODO: use the `is_some` and `is_none` methods to check if `optional_target` contains a value. // Place the assertion and the print statement below in the correct blocks. assert(optional_target.unwrap() == 'starklings', 'err1'); - ('option is empty !').print(); + println!(" option is empty ! "); } diff --git a/exercises/options/options3.cairo b/exercises/options/options3.cairo index c5e9c9de2..024d69365 100644 --- a/exercises/options/options3.cairo +++ b/exercises/options/options3.cairo @@ -4,7 +4,6 @@ // I AM NOT DONE use option::OptionTrait; -use debug::PrintTrait; use array::ArrayTrait; #[derive(Drop)] @@ -41,7 +40,7 @@ fn display_grades(student: @Student, index: usize) { // TODO: Modify the following lines so that if there is a grade for the course, it is printed. // Otherwise, print "No grade". // - course.unwrap().print(); + println!("grade is {}", course.unwrap()); display_grades(student, index + 1); } diff --git a/exercises/primitive_types/primitive_types1.cairo b/exercises/primitive_types/primitive_types1.cairo index 0277d90ef..cb14c5866 100644 --- a/exercises/primitive_types/primitive_types1.cairo +++ b/exercises/primitive_types/primitive_types1.cairo @@ -4,18 +4,16 @@ // I AM NOT DONE -use debug::PrintTrait; - fn main() { // Booleans (`bool`) let is_morning = true; if is_morning { - ('Good morning!').print(); + println!("Good morning!"); } let // Finish the rest of this line like the example! Or make it be false! if is_evening { - ('Good evening!').print(); + println!("Good evening!"); } } diff --git a/exercises/primitive_types/primitive_types2.cairo b/exercises/primitive_types/primitive_types2.cairo index aa0360a0a..dfa1da560 100644 --- a/exercises/primitive_types/primitive_types2.cairo +++ b/exercises/primitive_types/primitive_types2.cairo @@ -4,8 +4,6 @@ // I AM NOT DONE -use debug::PrintTrait; - fn main() { // A short string is a string whose length is at most 31 characters, and therefore can fit into a single field element. // Short strings are actually felts, they are not a real string. @@ -15,27 +13,27 @@ fn main() { if is_alphabetic( ref my_first_initial ) { - ('Alphabetical!').print(); + println!(" Alphabetical !"); } else if is_numeric( ref my_first_initial ) { - ('Numerical!').print(); + println!(" Numerical !"); } else { - ('Neither alphabetic nor numeric!').print(); + println!(" Neither alphabetic nor numeric!"); } - let // Finish this line like the example! What's your favorite short string? + let // Finish this line like the example! What's your favorite short string? // Try a letter, try a number, try a special character, try a short string! if is_alphabetic( ref your_character ) { - ('Alphabetical!').print(); + println!(" Alphabetical !"); } else if is_numeric( ref your_character ) { - ('Numerical!').print(); + println!(" Numerical!"); } else { - ('Neither alphabetic nor numeric!').print(); + println!(" Neither alphabetic nor numeric!"); } } diff --git a/exercises/primitive_types/primitive_types3.cairo b/exercises/primitive_types/primitive_types3.cairo index c70193b76..1855afe97 100644 --- a/exercises/primitive_types/primitive_types3.cairo +++ b/exercises/primitive_types/primitive_types3.cairo @@ -4,11 +4,9 @@ // I AM NOT DONE -use debug::PrintTrait; - fn main() { let cat = ('Furry McFurson', 3); let // your pattern here = cat; - name.print(); - age.print(); + println!("name is {}", name); + println!("age is {}", age); } diff --git a/exercises/variables/variables1.cairo b/exercises/variables/variables1.cairo index 081911134..de0169fce 100644 --- a/exercises/variables/variables1.cairo +++ b/exercises/variables/variables1.cairo @@ -7,6 +7,6 @@ use debug::PrintTrait; fn main() { - x = 5; - x.print(); + x = 5 ; + println!(" x is {}", x) } diff --git a/exercises/variables/variables2.cairo b/exercises/variables/variables2.cairo index 9c580a9f7..f8fec80ad 100644 --- a/exercises/variables/variables2.cairo +++ b/exercises/variables/variables2.cairo @@ -7,8 +7,8 @@ use debug::PrintTrait; fn main() { let x; if x == 10 { - ('x is ten!').print(); + println!("x is ten! "); } else { - ('x is not ten!').print(); + println!("x is not ten! "); } } diff --git a/exercises/variables/variables3.cairo b/exercises/variables/variables3.cairo index 84dd25e17..a6bfe4d32 100644 --- a/exercises/variables/variables3.cairo +++ b/exercises/variables/variables3.cairo @@ -6,5 +6,5 @@ use debug::PrintTrait; fn main() { let x: felt252; - x.print(); + println!("x is {}", x); } diff --git a/exercises/variables/variables4.cairo b/exercises/variables/variables4.cairo index 30826e789..dc5197628 100644 --- a/exercises/variables/variables4.cairo +++ b/exercises/variables/variables4.cairo @@ -6,7 +6,7 @@ use debug::PrintTrait; fn main() { let x = 3; - x.print(); + println!("x is {}", x); x = 5; // don't change this line - x.print(); + println!("x is now {}", x); } diff --git a/exercises/variables/variables5.cairo b/exercises/variables/variables5.cairo index 1e422aa69..9a4256efa 100644 --- a/exercises/variables/variables5.cairo +++ b/exercises/variables/variables5.cairo @@ -6,7 +6,7 @@ use debug::PrintTrait; fn main() { let number = 1_u8; // don't change this line - number.print(); + println!("number is {}", number); number = 3; // don't rename this variable - number.print(); + println!("number is {}", number); } diff --git a/exercises/variables/variables6.cairo b/exercises/variables/variables6.cairo index c4bba1f13..2d84320a6 100644 --- a/exercises/variables/variables6.cairo +++ b/exercises/variables/variables6.cairo @@ -7,6 +7,6 @@ use debug::PrintTrait; const NUMBER = 3; const SMALL_NUMBER = 3_u8; fn main() { - NUMBER.print(); - SMALL_NUMBER.print(); + println!("NUMBER is {}", NUMBER); + println!("SMALL_NUMBER is {}", SMALL_NUMBER); }