Last active
November 25, 2019 23:04
-
-
Save ignaciomosca/849c82550414fbc0bcca3231dc1bc85a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package main | |
import "fmt" | |
type ChessPiece struct { | |
row int | |
col int | |
piece rune | |
} | |
type Board struct { | |
rows int | |
cols int | |
pieces [5]ChessPiece | |
} | |
func main() { | |
chessPiece := ChessPiece {1,1,'R'} | |
chessPiece2 := ChessPiece {1,1,'R'} | |
itwerks := make(map[ChessPiece]bool) | |
board := Board {7,7, itwerks} | |
boards := make(map[Board] bool) | |
itwerks[chessPiece] = true | |
itwerks[chessPiece2] = true | |
numberOfPieces := len(itwerks) | |
fmt.Println(numberOfPieces) //it would return 1 but it doesn't because it does not compile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment