Posts

Showing posts from March, 2022

Week 7

Image
 Used a YouTube walk through to learn about making a game through a tic-tac-toe example The picture above is me creating objects for my game board and for the pieces, followed by the constructor that creates the game board and calls the first turn method(which decides who does first).  This method sets the buttons on the grid and calls the check method( which checks if you win or not)        The first turn method decides which piece goes first and then displays it for 2000ms (2secs) This above is the win conditions. The picture above is the part of the code because there are quite a few win conditions. It takes the position of the buttons(pieces) and see if it matches a winning position. This is the result of winning. if they have a winning combination , it takes the position and highlights the combination in green for both X's and O's and prints at the top ( _ wins) my main that calls the game Pictures of the game( x winning, o winning, and when it first s...

Week 6

Image
 Going a bit of course and starting my journey into learning algorithms. I will continue trying to get my parser to work, I have yet to ask my professor about some of the bugs in my code, so it will need to be done after spring break when I see him next. Doing a bit of research on algorithms, it is said that DFS(depth first search) and BFS(breadth first search) are very important algorithms to know, so I looked up some example codes and YouTube videos with explanations to get a basic understanding of both of these algorithms. Depth first search is search algorithm that goes to the furthest child nodes of each vertices and adds each passing node to a stack, knocking off each vertices that no more nodes to explore, which starts when the search has gotten to the furthest node and pops each searched node of the stack seeing if any of the previous nodes have nodes that haven't yet been explored. Similarly, for Breadth first search we search each vertices but instead of going to the furt...

Week 5

Image
Here is my finished Parser. I can't run it quite yet because I need to finish my bison code so that it will run. What I'm doing in this parser is taking my BNR Grammar and converting in to readable code for bison so it can follow my grammar and find things like loops, assignment statements, etc. You can see at the top I take my tokens for the operators and words that my program will you. We then have start of the grammar, "statement list" the broadest term in the grammar, which leads to questions, what is a statement list? following statement list we have its definition as " " or statement followed by a statement list(recursion so you can have as many statements as you'd like without coming with an error). Next, we need to define a statement, we define a statement as either an assignment statement, conditional statement(if then), loop statement(while),block statement, expression, and function call. Now we have multiple things to define, which will bring ...