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> | |
| <meta charset="utf-8"> | |
| <style> | |
| body { | |
| background: #000; | |
| } | |
| </style> | |
| <body> |
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
| #![allow(dead_code)] | |
| use std::path::posix::Path; | |
| use std::io::fs::File; | |
| use std::io::{BufferedReader, Reader, stdin}; | |
| use std::vec::Vec; | |
| use std::collections::{Set, HashSet, MutableSet, Bitv}; | |
| use std::cmp::{min, max}; | |
| type Grid = Vec<String>; |
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
| <html> | |
| <head> | |
| <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
| <style>*{margin:0;padding:0;}</style> | |
| </head> | |
| <body> | |
| <canvas id="screen" width=1920 height=1080></canvas> | |
| <script> | |
| var step = 0; | |
| var width=1920; |
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
| <html> | |
| <head> | |
| <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
| </head> | |
| <body> | |
| <canvas id="screen" width=640 height=640></canvas> | |
| <script> | |
| var step = 0; | |
| function render(x, y, t) { |
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
| <html> | |
| <head> | |
| <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
| </head> | |
| <body> | |
| <canvas id="screen" width=640 height=640></canvas> | |
| <script> | |
| var step = 0; | |
| function render(x, y, t) { |
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 | |
| // run with: $ go test --bench=. -test.benchmem . | |
| // @see https://twitter.com/karlseguin/status/524452778093977600 | |
| import ( | |
| "math/rand" | |
| "strconv" | |
| "testing" | |
| ) |
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
| $(document).ready(function() | |
| { | |
| } | |
| ); |
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> | |
| <style> | |
| * { | |
| padding:0; | |
| margin:0; | |
| } | |
| #canvas { | |
| width:400px; |
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 name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
| <style type="text/css"> | |
| html { | |
| height:100% | |
| } | |
| body { | |
| height:100%; |
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
| ''' | |
| The algorithm works as follows: | |
| It simply checks all positions, with positions being marked with None (unknown) x (part of a ship) or o (no ship) | |
| Because the description says that ships can't touch (including diagonally) you know for sure that if a position | |
| has the part of a ship that the positions diagonal to it don't, like so: | |
| o.o | |
| .x. | |
| o.o |
OlderNewer