django-admin startproject site
python manage.py startapp appname
- Edit
appname/views.py
- Edit
appname/urls.py
- Edit
site/urls.py
package main | |
import "fmt" | |
import "time" | |
var finalchan = make(chan time.Time) | |
func chain(n int, in chan time.Time) { | |
var out chan time.Time |
What is the simplest Go scoring system? It's this:
At the end of the game, both players will want to fill in as much of their own territory as they can, while allowing two eyes per group (so they aren't captured). Then the winner is just the player with more stones on the board. Note that prisoners are not counted.
But nobody wants to play all these extra stones at the end. So we can instead use:
Due to a bunch of stupid issues in C with autocasting, sensible ways of parsing network bytes into something like an int might not work as expected, for which see here:
https://justine.lol/endian.html
The solution is something like this (mutatis mutandis if the incoming thing is little endian).
https://news.ycombinator.com/item?id=27086482
uint32_t read32be(const uint8_t *p) {
"use strict"; | |
const barker_props = { | |
bark() { | |
console.log(`Woof, I am ${this.name}`); | |
} | |
}; | |
const meower_props = { | |
meow() { |
If your language can generate a standalone binary for Linux, probably you can use it for Lux. This little guide details what I learned writing a Golang bot for the competition.
The first thing Lux will do when running your bot is run (or possibly import) main.py
, a Python script which will call your bot as a subprocess. This script will pass your stdout to Lux, and will pass the game state each turn to your bot.
Various main.py
scripts exist now in the official Lux kits. I recommend using the JavaScript kit's main.py
(yes, it's a Python script in the JavaScript kit). This version of main.py
has the useful property that it adjusts what Lux sends it slightly, producing a consistently-formatted input to your bot. All you have to do is edit it so that instead of running node
as its subprocess, it runs your bot instead.
For each move in the game history: | |
Generate a difficulty statistic for the position in which the move was made, as follows: | |
- For each candidate move (i.e. each entry in moveInfos) multiply the prior by the points the move | |
loses, which is the rootInfo scoreLead minus the moveInfo scoreLead, adjusted for colour if needed | |
and clamped so it's not less than 0. | |
- Sum the values produced in this manner (from all the moveInfos). | |
Generate a raw weight, as follows: | |
- Divide the difficulty stat by the sum of the moveInfos priors (usually this is close to 1; so |
{ | |
"File": "TODO", | |
"About": "TODO", | |
"New game": "TODO", | |
"New 960 game": "TODO", | |
"Open PGN...": "TODO", | |
"Load FEN / PGN from clipboard": "TODO", | |
"Save this game...": "TODO", | |
"Write PGN to clipboard": "TODO", | |
"PGN saved statistics": "TODO", |