Skip to content

Instantly share code, notes, and snippets.

View jeantil's full-sized avatar
✔️

Jean Helou jeantil

✔️
View GitHub Profile
git clone git://github.com/jeantil/kata.git
git checkout -b {local_branch} origin/puissance4-20110222
@jeantil
jeantil / Mastermind.java
Created February 24, 2011 18:01
softeam dojo 6
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class Mastermind {
public int[] solve(String[] guess, String[] secret) {
int bonBienplace = 0;
int bonMalplace = 0;
Set<String> setSecret = new HashSet<String>(Arrays.asList(secret));
@jeantil
jeantil / gist:842574
Created February 24, 2011 18:04
softeam dojo 5
; testmastermind.ik
use("ispec")
use("mastermind-kata")
; Quick reminder how ispec works
;describe(
; Object | "method" ,
; it("should be the title of the test",
; call should == result ?
; m should not be same(Foo)
@jeantil
jeantil / mastermind.rb
Created February 24, 2011 18:11
softeam dojo 4
# To change this template, choose Tools | Templates
# and open the template in the editor.
class Arbitre
def initialize
end
def reponse(secret, guess)
c=0
secret.each_with_index do |e, i|
@jeantil
jeantil / gol.html
Created February 24, 2011 18:13
dojo softeam 3
<!DOCTYPE html>
<html>
<head>
<title>Game Of Life</title>
<script src="lib/processing.js"></script>
<script src="gameoflife.js"></script>
<!-- tests -->
<script src="lib/jquery.js"></script>
<script src="test/qunit.js"></script>
@jeantil
jeantil / casiers.rb
Created February 24, 2011 18:28
dojo softeam 2
require 'test/unit'
class Solver
def solve(it)
if(it == 12 )
return [1,4,9,12]
elsif(it >= 9 )
return [1,4,9]
elsif(it>=4)
return [1,4]
@jeantil
jeantil / nimm.rb
Created February 24, 2011 18:31
dojo softeam 1
class Solver
attr_reader :stones
def initialize(heap=0)
@win=false
@stones=heap
end
def user_wins?
@win
end
def play(take)
package dojo.kata;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import sun.swing.MenuItemLayoutHelper.ColumnAlignment;
package eu.byjean.bintext;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
package eu.bjean
object Mastermind {
def check(secret: Symbol*)(guess: Symbol*): (Int, Int) = {
val (goodPairs,badPairs) = secret.zip(guess).partition({ case (x, y) => x == y })
var badCount = 0
if (badPairs.size > 0) {