File tree Expand file tree Collapse file tree
topics/tic-tac-toe/src/player Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,12 @@ pub struct AIMinMax {
99 ai_player : Option < PlayerID > , // (me)
1010}
1111
12+ impl Default for AIMinMax {
13+ fn default ( ) -> Self {
14+ Self :: new ( )
15+ }
16+ }
17+
1218impl AIMinMax {
1319 pub fn new ( ) -> Self {
1420 AIMinMax { ai_player : None }
Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ pub struct TerminalPlayer {
1616 me : Option < PlayerID > ,
1717}
1818
19+ impl Default for TerminalPlayer {
20+ fn default ( ) -> Self {
21+ Self :: new ( )
22+ }
23+ }
24+
1925impl TerminalPlayer {
2026 pub fn new ( ) -> Self {
2127 TerminalPlayer {
@@ -34,7 +40,7 @@ impl TerminalPlayer {
3440 . map_err ( |e| Error :: Other ( e. to_string ( ) ) ) ?;
3541
3642 match input. trim ( ) . parse :: < u8 > ( ) {
37- Ok ( num) if num < 9 => return Ok ( num) ,
43+ Ok ( num) if num < 9 => Ok ( num) ,
3844 _ => Err ( Error :: InvalidInput ) ,
3945 }
4046 }
You can’t perform that action at this time.
0 commit comments