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
| List<Checkers> continuedCapture(Point source, List<List<Point>> moves) { | |
| Checkers refBoard = this; | |
| List<Checkers> boards = []; | |
| for (List<Point> capDiagonal in moves) { | |
| Checkers childBoardCap = refBoard.cloneGame(); | |
| List<List<Point>> newCaps = | |
| childBoardCap.executeCapture(source, capDiagonal); | |
| newCaps = childBoardCap.kingAfterMove(capDiagonal[1]) | |
| ? childBoardCap.captureSequences(capDiagonal[1]) | |
| : newCaps; |
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
| One of Flutter's most efficient tricks is ability to use a build context to look up widget tree for something of interest. The most common of these are MediaQuery of context and theme of context. But popular state management solutions, like Flutter Block and Provider, is the same mechanism. And the pattern really is accustomed to. Because without it, every live widget that cares about the MediaQuery would have to accept it as a parameter from their parent, meaning every one of their ancestors would have to accept it as a parameter. This would couple every widget in your app to the position in a widget tree. Imagine that refactoring pane. But the pattern is even more useful than merely preventing a thick jungle of parameters. Simply having a widget run the line of code, MediaQuery of context ties the widget to the MediaQuery, meaning it will get rebuilt whenever the MediaQuery changes. And this is important. Because if you are laying out a widget based on the screen size, that layout is unlikely to remain valu |
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
| //Minimax related functions start from here: | |
| //1- This function clones the current board and returns a copy of it | |
| Checkers cloneGame() { | |
| Checkers cloneBoard = Checkers(); | |
| cloneBoard.board = | |
| this.board.map((innerList) => List<Token>.from(innerList)).toList(); | |
| return cloneBoard; | |
| } |
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 'package:hive_flutter/adapters.dart'; | |
| import 'package:turing_machines/models/Behaviour.dart'; | |
| import 'package:turing_machines/models/Configuration.dart'; | |
| import 'package:turing_machines/models/Tape.dart'; | |
| import 'package:turing_machines/models/TuringMachines.dart'; | |
| part "TuringMachineModel.g.dart"; | |
| @HiveType(typeId: 0) | |
| class TuringMachineModel { | |
| @HiveField(0) |
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 compiler_design; | |
| import java.util.*; | |
| public class FirstAndFollow { | |
| public static void main(String[] args) | |
| { | |
| System.out.println("Input number of production rules"); | |
| Scanner reader=new Scanner(System.in); | |
| int count=Integer.parseInt(reader.nextLine()); | |
| LinkedHashMap<String,String[]> table=new LinkedHashMap<>(); | |
| for(int i=0;i<count;++i) { |
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 java.util.*; | |
| public class CodeGenerationForIf { | |
| public static void main(String[] args) { | |
| // Example input: if (x > 5) { y = x * 2; } | |
| String condition = "x>8"; | |
| String action = "y = y / 10;"; | |
| // Generate code for the if statement | |
| String generatedCode = generateIfCode(condition, action); | |
| System.out.println("Generated code for if:"); |
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
| // ignore: file_names | |
| import 'package:flutter/material.dart'; | |
| import 'package:turing_machines/exceptions/ActionParserException.dart'; | |
| //Represents an Action which can be performed on the tape of a turing machine. | |
| class Actions { | |
| String symbol; | |
| ActionType type; | |
| Actions({required this.type, this.symbol = ""}); | |
| //Parses a String containing actions, seperated by a ,(comma) |
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 java.util.*; | |
| public class PostFix { | |
| public static void main(String[] args) { | |
| System.out.println("Input Postix Expression"); |
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
| oh-my-posh --init --shell pwsh --config ~/AppData/Local/Programs/oh-my-posh/themes/jandedobbeleer.omp.json | Invoke-Expression | |
| function personal { | |
| Set-Location -Path C:\PROJECTS\personal | |
| } | |
| function openPersonal { | |
| $directoryPath = 'C:\PROJECTS\personal' | |
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
| public static int[] minMax(TicTacToeMin obj) | |
| { | |
| ArrayList<Integer> scores=new ArrayList<>(0); | |
| ArrayList<TicTacToeMin> arrs=obj.simulate(); | |
| ArrayList<Integer> moves=obj.emptySpaces(); | |
| //return a list of cloned boards with current token fitted into all empty spaces. | |
| if(arrs.size()==0) | |
| { | |
| return new int[] {0,-1}; |
NewerOlder