public static void Main() { Tapper tap = new Tapper(); DvdList fiveShakespeareMovies = new DvdList(); fiveShakespeareMovies.append("10 Things I Hate About You"); fiveShakespeareMovies.append("Shakespeare In Love"); fiveShakespeareMovies.append("O (2001)"); fiveShakespeareMovies.append("American Pie 2"); fiveShakespeareMovies.append("Scotland, PA."); fiveShakespeareMovies.append("Hamlet (2000)"); DvdListIterator fiveShakespeareIterator = fiveShakespeareMovies.createIterator(); int a_num_iterations = 0; while (!fiveShakespeareIterator.isDone()) { a_num_iterations++; fiveShakespeareIterator.next(); } tap.test("First iteration", a_num_iterations , 6 ); fiveShakespeareMovies.delete("American Pie 2"); fiveShakespeareIterator.first(); int b_num_iterations = 0; while (!fiveShakespeareIterator.isDone()) { b_num_iterations++; fiveShakespeareIterator.next(); } tap.test("Second iteration", b_num_iterations , (a_num_iterations-1) ); tap.done(); }
static void Main() { Tapper tapper = new Tapper(); String topTitle; DvdCategory comedy = new DvdCategory("Comedy"); comedy.setTopCategoryTitle("Ghost World"); DvdSubCategory comedyChildrens = new DvdSubCategory(comedy, "Childrens"); DvdSubSubCategory comedyChildrensAquatic = new DvdSubSubCategory(comedyChildrens, "Aquatic"); comedyChildrensAquatic.setTopSubSubCategoryTitle("Sponge Bob Squarepants"); topTitle = comedy.getTopTitle(); tapper.test("DvdCategory Test", ("The top title for " + comedy.getAllCategories() + " is " + topTitle), "The top title for Comedy is Ghost World"); String topTitle2 = comedyChildrens.getTopTitle(); tapper.test("DvdSubCategory top title test", ("The top title for " + comedyChildrens.getAllCategories() + " is " + topTitle2), "The top title for Comedy/Childrens is Ghost World"); String topTitle3 = comedyChildrensAquatic.getTopTitle(); tapper.test("DvdSubSubCategory top title test ", "The top title for " + comedyChildrensAquatic.getAllCategories() + " is " + topTitle3, "The top title for Comedy/Childrens/Aquatic is Sponge Bob Squarepants" ); tapper.done(); }
public static void Main() { teaFlavorFactory = new TeaFlavorFactory(); takeOrders("chai", 2); takeOrders("chai", 2); takeOrders("camomile", 1); takeOrders("camomile", 1); takeOrders("earl grey", 1); takeOrders("camomile", 897); takeOrders("chai", 97); takeOrders("chai", 97); takeOrders("camomile", 3); takeOrders("earl grey", 3); takeOrders("chai", 3); takeOrders("earl grey", 96); takeOrders("camomile", 552); takeOrders("chai", 121); takeOrders("earl grey", 121); for (int i = 0; i < ordersMade; i++) { flavors[i].serveTea(tables[i]); } Tapper tap = new Tapper(); tap.test("Flyweight test", ("total teaFlavor objects made: " + teaFlavorFactory.getTotalTeaFlavorsMade()), ("total teaFlavor objects made: 3") ); tap.done(); }
public static void Main() { DvdNameContext allCapContext = new DvdNameContext('C'); DvdNameContext theEndContext = new DvdNameContext('E'); DvdNameContext spacesContext = new DvdNameContext('S'); List <string> dvdNames = new List <string>(); dvdNames.Add("Jay and Silent Bob Strike Back"); dvdNames.Add("The Fast and the Furious"); dvdNames.Add("The Others"); char replaceChar = '*'; Tapper tap = new Tapper(); tap.test("Testing formatting with all caps", allCapContext.formatDvdNames(dvdNames), ("JAY AND SILENT BOB STRIKE BACK, THE FAST AND THE FURIOUS, THE OTHERS")); tap.test("Testing formatting with beginning the at end", theEndContext.formatDvdNames(dvdNames), ("Jay and Silent Bob Strike Back, Fast and the Furious, The, Others, The")); tap.test("Testing formatting with all spaces replaced with " + replaceChar, spacesContext.formatDvdNames(dvdNames, replaceChar), ("Jay*and*Silent*Bob*Strike*Back, The*Fast*and*the*Furious, The*Others")); tap.done(); }
public static void Main() { Tapper tap = new Tapper(); DvdDetails.DvdMemento dvdMementoCaretaker; //the Caretaker List <string> stars = new List <string>(); stars.Add("Guy Pearce"); DvdDetails dvdDetails = new DvdDetails("Memento", stars, '1'); dvdMementoCaretaker = dvdDetails.createDvdMemento(); tap.test("Showing initial state of DvdDetails ", dvdDetails.formatDvdDetails(), "DVD: Memento, starring: Guy Pearce, encoding region: 1"); dvdDetails.addStar("edskdzkvdfb"); tap.test("Cappuccion on the keyboard!", dvdDetails.formatDvdDetails(), "DVD: Memento, starring: Guy Pearce, edskdzkvdfb, encoding region: 1"); tap.test("show memento state", dvdMementoCaretaker.showMemento(), "DVD: Memento, starring: Guy Pearce, encoding region: 1"); //show the memento dvdDetails.setDvdMemento(dvdMementoCaretaker); //back off changes tap.test("show backed off state", dvdDetails.formatDvdDetails(), "DVD: Memento, starring: Guy Pearce, encoding region: 1"); tap.done(); }
public static void Main() { PotOfTeaInterface potOfTea = new PotOfTeaProxy(); Tapper tap = new Tapper(); tap.test("TestProxy: pouring tea", potOfTea.pourTea(), ("Pouring tea")); tap.done(); }
public static void Main() { Tea teaLeaves = new TeaLeaves(); Tea chaiDecorator = new ChaiDecorator(teaLeaves); Tapper tap = new Tapper(); tap.test("steep chai test", chaiDecorator.steepTea(), ("bay leaf is steeping, cinnamon stick is steeping, ginger is steeping, honey is steeping, soy milk is steeping, vanilla bean is steeping")); tap.done(); }
public static void Main() { FacadeCuppaMaker cuppaMaker = new FacadeCuppaMaker(); FacadeTeaCup teaCup = cuppaMaker.makeACuppa(); Tapper tap = new Tapper(); tap.test("Facade test", teaCup.ToString(), ("A nice cuppa tea!")); tap.done(); }
public static void Main() { Tapper tap = new Tapper(); SoupFactoryMethod sfm = new SoupFactoryMethod(); SoupBuffet soupBuffet = sfm.makeSoupBuffet(); soupBuffet.setSoupBuffetName(sfm.makeBuffetName()); soupBuffet.setChickenSoup(sfm.makeChickenSoup()); soupBuffet.setClamChowder(sfm.makeClamChowder()); soupBuffet.setFishChowder(sfm.makeFishChowder()); soupBuffet.setMinnestrone(sfm.makeMinnestrone()); soupBuffet.setPastaFazul(sfm.makePastaFazul()); soupBuffet.setTofuSoup(sfm.makeTofuSoup()); soupBuffet.setVegetableSoup(sfm.makeVegetableSoup()); tap.test("Base Soup Factory Method", ("At the " + soupBuffet.getSoupBuffetName() + soupBuffet.getTodaysSoups()), ("At the Soup Buffet Today's Soups! , Chicken Soup: , ChickenSoup, Clam Chowder: , ClamChowder, Fish Chowder: , FishChowder, Minnestrone: , Minestrone, Pasta Fazul: , Pasta Fazul, Tofu Soup: , Tofu Soup, Vegetable Soup: , Vegetable Soup") ); SoupFactoryMethod bsfm = new BostonSoupFactoryMethodSubclass(); SoupBuffet bsb = bsfm.makeSoupBuffet(); bsb.setSoupBuffetName(bsfm.makeBuffetName()); bsb.setChickenSoup(bsfm.makeChickenSoup()); bsb.setClamChowder(bsfm.makeClamChowder()); bsb.setFishChowder(bsfm.makeFishChowder()); bsb.setMinnestrone(bsfm.makeMinnestrone()); bsb.setPastaFazul(bsfm.makePastaFazul()); bsb.setTofuSoup(bsfm.makeTofuSoup()); bsb.setVegetableSoup(bsfm.makeVegetableSoup()); tap.test("Boston Soup Factory Method", ("At the " + bsb.getSoupBuffetName() + bsb.getTodaysSoups()), ("At the Boston Soup Buffet Today's Soups! , Chicken Soup: , ChickenSoup, Clam Chowder: , QuahogChowder, Fish Chowder: , ScrodFishChowder, Minnestrone: , Minestrone, Pasta Fazul: , Pasta Fazul, Tofu Soup: , Tofu Soup, Vegetable Soup: , Vegetable Soup") ); SoupFactoryMethod hsfm = new HonoluluSoupFactoryMethodSubclass(); SoupBuffet hsb = hsfm.makeSoupBuffet(); hsb.setSoupBuffetName(hsfm.makeBuffetName()); hsb.setChickenSoup(hsfm.makeChickenSoup()); hsb.setClamChowder(hsfm.makeClamChowder()); hsb.setFishChowder(hsfm.makeFishChowder()); hsb.setMinnestrone(hsfm.makeMinnestrone()); hsb.setPastaFazul(hsfm.makePastaFazul()); hsb.setTofuSoup(hsfm.makeTofuSoup()); hsb.setVegetableSoup(hsfm.makeVegetableSoup()); tap.test("Honolulu Factory Method test ", ("At the " + hsb.getSoupBuffetName() + hsb.getTodaysSoups()), ("At the Honolulu Soup Buffet Today's Soups! , Chicken Soup: , ChickenSoup, Clam Chowder: , PacificClamChowder, Fish Chowder: , OpakapakaFishChowder, Minnestrone: , Minestrone, Pasta Fazul: , Pasta Fazul, Tofu Soup: , Tofu Soup, Vegetable Soup: , Vegetable Soup") ); tap.done(); }
public static void Main() { DvdStateContext stateContext = new DvdStateContext(); Tapper tap = new Tapper(); tap.test("State 1 test", stateContext.showName("Sponge Bob Squarepants - Nautical Nonsense and Sponge Buddies"), ("Sponge*Bob*Squarepants*-*Nautical*Nonsense*and*Sponge*Buddies")); tap.test("State 2 test", stateContext.showName("Jay and Silent Bob Strike Back"), ("Jay*and*Silent*Bob*Strike*Back")); tap.test("State 3 test", stateContext.showName("Buffy The Vampire Slayer Season 2"), ("Buffy!The!Vampire!Slayer!Season!2")); tap.test("State 4 test", stateContext.showName("The Sopranos Season 2"), ("The*Sopranos*Season*2")); tap.done(); }
public static void Main() { AbstractSoupFactory concreteSoupFactory = new BostonConcreteSoupFactory(); Soup soupOfTheDay = MakeSoupOfTheDay(concreteSoupFactory); Tapper tap = new Tapper(); tap.test("Boston soup of the day test ", ("The Soup of the day " + concreteSoupFactory.getFactoryLocation() + " is " + soupOfTheDay.getSoupName()), ("The Soup of the day Boston is Tofu Soup")); concreteSoupFactory = new HonoluluConcreteSoupFactory(); soupOfTheDay = MakeSoupOfTheDay(concreteSoupFactory); tap.test("Honolulu soup of the day test ", ("The Soup of the day " + concreteSoupFactory.getFactoryLocation() + " is " + soupOfTheDay.getSoupName()), ("The Soup of the day Honolulu is Tofu Soup")); tap.done(); }
public static void Main() { DvdInterpreterContext dvdInterpreterContext = new DvdInterpreterContext(); dvdInterpreterContext.addTitle("Caddy Shack"); dvdInterpreterContext.addTitle("Training Day"); dvdInterpreterContext.addTitle("Hamlet"); dvdInterpreterContext.addActor("Ethan Hawke"); dvdInterpreterContext.addActor("Denzel Washington"); dvdInterpreterContext.addTitleAndActor(new TitleAndActor("Hamlet", "Ethan Hawke")); dvdInterpreterContext.addTitleAndActor(new TitleAndActor("Training Day", "Ethan Hawke")); dvdInterpreterContext.addTitleAndActor(new TitleAndActor("Caddy Shack", "Ethan Hawke")); dvdInterpreterContext.addTitleAndActor(new TitleAndActor("Training Day", "Denzel Washington")); DvdInterpreterClient dvdInterpreterClient = new DvdInterpreterClient(dvdInterpreterContext); Tapper tap = new Tapper(); tap.test("interpreting show actor: ", dvdInterpreterClient.interpret("show actor"), "Query Result: Ethan Hawke, Denzel Washington"); tap.test("interpreting show actor for title : ", dvdInterpreterClient.interpret("show actor for title "), "Query Result: "); tap.test("interpreting show actor for title <Training Day>: ", dvdInterpreterClient.interpret("show actor for title <Training Day>"), "Query Result: Ethan Hawke, Denzel Washington"); tap.test("interpreting show title: ", dvdInterpreterClient.interpret("show title"), "Query Result: Caddy Shack, Training Day, Hamlet" ); tap.test("interpreting show title for actor : ", dvdInterpreterClient.interpret("show title for actor "), "Query Result: " ); tap.test("interpreting show title for actor <Ethan Hawke>: ", dvdInterpreterClient.interpret("show title for actor <Ethan Hawke>"), "Query Result: Hamlet, Training Day, Caddy Shack" ); tap.done(); }
public static void Main() { SoupBuffet bostonSoupBuffet = createSoupBuffet(new BostonSoupBuffetBuilder()); Tapper tap = new Tapper(); tap.test("Boston builder test ", ("At the " + bostonSoupBuffet.getSoupBuffetName() + bostonSoupBuffet.getTodaysSoups()), ("At the Boston Soup Buffet Today's Soups! , Chicken Soup: , ChickenSoup, Clam Chowder: , QuahogChowder, Fish Chowder: , ScrodFishChowder, Minnestrone: , Minestrone, Pasta Fazul: , Pasta Fazul, Tofu Soup: , Tofu Soup, Vegetable Soup: , Vegetable Soup")); SoupBuffet honoluluSoupBuffet = createSoupBuffet(new HonoluluSoupBuffetBuilder()); tap.test("Honolulu builder test ", ("At the " + honoluluSoupBuffet.getSoupBuffetName() + honoluluSoupBuffet.getTodaysSoups()), ("At the Honolulu Soup Buffet Today's Soups! , Chicken Soup: , ChickenSoup, Clam Chowder: , PacificClamChowder, Fish Chowder: , OpakapakaFishChowder, Minnestrone: , Minestrone, Pasta Fazul: , Pasta Fazul, Tofu Soup: , Tofu Soup, Vegetable Soup: , Vegetable Soup")); tap.done(); }
public static void Main() { Tapper tap = new Tapper(); SingleSpoon spoonForFirstPerson = SingleSpoon.getTheSpoon(); tap.test("Create first spoon ", spoonForFirstPerson, spoonForFirstPerson); SingleSpoon spoonForSecondPerson = SingleSpoon.getTheSpoon(); tap.test("Second person getting a spoon, shouldn't be able to", spoonForSecondPerson == null); SingleSpoon.returnTheSpoon(); tap.test("The spoon was returned", spoonForFirstPerson != null); spoonForSecondPerson = SingleSpoon.getTheSpoon(); tap.test("Second person getting a spoon", spoonForSecondPerson != null); tap.done(); }
public static void Main() { Tapper tap = new Tapper(); TeaCup teaCup = new TeaCup(); TeaBag teaBag = new TeaBag(); teaCup.steepTeaBag(teaBag); tap.test("Steeping tea bag ", teaBag.teaBagIsSteeped, true); LooseLeafTea looseLeafTea = new LooseLeafTea(); TeaBall teaBall = new TeaBall(looseLeafTea); teaCup.steepTeaBag(teaBall); tap.test("Steeping loose leaf tea", teaBag.teaBagIsSteeped, true); tap.done(); }
static async Task Main(string[] args) { using (var tapper = new Tapper()) { Console.WriteLine("Press Enter repeatedly to run. Any input or ctrl+C to quit"); while (true) { await Solve(tapper); var line = Console.ReadLine(); if (line != "") { break; } } } }
public static void Main() { TitleInfo bladeRunner = new DvdTitleInfo("Blade Runner", "Harrison Ford", '1'); TitleInfo electricSheep = new BookTitleInfo("Do Androids Dream of Electric Sheep?", "Phillip K. Dick"); TitleInfo sheepRaider = new GameTitleInfo("Sheep Raider"); Tapper tap = new Tapper(); tap.test("Testing bladeRunner ", bladeRunner.ProcessTitleInfo().ToString(), "DVD: Blade Runner, starring Harrison Ford "); tap.test("Testing electricSheep ", electricSheep.ProcessTitleInfo().ToString(), "Book: Do Androids Dream of Electric Sheep?, Author: Phillip K. Dick "); tap.test("Testing sheepRaider ", sheepRaider.ProcessTitleInfo().ToString(), "Game: Sheep Raider "); tap.done(); }
public static void Main() { Tapper tap = new Tapper(); TeaBags tinOfTeaBags = new TinOfTeaBags("tin of tea bags"); TeaBags teaBag1 = new OneTeaBag("tea bag 1"); tap.test("Teabag1 count ", teaBag1.countTeaBags(), 1); TeaBags teaBag2 = new OneTeaBag("tea bag 2"); tap.test("Teabag2 count ", teaBag2.countTeaBags(), 1); tap.test("TinOfTeaBags add teabag1 ", tinOfTeaBags.add(teaBag1), true); tap.test("TinOfTeaBags add teabag2 ", tinOfTeaBags.add(teaBag2), true); tap.test("TinOfTeaBags count after teabag1 and teabag2 adds", ("The tinOfTeaBags now has " + tinOfTeaBags.countTeaBags() + " tea bags in it."), ("The tinOfTeaBags now has 2 tea bags in it.")); TeaBags smallTinOfTeaBags = new TinOfTeaBags("small tin of tea bags"); tap.test("Small tin count ", smallTinOfTeaBags.countTeaBags(), 0); TeaBags teaBag3 = new OneTeaBag("tea bag 3"); tap.test("Putting teaBag3 in smallTinOfTeaBags", smallTinOfTeaBags.add(teaBag3), true); tap.test("small tin count after 1 add ", smallTinOfTeaBags.countTeaBags(), 1); tap.test("Putting smallTinOfTeaBags in tinOfTeaBags", tinOfTeaBags.add(smallTinOfTeaBags), true); tap.test("TinOfTeaBags count before removal ", ("The tinOfTeaBags now has " + tinOfTeaBags.countTeaBags() + " tea bags in it."), ("The tinOfTeaBags now has 3 tea bags in it.")); tap.test("Removing teaBag2 from tinOfTeaBags", tinOfTeaBags.remove(teaBag2), true); tap.test("TinOfTeaBags count after removal.", ("The tinOfTeaBags now has " + tinOfTeaBags.countTeaBags() + " tea bags in it."), ("The tinOfTeaBags now has 2 tea bags in it.")); tap.done(); }
public static void Main() { DvdMediator dvdMediator = new DvdMediator(); DvdLowercaseTitle dvdLower = new DvdLowercaseTitle("Mulholland Dr.", dvdMediator); DvdUpcaseTitle dvdUp = new DvdUpcaseTitle(dvdLower, dvdMediator); Tapper tap = new Tapper(); tap.test("Lowercase LC title :", dvdLower.getLowercaseTitle().ToString(), "mulholland dr.".ToString()); tap.test("Lowercase super title :", dvdLower.getTitle().ToString(), "Mulholland Dr.".ToString()); tap.test("Upcase UC title :", dvdUp.getUpcaseTitle().ToString(), "MULHOLLAND DR.".ToString()); tap.test("Upcase super title :", dvdUp.getTitle().ToString(), "Mulholland Dr.".ToString()); dvdLower.setSuperTitleLowercase(); tap.test("Lowercase LC title :", dvdLower.getLowercaseTitle(), "mulholland dr."); tap.test("Lowercase super title :", dvdLower.getTitle(), "mulholland dr."); tap.test("Upcase UC title :", dvdUp.getUpcaseTitle(), "MULHOLLAND DR."); tap.test("Upcase super title :", dvdUp.getTitle(), "mulholland dr."); tap.done(); }
public static void Main() { AbstractTitleInfo bladeRunner = new DvdInfo("Blade Runner", "Harrison Ford", '1'); AbstractTitleInfo electricSheep = new BookInfo("Do Androids Dream of Electric Sheep?", "Phillip K. Dick"); AbstractTitleInfo sheepRaider = new GameInfo("Sheep Raider"); TitleBlurbVisitor titleLongBlurbVisitor = new TitleLongBlurbVisitor(); Tapper tap = new Tapper(); bladeRunner.accept(titleLongBlurbVisitor); tap.test("Testing bladeRunner long ", titleLongBlurbVisitor.getTitleBlurb(), ("LB-DVD: Blade Runner, starring Harrison Ford, encoding region: 1")); electricSheep.accept(titleLongBlurbVisitor); tap.test("Testing electricSheep long ", titleLongBlurbVisitor.getTitleBlurb(), "LB-Book: Do Androids Dream of Electric Sheep?, Author: Phillip K. Dick"); sheepRaider.accept(titleLongBlurbVisitor); tap.test("Testing sheepRaider long ", titleLongBlurbVisitor.getTitleBlurb(), "LB-Game: Sheep Raider"); TitleBlurbVisitor titleShortBlurbVisitor = new TitleShortBlurbVisitor(); bladeRunner.accept(titleShortBlurbVisitor); tap.test("Testing bladerunner short ", titleShortBlurbVisitor.getTitleBlurb(), "SB-DVD: Blade Runner"); electricSheep.accept(titleShortBlurbVisitor); tap.test("Testing electricSheep short ", titleShortBlurbVisitor.getTitleBlurb(), "SB-Book: Do Androids Dream of Electric Sheep?"); sheepRaider.accept(titleShortBlurbVisitor); tap.test("Testing sheepRaider short ", titleShortBlurbVisitor.getTitleBlurb(), "SB-Game: Sheep Raider"); }
public static void Main() { DvdReleaseByCategory btvs = new DvdReleaseByCategory("Buffy the Vampire Slayer"); DvdReleaseByCategory simpsons = new DvdReleaseByCategory("The Simpsons"); DvdReleaseByCategory sopranos = new DvdReleaseByCategory("The Sopranos"); DvdReleaseByCategory xfiles = new DvdReleaseByCategory("The X-Files"); DvdSubscriber jsopra = new DvdSubscriber("Junior Soprano"); DvdSubscriber msimps = new DvdSubscriber("Maggie Simpson"); DvdSubscriber rgiles = new DvdSubscriber("Rupert Giles"); DvdSubscriber smulde = new DvdSubscriber("Samantha Mulder"); DvdSubscriber wrosen = new DvdSubscriber("Willow Rosenberg"); btvs.addSubscriber(rgiles); btvs.addSubscriber(wrosen); simpsons.addSubscriber(msimps); sopranos.addSubscriber(jsopra); xfiles.addSubscriber(smulde); xfiles.addSubscriber(wrosen); DvdRelease btvsS2 = new DvdRelease("DVDFOXBTVSS20", "Buffy The Vampire Slayer Season 2", 2002, 06, 11); DvdRelease simpS2 = new DvdRelease("DVDFOXSIMPSO2", "The Simpsons Season 2", 2002, 07, 9); DvdRelease soprS2 = new DvdRelease("DVDHBOSOPRAS2", "The Sopranos Season 2", 2001, 11, 6); DvdRelease xfilS5 = new DvdRelease("DVDFOXXFILES5", "The X-Files Season 5", 2002, 04, 1); Tapper tap = new Tapper(); tap.test("New dvd release test 1", btvs.newDvdRelease(btvsS2), "Hello Rupert Giles, subscriber to the Buffy the Vampire Slayer DVD release list.\nThe new Dvd Buffy The Vampire Slayer Season 2 will be released on 6/11/2002.\nHello Willow Rosenberg, subscriber to the Buffy the Vampire Slayer DVD release list.\nThe new Dvd Buffy The Vampire Slayer Season 2 will be released on 6/11/2002."); tap.test("New dvd release test 2", simpsons.newDvdRelease(simpS2), "Hello Maggie Simpson, subscriber to the The Simpsons DVD release list.\nThe new Dvd The Simpsons Season 2 will be released on 7/9/2002."); tap.test("New dvd release test 3", sopranos.newDvdRelease(soprS2), ("Hello Junior Soprano, subscriber to the The Sopranos DVD release list.\nThe new Dvd The Sopranos Season 2 will be released on 11/6/2001.")); tap.test("New dvd release test 4", xfiles.newDvdRelease(xfilS5), ("Hello Samantha Mulder, subscriber to the The X-Files DVD release list.\nThe new Dvd The X-Files Season 5 will be released on 4/1/2002.\nHello Willow Rosenberg, subscriber to the The X-Files DVD release list.\nThe new Dvd The X-Files Season 5 will be released on 4/1/2002.")); tap.test("Remove subscriber test", xfiles.removeSubscriber(wrosen), true); xfilS5.updateDvdReleaseDate(2002, 5, 14); tap.test("Update dvd test", xfiles.updateDvd(xfilS5), ("Hello Samantha Mulder, subscriber to the The X-Files DVD release list.\nThe following DVDs release has been revised: The X-Files Season 5 will be released on 5/14/2002.")); tap.done(); }
public static void Main() { Tapper tap = new Tapper(); PrototypeFactory prototypeFactory = new PrototypeFactory(new SoupSpoon(), new SaladFork()); Spoon spoon = prototypeFactory.makeSpoon(); Fork forky = prototypeFactory.makeFork(); tap.test("Getting the Spoon and Fork name:", ("Spoon: " + spoon.getSpoonName() + ", Fork: " + forky.getForkName()), ("Spoon: Soup Spoon, Fork: Salad Fork") ); prototypeFactory = new PrototypeFactory(new SaladSpoon(), new SaladFork()); spoon = prototypeFactory.makeSpoon(); forky = prototypeFactory.makeFork(); tap.test("Creating a Prototype Factory with a SaladSpoon and a SaladFork", ("Spoon: " + spoon.getSpoonName() + ", Fork: " + forky.getForkName()), ("Spoon: Salad Spoon, Fork: Salad Fork") ); tap.done(); }
static async Task Solve(Tapper tapper) { var sw = Stopwatch.StartNew(); var screen = Adb.Screenshot(); Console.Error.WriteLine($"Screenshot took {sw.ElapsedMilliseconds}ms"); sw.Restart(); using (var image = new Bitmap(screen)) { var parser = new AndroidParser(image); var puzzle = await parser.Parse(); Console.Error.WriteLine($"Parsing took {sw.ElapsedMilliseconds}ms"); sw.Restart(); var solvedRows = new Logic(puzzle).Solve(); Console.Error.WriteLine($"Solving took {sw.ElapsedMilliseconds}ms"); // System.IO.File.WriteAllLines( // @"C:\code\test\DragNonogram\" + Guid.NewGuid().ToString().Replace("-", "") + ".txt", // new[] { puzzle.Dim.ToString() } // .Concat(puzzle.Vertical.Select(col => string.Join(" ", col))) // .Concat(puzzle.Horizontal.Select(row => string.Join(" ", row))) // .Concat(solvedRows.Select(row => string.Concat(row).Replace(" ", "."))) // ); sw.Restart(); var toFill = solvedRows.SelectMany((row, y) => row .Select((c, x) => (c, x)) .Where(o => o.c.IsBlack) .Select(o => parser.getCell(o.x, y))); tapper.Tap(toFill.Select(p => (p.X, p.Y))); Console.Error.WriteLine($"Tapping took {sw.ElapsedMilliseconds}ms"); } }
public static void Main() { DvdName jayAndBob = new DvdName("Jay and Silent Bob Strike Back"); DvdName spongeBob = new DvdName("Sponge Bob Squarepants - Nautical Nonsense and Sponge Buddies"); Tapper t = new Tapper(); CommandAbstract bobStarsOn = new DvdCommandNameStarsOn(jayAndBob); //CommandAbstract bobStarsOff = new DvdCommandNameStarsOff(jayAndBob); CommandAbstract spongeStarsOn = new DvdCommandNameStarsOn(spongeBob); CommandAbstract spongeStarsOff = new DvdCommandNameStarsOff(spongeBob); bobStarsOn.execute(); spongeStarsOn.execute(); t.test("stars on", jayAndBob.ToString(), "DVD: Jay*and*Silent*Bob*Strike*Back"); t.test("stars on 2 ", spongeBob.ToString(), "DVD: Sponge*Bob*Squarepants*-*Nautical*Nonsense*and*Sponge*Buddies"); spongeStarsOff.execute(); t.test("sponge stars off", jayAndBob.ToString(), "DVD: Jay*and*Silent*Bob*Strike*Back"); t.test("sponge stars off 2", spongeBob.ToString(), "DVD: Sponge Bob Squarepants - Nautical Nonsense and Sponge Buddies"); t.done(); }
// Update is called once per frame void Update() { RaycastHit2D hit2 = Physics2D.Raycast(transform.position, -Vector2.up); double disY = transform.position.y - hit2.transform.position.y; if (Input.GetKeyDown(KeyCode.Mouse0)) { Ray R = MainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(R, out hit, 100)) { if (hit.collider.name == "PlayerMover") { if (PlayerPrefs.GetInt("energy") > 0) { infoText.text = ""; infoTextShadow.text = infoText.text; // Decrease Player energy switch (PlayerPrefs.GetInt("level")) { case 1: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.14f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.34f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.29f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.14f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 105); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 85); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 95); PlayerPrefs.Save(); break; } break; case 2: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.16f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.36f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.31f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.16f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 100); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 80); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 90); PlayerPrefs.Save(); break; } break; case 3: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.18f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.38f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.33f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.18f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 45); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 95); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 75); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 85); PlayerPrefs.Save(); break; } break; case 4: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.20f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.4f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.35f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.2f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 40); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 45); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 90); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 70); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 80); PlayerPrefs.Save(); break; } break; case 5: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.22f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.42f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.37f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.22f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 35); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 75); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 85); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 65); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 75); PlayerPrefs.Save(); break; } break; case 6: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.24f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.44f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.39f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.24f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 30); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 70); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 80); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 70); PlayerPrefs.Save(); break; } break; case 7: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.24f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.46f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.41f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.26f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 25); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 65); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 75); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 65); PlayerPrefs.Save(); break; } break; case 8: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.28f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.48f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.43f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.28f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 20); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 70); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; } break; case 9: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.30f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.50f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.45f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.30f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 15); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 65); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 45); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; } break; case 10: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.32f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.52f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.47f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.32f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 10); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 40); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; } break; } Tapper.SetActive(false); switch (Application.loadedLevelName) { case "PullUps": if (disY > 1.5 && disY < 3.2) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 100)); } break; case "ClappingPullUps": if (disY > 1.5 && disY < 3.2) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 100)); } break; case "MuscleUps": if (disY > 2.5 && disY < 4.2) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 100)); } break; case "StraightBarDibs": if (disY > 3.3) { rigidbody2D.AddForce(new Vector2(0, -playerUpwardsForce * 100)); } break; case "PullOvers": if (disY > 1.5 && disY < 4.2) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 100)); } break; } //to give punch scale effect //iTween.PunchScale(gameObject, iTween.Hash("amount", new Vector3(0.06f, 0.06f, 0), "time", 1.7f, "easetype", iTween.EaseType.linear)); SoundController.Static.PlayBallUp(); //to play ball tap sound. } else { infoText.text = "Your energy too low\n Eat or Pass 1 day"; infoTextShadow.text = infoText.text; } } else if (hit.collider.name == "main_menu_button") { Application.LoadLevel("MainMenu"); } else if (hit.collider.name == "pass_day_button") { PlayerPrefs.SetInt("day", PlayerPrefs.GetInt("day") + 1); PlayerPrefs.SetInt("energy", 3000); PlayerPrefs.Save(); } else if (hit.collider.name == "eat_button") { if (PlayerPrefs.GetInt("dayLimit") == PlayerPrefs.GetInt("day")) { infoText.text = "Your already ate today"; infoTextShadow.text = infoText.text; } else { PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") + 300); PlayerPrefs.SetInt("dayLimit", PlayerPrefs.GetInt("day")); PlayerPrefs.Save(); } } else if (hit.collider.name == "change_level_button") { Tapper.SetActive(false); Information.SetActive(false); ChangeLevel.transform.localScale = Vector3.zero; ChangeLevel.SetActive(true); iTween.ScaleTo(ChangeLevel, iTween.Hash("scale", Vector3.one, "time", 1.5f, "easetype", iTween.EaseType.easeOutSine, "delay", 0.0f)); //scoreTextMesh.renderer.enabled = true; //ScoreShadowTextMesh.renderer.enabled = false; } else if (hit.collider.name == "tricks_list_button") { Tapper.SetActive(false); Information.SetActive(false); ScoreBoard.transform.localScale = Vector3.zero; ScoreBoard.SetActive(true); iTween.ScaleTo(ScoreBoard, iTween.Hash("scale", Vector3.one, "time", 1.5f, "easetype", iTween.EaseType.easeOutSine, "delay", 0.0f)); //scoreTextMesh.renderer.enabled = true; //ScoreShadowTextMesh.renderer.enabled = false; } } } if (PlayerPrefs.GetInt("energy") > 0) { switch (Application.loadedLevelName) { case "PullUps": if (hit2.collider != null) { if (disY > 3) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistVertical = (new Vector3(0, touch.position.y, 0) - new Vector3(0, startPos.y, 0)).magnitude; if (swipeDistVertical > 100) { float swipeValue = Mathf.Sign(touch.position.y - startPos.y); //up swipe if (swipeValue > 0) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 400)); } //down swipe } break; } } } } break; case "ClappingPullUps": if (hit2.collider != null) { if (disY > 1.5) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistHorizontal = (new Vector3(touch.position.x, 0, 0) - new Vector3(startPos.x, 0, 0)).magnitude; if (swipeDistHorizontal > 50) { float swipeValue = Mathf.Sign(touch.position.x - startPos.x); //right swipe if (swipeValue > 0) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 400)); } } break; } } } } break; case "MuscleUps": if (hit2.collider != null) { if (disY > 3) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistVertical = (new Vector3(0, touch.position.y, 0) - new Vector3(0, startPos.y, 0)).magnitude; if (swipeDistVertical > 100) { float swipeValue = Mathf.Sign(touch.position.y - startPos.y); //up swipe if (swipeValue > 0) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 400)); } //down swipe } break; } } } } break; case "StraightBarDibs": if (hit2.collider != null) { if (disY < 3.4) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistVertical = (new Vector3(0, touch.position.y, 0) - new Vector3(0, startPos.y, 0)).magnitude; if (swipeDistVertical > 50) { float swipeValue = Mathf.Sign(touch.position.y - startPos.y); //down swipe if (swipeValue < 0) { rigidbody2D.AddForce(new Vector2(0, -playerUpwardsForce * 400)); } } break; } } } } break; case "PullOvers": if (hit2.collider != null) { if (disY > 4.4) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistVertical = (new Vector3(0, touch.position.y, 0) - new Vector3(0, startPos.y, 0)).magnitude; if (swipeDistVertical > 100) { float swipeValue = Mathf.Sign(touch.position.y - startPos.y); //up swipe if (swipeValue > 0) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 400)); } } break; } } } } break; } } }
async private void ParserForm_Load(object sender, EventArgs e) { const int fps = 1000 / 60; var pngPath = Path.Combine(Application.StartupPath, "screen.png"); Bitmap image; var mockPhone = false; // var mockPhone = File.Exists(pngPath); if (mockPhone) { image = new Bitmap(pngPath); } else { var screen = Adb.Screenshot(); File.WriteAllBytes(pngPath, screen.GetBuffer()); image = new Bitmap(screen); } var tallest = Screen.AllScreens.OrderByDescending(s => s.WorkingArea.Height).First(); Location = tallest.WorkingArea.Location; pictureBox.Image = image; pictureBox.Height = tallest.WorkingArea.Height; pictureBox.Width = image.Width; Top = tallest.WorkingArea.Top; Size = pictureBox.Size; var todo = new Bitmap(image); using (var timer = new Timer { Interval = fps }) { timer.Tick += (_, __) => pictureBox.Refresh(); timer.Start(); var parser = new AndroidParser(new InvertingTrackingBitmap { KeepCount = 2000, IAsyncBitmap = new DelayedBitmap { DelayInterval = fps, DelayCount = 200, IAsyncBitmap = new WrappingBitmap { Bitmap = image, }, }, }, todo); var puzzle = await parser.Parse(); pictureBox.Refresh(); foreach (var clue in puzzle.Vertical) { Console.Error.WriteLine(string.Join(" ", clue)); } Console.Error.WriteLine(); foreach (var clue in puzzle.Horizontal) { Console.Error.WriteLine(string.Join(" ", clue)); } Console.Error.WriteLine(); var sw = Stopwatch.StartNew(); var solvedRows = new Logic(puzzle).Solve(); Console.Error.WriteLine(); Console.Error.WriteLine( string.Join('\n', solvedRows.Select(row => string.Join("", row)) )); Console.Error.WriteLine($"Solve time: {sw.ElapsedMilliseconds}ms"); sw.Restart(); var toFill = solvedRows.SelectMany((row, y) => row .Select((c, x) => (c, x)) .Where(o => o.c.IsBlack) .Select(o => parser.getCell(o.x, y))); if (mockPhone) { foreach (var p in toFill) { await parser.Pulse(p); } } else { var useMonkey = true; if (useMonkey) { using (var tapper = new Tapper()) { tapper.Tap(toFill.Select(p => (p.X, p.Y))); } } else { foreach (var p in toFill) { Adb.Tap(p.X, p.Y); } } } Console.Error.WriteLine($"Tapping time: {sw.ElapsedMilliseconds}ms"); } }