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
| // Given a graph of caves with closed flow valves. | |
| // 1) find best route to maximise flow in a given time. | |
| // 2) Repeat (1), but with a friend to help you. | |
| // https://dartpad.dev/?id=21918b81ce0862035af8941732185e42 | |
| import 'package:collection/collection.dart'; | |
| class Node implements Comparable { | |
| String id; | |
| int rate; |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Snake Game in Dartpad</title> | |
| <link rel="stylesheet" href="styles.css"> | |
| <script type="application/dart" src="main.dart"></script> | |
| </head> |
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
| /// Sensors can see closest beacons, which means others may be out there. | |
| /// 1) find 'clear' points on a given line. | |
| /// 2) find only 'unclear' point in a given area. | |
| /// https://dartpad.dev/?id=e7a65ba0de0eaf3af0e5047993a1db07 | |
| import 'dart:math'; | |
| // import 'package:more/more.dart'; | |
| extension IntegerRangeExtension on int { | |
| List<int> to(int end, {int step = 1}) => | |
| List.generate((end - this + (step - 1)) ~/ step, (i) => i * step + this); |
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
| /// Build a passage, then flow sand through it | |
| /// 1) until it is "filled" - any more flows out | |
| /// 2) until the pile reaches the source | |
| /// https://dartpad.dev/?id=018911e7d2f3acf18878b98c80f5ddcf | |
| import 'dart:math'; | |
| import 'package:collection/collection.dart'; | |
| extension IntegerRangeExtension on int { | |
| List<int> to(int end, {int step = 1}) => |
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
| /// Compare pairs of lines and sort them | |
| /// 1) pairwise | |
| /// 2) as one big list with interlopers and find the interlopers | |
| /// https://dartpad.dev/?id=b0229038302825e766735a5c71c7760c | |
| import 'dart:math'; | |
| import 'package:collection/collection.dart'; | |
| import 'package:petitparser/petitparser.dart'; | |
| extension IntegerRangeExtension on int { |
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
| /// Build a graph then move round the graph. | |
| /// 1) from start to end | |
| /// 2) from end to closest valid start | |
| /// https://dartpad.dev/?id=6bd913aa909968c43775f67798c604d5 | |
| import 'dart:math'; | |
| import 'package:collection/collection.dart'; | |
| extension IntegerRangeExtension on int { | |
| List<int> to(int end, {int step = 1}) => |
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
| /// Monkeys operate on lists of values and pass them around. How many times | |
| /// do they operate on items under given circumstances? | |
| /// 1) with simple rules | |
| /// 2) with big big big numbers | |
| /// https://dartpad.dev/?id=4f01128fb5d643630d1cae157c933395 | |
| import 'package:collection/collection.dart'; | |
| import 'package:petitparser/petitparser.dart'; | |
| extension IntegerRangeExtension on int { |
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
| /// A register gets updated by simple instructions | |
| /// 1) What is its value at certain times? | |
| /// 2) Draw a screen based on these. What letters can you see? | |
| /// https://dartpad.dev/?id=ec8de8c97bcd045af9c7faf139db924c | |
| import 'package:collection/collection.dart'; | |
| extension IntegerRangeExtension on int { | |
| List<int> to(int end, {int step = 1}) => | |
| List.generate((end - this + (step - 1)) ~/ step, (i) => i * step + this); |
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
| /// A segmented worm is dragged across a grid, each segment moving according to | |
| /// simple rules. How many squares does the tail visit? | |
| /// 1) Length 2 | |
| /// 2) Length 10 | |
| /// https://dartpad.dev/?id=3946d480d2495858035af35df9317584 | |
| import 'dart:math'; | |
| extension IntegerRangeExtension on int { | |
| List<int> to(int end, {int step = 1}) => |
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
| /// Given a grid of (real) trees of different heights | |
| /// 1) Find how many are visible from any edge | |
| /// 2) Find the best view from any trees (= product of distances) | |
| /// https://dartpad.dev/?id=a2f73b120ad6620d14ff769d54c71efd | |
| import 'dart:math'; | |
| extension IntegerRangeExtension on int { | |
| List<int> to(int end, {int step = 1}) => | |
| List.generate((end - this + (step - 1)) ~/ step, (i) => i * step + this); |