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
| ; {{{ Load up GTK+ | |
| (LOAD '/opt/lisp/quicklisp/setup.lisp) | |
| (ql:quickload "cffi") | |
| (ql:quickload "trivial-garbage") | |
| (ql:quickload "iterate") | |
| (ql:quickload "bordeaux-threads") | |
| (ql:quickload "closer-mop") | |
| (ql:quickload "cl-opengl") | |
| (ql:quickload "cl-cairo2") | |
| (asdf:operate 'asdf:load-op :cl-gtk2-gtk) |
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
| -- | BruteQueens.hs | |
| -- | -------------- | |
| -- | A brute-force Haskell solution for the generic NxN queens puzzle. | |
| -- | Exactly the same as Queens.hs, though much less efficient. | |
| import System.Environment | |
| type Queen = (Int,Int) | |
| main :: IO () |
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
| {- | |
| - Problem URL: http://code.google.com/codejam/contest/32016/dashboard#s=p0 | |
| - | |
| - solve takes as input a list of strings for a particular case | |
| - and returns a string representation of its solution. | |
| -} | |
| solve :: [String] -> String | |
| solve input = show $ minimum options | |
| where (l1:l2:l3:_) = input |
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
| data Unsolved = Unsolved { unsolvedNumber :: Int, input :: String } | |
| data Solved = Solved { solvedNumber :: Int, answer :: String } | |
| instance Show Solved where | |
| show (Solved n ans) = "Case #" ++ (show n) ++ ": " ++ ans | |
| main :: IO () | |
| main = do | |
| input <- fmap lines getContents | |
| let input' = tail input |
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
| type Input = [String] | |
| data Unsolved = Unsolved { unsolvedNumber :: Int, input :: Input } | |
| data Solved = Solved { solvedNumber :: Int, answer :: String } | |
| data Item = Item { index :: Int, price :: Int } | |
| instance Show Solved where | |
| show (Solved n ans) = "Case #" ++ (show n) ++ ": " ++ ans |
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
| import Data.List | |
| type Input = [String] | |
| data Unsolved = Unsolved { unsolvedNumber :: Int, input :: Input } | |
| data Solved = Solved { solvedNumber :: Int, answer :: String } | |
| data Item = Item { index :: Int, price :: Int } | |
| instance Show Solved where |
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
| CC := gcc | |
| CFLAGS := -g -Wall | |
| LIBS := -lallegro | |
| SOURCES := $(shell find src/ -type f -name "*.c") | |
| OBJECTS := $(SOURCES:.c=.o) | |
| TARGET := game | |
| all: $(SOURCES) $(TARGET) | |
| $(TARGET): $(OBJECTS) |
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
| // src/main.c | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <libspotify/api.h> | |
| #define DEBUG 1 | |
| extern const uint8_t g_appkey[]; | |
| extern const size_t g_appkey_size; |
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
| CC := clang | |
| PKGS := libspotify alsa | |
| CFLAGS := -g -Wall `pkg-config --cflags $(PKGS)` | |
| LIBS := `pkg-config --libs $(PKGS)` -lpthread | |
| TARGET := spot | |
| SOURCES := $(shell find src/ -type f -name *.c) | |
| OBJECTS := $(patsubst src/%,build/%,$(SOURCES:.c=.o)) | |
| DEPS := $(OBJECTS:.o=.deps) |
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
| import Control.Monad | |
| import Data.List | |
| import Data.Maybe | |
| import System.Exit | |
| main = do | |
| -- get the number for this case, and exit if it's equal to 0 | |
| n <- liftM read getLine :: IO (Int) | |
| when (n == 0) exitSuccess | |
OlderNewer