Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Class 24: Objects and Classes and Go

Class 24: Objects and Classes and Go

cs1120: Introduction to Computing
Explorations in Language, Logic, and Machine
University of Virginia, Spring 2016

http://xplorecs.org/class24

Class 24:
Objects
Introducing Classes
Game-Playing Machines
Go

David Evans

March 29, 2016
Tweet

More Decks by David Evans

Other Decks in Programming

Transcript

  1. Class 24: Playing Games Introduction to Computing: Explorations in Language,

    Logic, and Machines cs1120 Spring 2016 David Evans University of Virginia
  2. Introducing Objects An object packages: – state (“instance variables”) –

    functions for manipulating that state (“methods”) Have you been using objects already?
  3. Making Objects In Washington, it’s dog eat dog. In academia,

    it's exactly the opposite. Robert Reich
  4. Objects and Classes An object packages: – state (“instance variables”)

    – functions for manipulating that state (“methods”) A class provides a way to make your own types of objects. Why is this a big deal?
  5. Problem-Solving Strategies Project 1-4: Functional and Imperative Programming • Focused

    on functions • Break a problem into functions that can be composed to solve problem Project 5: “Object-Oriented Programming” • Focused on objects that package state and functions • Solve problem by designing classes that model the problem • Lots of problems can be thought of this way
  6. Go Rule #1: Liberty Rule of Liberty: if a stone

    is surrounded, it is removed Rule of Ko: cannot make a move that returns state to previous configuration Chinese rules: any previous configuration Japanese rules: immediatelyprevious
  7. Go Rule #2: Repetition Rule of Ko: cannot make a

    move that returns state to previous configuration Chinese rules: any previous configuration Japanese rules: immediatelyprevious
  8. Playing a Game while True: player 1 passes or places

    a Black stone player 2 passes or places a White stone if both passed: break winner is player with the most stones 0 1 2 3 0 1 2 3
  9. Charge Pre-Blue Belts: • Qualify for Blue Belt exam •

    Retake (new) Blue Belt exam Blue Belts: Start Project 5