Expressions (ex 8) Wild World (ex 7) Cars (ex 9)

Similar documents
eriktology Torah Workbook Bereshiyt / Genesis [1]

A lot of the time when people think about Shabbat they focus very heavily on the things they CAN T do.

eriktology The Writings Book of Ecclesiastes [1]

Chapter 11 (Hebrew Numbers) Goals

Interrogatives. Interrogative pronouns and adverbs are words that are used to introduce questions. They are not inflected for gender or number.

ALEPH-TAU Hebrew School Lesson 204 (Nouns & Verbs-Masculine)

Humanity s Downfall and Curses

A Hebrew Manuscript of the Book of Revelation British Library, MS Sloane 273. Transcribed and Translated by Nehemia Gordon

Hebrew Adjectives. Hebrew Adjectives fall into 3 categories: Attributive Predicative Substantive

Jacob and the Blessings

Abraham s Ultimate Test

Israel s Sons and Joseph in Egypt

Hebrew Pronominal Suffixes

Advisor Copy. Welcome the NCSYers to your session. Feel free to try a quick icebreaker to learn their names.

Noah s Favor Before God

Esther in Art and Text: A Role Reversal Dr. Erica Brown. Chapter Six:

Which Way Did They Go?

SEEDS OF GREATNESS MINING THROUGH THE STORY OF MOSHE S CHILDHOOD

Noach 5722 בראשית פרק ב

Free Download from the book "Mipeninei Noam Elimelech" translated and compiled by Tal Moshe Zwecker by permission from Targum Press, Inc.

David's lament over Saul and Jonathan G's full text analysis and performance decisions

Jacob s Return to Canaan

Introduction to Hebrew. Session 7: Verb Tense Complete

HEBREW THROUGH MOVEMENT

Lessons in. Likutay Torah ל ק ו טי א מר ים, מ א מר ים י קר ים, מ עו ר ר ים ה ל בבו ת ל ע בו ד ת ה ' מ פ י ר ב י ש ניאו ר ז ל מן

Hebrew Step-By-Step. By Rae Antonoff, MAJE Distributed by JLearnHub. Page 1

Elijah Opened. Commentary by: Zion Nefesh

Translation Practice (Review) Adjectives Pronouns Pronominal suffixes Construct chains Bible memory passages

These are the slides for the verb lectures that correspond to chapter 37 of Introducing Biblical Hebrew by Allen P. Ross.

From Slavery to Freedom

Untapped Potential Parshat Noach 5776 Rabbi Dovid Zirkind

1. What is Jewish Learning?

T O O T I R E D T O T R Y?

Uses of Pronominal Suffixes (Chapter 9)

HEBREW THROUGH MOVEMENT

PEKUDEI. Welcome to the Aleph Beta Study Guide to Parshat Pekudei!

LIKUTEY MOHARAN #206 1

The conjunctive vav (ו ) is prefixed to a Hebrew word, phrase, or clause for the following reasons:

נ ש יא ח ק ת. [F] צ פ ון strength, wealth, army ח י ל חי ים ר כ ב ב עד רב ש מר כ ס ף

Jehovah Yahweh I Am LORD. Exodus 3:13-15

God s Calling of Abram

SHABBAT AND HAVDALAH SEMINAR May 27, 2015, 1:00-6:00 Hebrew College The Early Childhood Institute

Parshat Va era begins the story of the ten plagues in Egypt. It s the

The Hebrew Café thehebrewcafe.com/forum

Perek II Daf 19 Amud a

Root Source Presents. Blood Moons God s Gift to Jews

Global Day of Jewish Learning

Converted verbal forms are used primarily to denote sequences of consecutive actions, either in the past, present or future.

כ"ג אלול תשע"ו - 26 ספטמבר, 2016 Skills Worksheet #2

Parshat Yitro tells of the climactic moment when Israel stood at the foot of Mount Sinai and received the Torah from

A Presentation of Partners in Torah & The Kohelet Foundation

The Book of Obadiah. The Justice & Mercy of God

שלום SHALOM. Do you have peace with G-d? יש לך שלום עם אלוהים? First Fact. Second Fact

Esther אסתר. 1 Esther 1 ש ב ע ת) ה ס. ר יס" ים ה מ ש. ר " ת ים א ת פ נ י ה מ ל ך א ח ש ו ר- וש U ל ה. ב יא א ת ו ש ת G י

Hebrew Construct Chain

Rule: A noun is definite or specific by 3 means: If it is a proper noun, that is, a name.


SHABBAT UNPLUGGING & RECONNECTING

Congregation B nai Torah Olympia - D var Torah Parashat Shemini

THINKING ABOUT REST THE ORIGIN OF SHABBOS

THE FIRE YOU NEVER SAW

ANI HA MEHAPECH BE CHARARAH. Talmudic Intrigue in: Real Estate, Party Brownies, Dating and Dream Jobs

סדר סעודה וברכותיה ה א ר ץ. the various kinds of nourishment. Blessed are You, the Lord our God, King of the Universe, who creates. fruit of the vine.

Hallel and Musaf for Rosh Chodesh

Global Day of Jewish Learning

Chosen by chance? The Aleinu and its paradoxes

THE LAND OF ISRAEL IN TANAKH #3 Prophecy

M A K I N G N E G A T I V E S P O S I T I V E

And the king lamented for Abner, and said: Should Abner die as a churl dieth?--no.

A R E Y O U R E A L L Y A W A K E?

The Challenges and Problematics of the Jewish Narrative of Peace Donniel Hartman

Psalm BHS NASB Simmons Simmons footnote Category Comments

Part I: Mathematical Education

GCSE topic of SHABBAT. Shabbat. What you need to know (according to the syllabus)

Chapter 29 Lecture Roadmap

Qal Imperative, Qal Jussive, Qal Cohortative, Negative Commands, Volitive Sequences Mark Francois. Hebrew Grammar

בס ד THE SEDER EXPLAINED. Rabbi Moshe Steiner April 19th, Unit #4 Matzah & Maror

Yom Haazikaron memorial ceremony

Global Day of Jewish Learning

A Presentation of Partners in Torah & The Kohelet Foundation

94 Week Twelve Mark Francois. Hebrew Grammar. Week 12 - Review

You and I will Change the World Part 1

Name Page 1 of 5. דף ז. This week s bechina begins with the fifth wide line at the top of

BEING A VISIONARY JOLT LEADERSHIP PROGRAM 2014

Threw the Two Tablets Messiah On The Tree

BEAUTY AND UGLINESS. Global Day of Jewish Learning: Curriculum. A Project of the Aleph Society

practice (Rambam Sefer Nashim, Hilkhot Ishut 3:1; Shulĥan Arukh, Even HaEzer 27:1, and in the comment of Rema).

מ ה ש ה י ה כ ב ר ה וא ו א שר ל ה י ות כ ב ר ה י ה ו ה א לה ים י ב ק ש את נ ר ד ף

Mezuzahs. what s on the door. You can join the InterfaithFamily Network or signup for our newsletter at

Perek VII Daf 39 Amud a

Global Day of Jewish Learning

קובץ לימוד י"ג אייר ר' ישראל ארי' ליב שניאורסון לה ק ואנגלית תרס"ו-תשי"ב ( )

THOUGHT OF NACHMANIDES: VAYECHI: WHAT S IN GOD S NAME?

21-1. Meaning Spelling HebrewSyntax.org JCBeckman 1/10/2012 Copy freely CC BY-NC-SA 21-3

ו 4 י כ ת ב מ ש ה א ת כ ל ד ב ר י י הו ה ויש כ ם בב ק ר וי ב ן מ ז ב ח תחת ה ה ר וש ת ים ע ש ר ה מצ ב ה ל ש נ ים ע ש ר ש ב ט י י ש ר א ל

The Wise Woman of T ko ד - י םי רפ ב" מש 1 ו ל ש בא,ח ר ב י ודל םו ל ש בא וחל ח ר ב םו ל ש בא וזל ח ר ב Absalom had fled Absalom had fled

Beginning Biblical Hebrew

Being a Man of Faith

Student Workbook. for Shabbos night

מ ש ר ד ה ח י נ ו ך ה פ ד ג ו ג י ת א ש כ ו ל מ ד ע י ם על ה ו ר א ת ה מ ת מ ט י ק ה מחוון למבחן מפמ"ר לכיתה ט', רמה מצומצמת , תשע"ב טור א'

Transcription:

תר גול שי עור י ב ית 12 חזרה ע ל שא לו ת חשו בו ת מ שי ע ורי הבי ת ת וכנה 1 ס מ ס טר א' תשס"ז 1

סט ודנט י ם יקרים, אנא הקדישו מעט מזמנכם היקר ומלאו את סקר ההוראה. הסקר חשוב מאד כפידבק למרצים ולמתרגלים, ומשפר את רמת ההוראה באוניברסיטה. אנא זכרו גם שאם לא ימלאו מספיק אנשים את הסקר, לא יאכילו את הדוקטורנטים יותר. צו ו ת הק ו רס 2

הת רגילי ם ע ל יה ם נעבו ר Expressions (ex 8) Wild World (ex 7) Cars (ex 9) 3

