Cat and Mouse II

A thought has occurred to me, it may be interesting to constrict the “cat’s” available moves to only those towards the “mouse” -along the shortest line between the two; similarly the mouse towards the “goal.” Moreover, let’s reconstruct the game so that both the cat and mouse exist on a graph. In particular let’s say a Cayley graph Γ(G,S) and restrict their motion to the edges of the graph. If we maintain that the goal of the mouse is to reach the vertex mapped by max{x|x∈G∩S*} where S* ⊂ S, and the cat’s goal is to “catch” the mouse; how then does this change the dynamics of the game? What is now the optimal strategy for a mouse starting on any given vertex not max{x|x∈G∩S*}? What about the cat’s?

I will have to come back to this thought later.

Thoughts: …the more I reread this the more I see other interesting questions about this game. For example, there are several ways to turn this into a game of incomplete information. And what happens as we add or subtract vertices or add players? What if we change the rate of motions(e.g. cat 2 vertices to the mouse’s 1, or 3:1, 3:2… ect. -I sense a possible covering problem here)

Note to self: I suspect this may “reduce” nicely to a coloring problem. I should also go back and look at these older projects and expand on them… make them interesting.

Twitter Bot

Ok… So… Trump’s administration has made it known that they do not believe climate science. As a result, I have taken it upon myself to collect a MONSTER list of links to climate research to be used in a Twitter Bot.

Step 0: Create a .txt file that is nothing more than a list of links to climate change data!

Step 1: Set up one of my RaspberryPi’s to work headlessly.

Step 2: PYTHON!

Step 3: Setup Twitter Bot page.

Step 4: RELEASE THE BOT!

Step 5: …hmmm… so I’ve got the code to work. But… it seems after about 4 posts(2 hrs), the bot stops working…. This is annoying. Scratch head and return.
…Best guess, the server is timing out. Worst guess… Twitter bots work on pizza and beer and mine has neither.

*Will return to make this into a tutorial.*


16Feb17

I just discovered how to fix the “timing out” problem. I had a “derp.” need to use:

Crontab -e

It will let me run the code at set times. So if I rewrite the code to select a line at random… I should be in the clear. But it also means I need to figure out how to deal with the exceptions/errors it sends back when a tweet is repeated.


17Feb17

Bot appears to be working:

https://twitter.com/alt_climate


19Feb17

The Twitter Bot is most definitely working!

https://twitter.com/alt_climate

You can find the tutorial and examples that I am putting together here:

https://github.com/AltClimate/Twitter_Bot

R2D2 Project(On Going)

Though I am a math major, I often times find myself working on fun computer science, engineering, and robotic projects in my spare time. The most recent of which has been turning an 18″ R2D2 toy I bought from WalMart into a functioning robot.


To begin the project I tore the toy R2D2 apart to see what I had to work with. It became clear right away, that the manufacturer had at some point planned on making the toy robotic as there were many places to mount speakers, motors, and LEDS.  Continue reading R2D2 Project(On Going)

Pursue and Evade: A Look at “Cat and Mouse” thru Game Theory

The point of the attached powerpoint was to act as a class project demonstrating how it might be possible to populate a game matrix with the appropriate payoffs, assuming one can model/simulate the game on a computer.

CatAndMouse

It should be understood, that in order to model/simulate a game via a computer, the games rules must be well defined and understood.


The following is the code used:

 

import java.awt.*;
import java.util.Arrays;
import java.util.Random;
import javax.swing.*;

