Saturday, May 16, 2020

Quick Notes on appJar (Button, Subwindow, TextEntry, Table, InfoBox)

 Notes On appJar

appJar

Create A Basic Window

Example

from appJar import gui
app = gui()
app.setSize(400,400)
app.setFont(16)
app.addLabel("Example")
app.go()

Button

from appJar import gui

app = gui()
app.setSize(400,400)
app.setFont(16)

def pressA():
    app.addLabel("Pressed A")

app.addButton("A", pressA)
app.go()

app.addButton([title], [action when button is pressed])
before
before
after
enter image description here

Subwindows

from appJar import gui

app = gui()
app.setSize(400,400)
app.setFont(16)

def pressA():
    app.startSubWindow("newWindow",title="This is a new winodw")
    app.go(startWindow="newWindow")

app.addButton("A", pressA)
app.go()

after pressing the button A
enter image description here

Table & Pop out info box

from appJar import gui

app = gui()
app.setSize(400,400)
app.setFont(16)

def press(rowNumber):
    app.infoBox("infoBox", "My number is %d"%(rowNumber))


app.addTable("tableName",
    [["Table Title"],
    ["0"],
    ["1"],
    ["2"],
    ["3"]], action=press, actionButton="ButtonName", actionHeading="press me")#when action is set to a specific function, it will pass the row number to such function

app.go()

Row number starting from 0
enter image description here

Text Extry

from appJar import gui

app = gui()
app.setSize(400,400)
app.setFont(16)

def press():
    app.infoBox("infoBoxTitle","The fist one said: %s; the second on said: %s" % (app.getEntry("JustAnEntry"), app.getEntry("NamedEntry")))

app.addEntry("JustAnEntry")
app.addLabelEntry("NamedEntry")

app.addButton("Get Content From Entries", press)

app.go()

enter image description here

Friday, May 15, 2020

Testing Testing Testing

This is a test

for my new application

I just need a html file

see what will happen

okay

 

Tuesday, May 12, 2020

Notes on Game Theory

Notes on Game Theory

Course Link: here

Self-interested agents

Every agent has their own knowledge about the world and they can only make decisions base on their own knowledge (without knowing others’ choices). Every agent has its utility function, which is a mathematical function for qualifying agent’s preference of choices and the impact of uncertainty
Decision-theoretic rationality
Acts to maximize expected (average) utility

Definitions

Players: People (or organizations, thing) who making decisions, represent as NN
Actions: What the players can do, represent as AiA_i
Payoffs: What is motivating the players, represented as uiu_i

Two Standard Representations of Games

Normal Form (Matrix Form, Strategic Form)

Showing payoffs as a function of actions
Assume players move simultaneously

Player 1 \ Player 2 C D
C Benefit, Benefit Drawback, Benefit
D Benefit, Drawback Drawback, Drawback

A Large Collective Action Game
Too large so cannot write down as a simple matrix

Extensive Form

Prisoner’s Dilemma

These people are captured by police, then they’re not allowed to communicate with each other. Police say to each of them that if he cooperates with police and betrays your friend, he can be released. However, if he refuses to cooperate with the police and his friend does, his friend can be freed and he cannot. If everyone betrays their friend, everyone will not be released. If everyone refuses to betray their friend, everyone will be released.

The most rational choice is assuming your friend would betray you, yet it would lead to the worst outcome.

Games of Pure Competition

u1(a)+u2(b)=Cu_1(a)+u_2(b)=C, where C is some constants. Special case: C = 0, zero sum game.
Two players have exactly opposed interests.