Expressions (ex 8) תזכורת: בתרגיל זה הייתם צריכים לממש תכנית הפותרת ביטויים אריתמטיים פשוטים רכיבי התכנית השונים היו Expression ישות המייצגת ביטוי כלשהו..(double) ישות המתארת מספר בודד Literal BinaryOp ישות המתארת פעולה בינארית (פעולה על שני ביטויים). TrenaryOp ישות המתארת פעולה טרינארית (פעולה על שלושה ביטויים). Sum ישות המתארת סכום. - Product ישות המתארת מכפלה. - Exponent ישות המתארת חזקה. a, aשהיא,b c ישות המתארת פעולה על שלושה פרמטרים CondExp? b : c. שערוך הביטוי מתבצע כך: אם ערכו של a שונה מ 0.0 יוחזר ערכו של b אחרת יוחזר ערכו של c. 4

איך נראה עץ ה מ חל קות? Expression Interface? Abstract Class? Class? Literal BinaryOp TrenaryOp Sum CondExp Product Exponent 5

ול מ י מו ש... Expression Literal BinaryOp TrenaryOp public interface Expression { public double eval(); Sum Product Exponent CondExp public abstract class BinaryOp implements Expression { public BinaryOp(Expression e1, Expression e2) { lexp = e1; rexp = e2; public double eval() { return op(lexp.eval(), rexp.eval()); abstract public double op(double left, double right); abstract public String op(); public String tostring() { return new String("(" + lexp + ") " + op() + " (" + rexp + ")"); private Expression lexp, rexp; 6

ול מ י מו ש... Expression Literal BinaryOp TrenaryOp public interface Expression { public double eval(); Sum Product Exponent CondExp public abstract class BinaryOp implements Expression { public class Sum extends BinaryOp { public Sum(Expression e1, Expression e2) { super(e1, e2); public double op(double left, double right) { return left + right; public String op() { return "+"; 7

Uma The Mechanic (ex 9) public class MyCar { public static final int LAMBORGHINI= 2; public static final int SUSITA = 4; public static final int RENAULT = 5; private int type; public MyCar(int type) { this.type = type; public String getmanufacturername(){ switch (type) { case LAMBORGHINI: return "LAMBORGHINI"; case RENAULT: return "RENAULT"; case SUSITA: return "SUSITA"; return "Manufacturer Unknown";?47 מה הבעיות במחלקה? public int getnumofdoors(){ switch (type) { case LAMBORGHINI: return LAMBORGHINI; case RENAULT: return RENAULT; case SUSITA: return SUSITA; return -1; 8

פתרון רא שון: י ר ושה.1.2 כי צד נפתו ר הבעיות בעזרת ירושה? מזעור כמות קוד מזעור זיכרון הנדרש ע"י מופע 9

פתרון רא שון: י ר ושה כי צד נפתו ר הבעיות בעזרת ירושה? public abstract class MyCar { private String manufacturer; private int numofdoors; public MyCar(String manufacturer, int numofdoors) { this.manufacturer = manufacturer; this.numofdoors = numofdoors; public String getmanufacturername(){ return manufacturer; public int getnumofdoors() { return numofdoors; מזעו ר כמו ת קוד מזעור זיכרון הנדרש ע"י מופע public class Lamborghini extends MyCar { public Lamborghini() { super("lamborghini", 2);.1.2 10

פתרון רא שון: י ר ושה כי צד נפתו ר הבעיות בעזרת ירושה? מזעור כמות קוד מזעור זיכרון הנדרש ע"י מופע.1.2 public abstract class MyCar2 { public abstract String getmanufacturername(); public abstract int getnumofdoors(); public class Lamborghini2 extends MyCar2 { public String getmanufacturername() { return "Lamborghini"; public int getnumofdoors() { return 2; 11

פתרון רא שון: י ר ושה public abstract class MyCar3 { public static final int LAMBORGHINI= 2; public static final int SUSITA = 4; public static final int RENAULT = 5; כי צד נפתו ר הבעיות בעזרת ירושה? מזעור כמו ת קוד מזעור זיכרון הנדרש ע"י מופע נשתמש ב טיפ ו ס?.1.2.3 public String getmanufacturername(){ if (this instanceof Lamborghini3) { public class Renault3 extends MyCar3 { return "Lamborghini"; else if (this instanceof Susita3) { return "Susita"; public class Lamborghini3 extends MyCar3 { else if (this instanceof Renault3) { return "Renault"; return "Manufacturer Unknown"; Use of instanceof is bad practice! 12

כי צד נב טי ח פתרון שני: ב לי י רושה? בלי שימוש ב- enum? type safety public class MyCar4 { public static final int LAMBORGHINI= 2; public static final int SUSITA = 4; public static final int RENAULT = 5; private int type; private MyCar4(int type) { this.type = type; public static MyCar4 createlamborghini() { return new MyCar4(LAMBORGHINI); 13

public enum MyCar5 { LAMBORGHINI(2), RENAULT(5), SUSITA(4); ול ב סוף... enum private int doors; MyCar5(int doors) { this.doors = doors; public String getmanufacturername() { return this.tostring(); public int getnumofdoors() { return doors; public static void main(string[] args) { MyCar5 bimba = MyCar5.LAMBORGHINI; System.out.println( "bimba was manufactured by " + bimba.getmanufacturername()); System.out.println( "bimba has " + bimba.getnumofdoors() + " door" + (bimba.getnumofdoors() == 1? "" : "s")); 14

Wild Wild Wild World תז כו רת World הינה מ ח לקה המייצ גת א ת העולם, n על n משב צו ת בכל מ הלך של הסימולציה, חיה יכולה לפעול פ ע ם אח ת חיות פועלות על אנרגיה, את האנרגיה שלה, מתה כל חי ה שייכת ל מין מסוים לכ ל פ עולה מ חיר ו חיה שגומרת (Species) יש שני סוגי חיות: אוכלי עשב וטורפים פעולות אשר חיה יכולה לעשות: ל זוז, לה שריץ(!) 15

עץ ה מ חל קות וה מנשקי ם מ י יצג מ י ן של חיה <<Interface>> Species <<Interface>> מ י יצג חיה אשר קי י מ ת בעולם ה מ שחק Animal ה מחלקה הראשי ת, מחזי קה את "עולם ה מ שחק" <<Class>> World <<Class>> מ י יצג פעו לה אשר חיה ב וחרת לעשו ת Action <<Class>> מצב מש בצת על ל וח ה מ שחק PatchState 16

חיה ו מ טה-חיה מדוע אנו צריכים שתי מחלקות Animal? Species & האם יש דרכים נוספות לממש את היחס בין גזע וחיה? <<Interface>> Species <<Interface>> Animal Cows <<Interface>> Animal Cows <<Interface>> Animal Cow Cow Cow??? 17

Data Encapsulation אחת הנקו דות החש ובות בתרגיל הייתה כי צד לקבוע איזו אינפו רמציה שייכת לאיזו מחל קה החיה י ו שבת ב מ שבצת [20,20] לחיה י ש 5.5 יח י דו ת אנרגיה החיה מ ס וגלת ל ראות 2 מ שבצו ת לכל כ י ו ו ן העלו ת ל בצע פעולה X ה י א Y 18

Data Encapsulation אחת הנקו דות החש ובות בתרגיל הייתה כי צד לקבוע איזו אינפו רמציה שייכת לאיזו מחל קה החיה י ו שבת ב מ שבצת [20,20] לחיה י ש 5.5 יח י דו ת אנרגיה החיה מ ס וגלת ל ראות 2 מ שבצו ת לכל כ י ו ו ן העלו ת ל בצע פעולה X ה י א Y <<Interface>> Animal <<Interface>> Species <<Class>> World <<Class>> Cow <<Class>> Cows 19

Data Encapsulation <<Interface>> Species <<Class>> Cows <<Interface>> Animal החיה י ו שבת ב מ שבצת [20,20] לחיה י ש 5.5 יח י דו ת אנרגיה החיה מ ס וגלת ל ראות 2 מ שבצו ת לכל כ י ו ו ן העלו ת ל בצע פעולה X ה י א Y <<Class>> Cow <<Class>> World 20

מ ה ל ך סימולצי ה Go over list of animals (sequentially) 1. Call Animal.Act(energy, fov) 2. Move animal to selected square 3. If herbivore, eat grass if exists on square 4. If predator, check if eats a herbivore 5. If animal spawned, insert spawn in order Regrow grass 21

אז מ ה חיה ב ע צם יו ד עת ל ע שות? public interface Animal { public Species species(); public Action act(double energyleft, PatchState[][] view); לפעול, למה? וזה כל מ ה שהיא צריכה לד עת מחיר כל פעולה קבוע, לא בידי החיה מיקום החיה בעולם לא משנה לה, פעולתה תלויה רק בשדה ראיה הנוכחי לתת לחיה לנהל את האנרגיה שלה בעצמה, סכנה ל"רמאות" 22

"ה עו ל ם" אילו מבני מידע נח וצים לצורך הסימולציה במחלק ה?World כיצד נעדכן את רשימת החיות תוך כדי מהלך אם אחת החיות השריצה, או נהרגה? איזה מידע נח וץ לנ ו על כל משבצת בעולם? האם PatchState מספיק? 23