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
    
  
  
    
  | @Composable | |
| private fun Highlight( | |
| modifier: Modifier | |
| ) { | |
| Canvas(modifier) { | |
| drawRect( | |
| color = Color.Yellow, | |
| size = size, | |
| alpha = 0.15f | |
| ) | 
  
    
      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
    
  
  
    
  | @Composable | |
| private fun CircleDecoratedSquare( | |
| modifier: Modifier | |
| ) { | |
| Canvas(modifier) { | |
| drawCircle( | |
| color = Color.DarkGray, | |
| radius = size.minDimension / 3f, // 6f for a smaller one | |
| alpha = 0.25f, | |
| style = Stroke(width = size.minDimension / 12f) // or Fill | 
  
    
      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
    
  
  
    
  | @Composable | |
| fun Moves( | |
| gameState: GameState, | |
| onClickMove: (Int) -> Unit, | |
| ) { | |
| val listState = rememberLazyListState() | |
| val coroutineScope = rememberCoroutineScope() | |
| LazyRow( | |
| state = listState, | 
  
    
      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
    
  
  
    
  | @Composable | |
| private fun Pill(content: @Composable () -> Unit) { | |
| Box( | |
| modifier = Modifier | |
| .background( | |
| color = someColour, | |
| shape = RoundedCornerShape(6.dp) | |
| ) | |
| ) { | |
| content() | 
  
    
      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
    
  
  
    
  | private fun Modifier.pill(): Modifier = | |
| this.background( | |
| color = someColour, | |
| shape = RoundedCornerShape(6.dp) | |
| ) | 
  
    
      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
    
  
  
    
  | BoxWithConstraints( | |
| modifier = Modifier | |
| .fillMaxWidth() | |
| .aspectRatio(1f) | |
| ) { | |
| val squareSize = maxWidth / 8 | |
| } | 
  
    
      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
    
  
  
    
  | val fromPosition = properties.fromState.board.find(piece)?.position | |
| val currentOffset = fromPosition | |
| ?.toCoordinate(properties.isFlipped) | |
| ?.toOffset(properties.squareSize) | |
| val targetOffset = toPosition | |
| .toCoordinate(properties.isFlipped) | |
| .toOffset(properties.squareSize) | 
  
    
      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
    
  
  
    
  | val offset = remember { Animatable(currentOffset ?: targetOffset, Offset.VectorConverter) } | |
| LaunchedEffect(targetOffset) { | |
| offset.animateTo(targetOffset, tween(100, easing = LinearEasing)) | |
| } | |
| Piece( | |
| piece = piece, | |
| modifier = offset.value.toModifier() | |
| ) | 
  
    
      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
    
  
  
    
  | val offset = remember { Animatable(currentOffset ?: targetOffset, Offset.VectorConverter) } | |
| LaunchedEffect(targetOffset) { | |
| offset.animateTo(targetOffset, tween(100, easing = LinearEasing)) | |
| } | |
| LaunchedEffect(isFlipped) { | |
| offset.snapTo(targetOffset) | |
| } | 
  
    
      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
    
  
  
    
  | interface DatasetVisualisation : Parcelable { | |
| // String resource | |
| val name: Int | |
| // Global minimum value | |
| val minValue: Int | |
| // Global maximum value | |
| val maxValue: Int | |