public class GameTheory2 extends JPanel
{
 public static void main(String[] args)
 {
 int[] catpost = Start();
 int[] mousepost = Start();
 String m = Arrays.toString(mousepost);
 String c = Arrays.toString(catpost);
 Random rn= new Random();
 int turn;
 int[] tempmouse;
 int[] tempcat;
 int count=1;

 while(mousepost!=catpost && mousepost[0]>=0 && mousepost[0]<=500 &&mousepost[1]>=0 && mousepost[1]<=500 && count<1000)
 {
 int direction[]=Choise(catpost, mousepost);
 tempmouse=mousepost;//To be used later
 tempcat=catpost;//To be used later
 catpost[0] = catpost[0]+30*direction[0];//new catpost
 catpost[1] = catpost[1]+30*direction[1];//new catpost
 mousepost[0] = mousepost[0]+10*direction[0];//new mousepost
 mousepost[1] = mousepost[1]+10*direction[1];//new mousepost
 
 m=m+" "+Arrays.toString(mousepost);
 c=c+" "+Arrays.toString(catpost);
 count++;
 }
 System.out.println(count+" Cat: "+c);
 System.out.println(count+" Mouse: "+m);
 
 
 /////////////////////***GUI***/////////////////////
 /*
 JFrame frame=new JFrame("Pursuit and Evation");
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 JPanel main_window = new JPanel();
 main_window.setPreferredSize(new Dimension(1000, 1000));
 frame.getContentPane().add(main_window);
 frame.pack();
 frame.setVisible(true);
 */
 
 }
 public static int[] Start()//Initializing location of the Character
 {
 int[] post= new int[2];//Array with x,y location
 Random rn= new Random();
 int x = rn.nextInt(501);//Random x-post
 int y = rn.nextInt(501);//Random y-post
 post[0]=x;//sets x location
 post[1]=y;//sets y location
 return post;//returns x,y location
 
 }
 public static int[] Choise(int[] catpost, int[] mousepost)//Defines cardinal direction of motion---Unit Vector
 {
 int direction[]={0,0};
 Random rn= new Random();
 int cardinal;
 if(catpost[0]<mousepost[0] && catpost[1]<mousepost[1])//If cat is above and left of mouse
 {
 cardinal = rn.nextInt(2);
 if(cardinal==0)//move X
 {
 direction[0]=1;
 }
 else//move Y
 {
 direction[1]=1;
 }
 
 }
 else if (catpost[0]>mousepost[0] && catpost[1]<mousepost[1])//If cat is above and right of mouse
 {
 cardinal = rn.nextInt(2);
 if(cardinal==0)
 {
 direction[0]=-1;
 }
 else
 {
 direction[1]=1;
 }
 
 }
 else if (catpost[0]==mousepost[0] && catpost[1]<mousepost[1])//If cat is directly above mouse
 {
 cardinal = rn.nextInt(3);
 if(cardinal==0)//Move X
 {
 direction[0]=1;
 
 }
 else if(cardinal==1)//Move X
 {
 direction[0]=-1;
 
 }
 else//Move Y
 {
 direction[1]=1;
 
 }
 
 }
 else if (catpost[0]<mousepost[0] && catpost[1]>mousepost[1])//If cat is below and left of mouse
 {
 cardinal = rn.nextInt(2);
 if(cardinal==0)
 {
 direction[0]=1;
 }
 else
 {
 direction[1]=-1;
 }
 
 }
 else if (catpost[0]>mousepost[0] && catpost[1]>mousepost[1])//If cat is below and right of mouse
 {
 cardinal = rn.nextInt(2);
 if(cardinal==0)
 {
 direction[0]=-1;
 }
 else
 {
 direction[1]=-1;
 }
 
 }
 else if (catpost[0]==mousepost[0] && catpost[1]>mousepost[1])//If cat is directly below of mouse
 {
 cardinal = rn.nextInt(3);
 if(cardinal==0)
 {
 direction[0]=1;
 
 }
 else if(cardinal==1)
 {
 direction[0]=-1;
 
 }
 else
 {
 direction[1]=-1;
 
 }
 
 }
 else if(catpost[0]<mousepost[0] && catpost[1]==mousepost[1])//If cat is directly to the left of mouse
 {
 cardinal = rn.nextInt(3);
 if(cardinal==0)
 {
 direction[0]=1;
 
 }
 else if(cardinal==1)
 {
 direction[1]=1;
 
 }
 else
 {
 direction[1]=-1;
 
 }
 
 }
 else if (catpost[0]>mousepost[0] && catpost[1]==mousepost[1])//If cat is directly to the right of mouse
 {
 cardinal = rn.nextInt(3);
 if(cardinal==0)
 {
 direction[0]=-1;
 
 }
 else if(cardinal==1)
 {
 direction[1]=1;
 
 }
 else
 {
 direction[1]=-1;
 
 }
 
 }
 return direction;
 }
}

 

Game Theory: A Modified Version of the Chinese Room

For my Intro to Game Theory class, we have been participating in a semester-long simulation of being a faculty member of some universities’ math department. Part of the simulation required us to present projects weekly, or biweekly, in “conferences.” We also had to write a paper pertaining to the subject matter covered in the course. Our professor gave us a list of suggested games and problems from our course book(and a few other sources) that we could cover, though did not limit us to just the problems on his list. As a result, I went looking for what I thought to be a unique application of Game Theory.

The idea I arrived was to modify the “Chinese Room” thought experiment so that it could be treated as a game. It occurred to me while considering other ideas for my Undergrad. Capstone Project.

As far as the paper is concerned, though, this particular topic is appealing to me due its blend of Mathematics, Philosophy, and Computer Science. It’s fun when I can blend different subjects or branches of Mathematics together… it spices things up.

  • A Brief Presentation of a Special Case of the Modified Chinese Room:
    Chinese Room